|
Is there some way I can assign the system clipboard to a register on OS X? Vim has a nice feature where any interactions with the system clipboard go through the "*" register, so you won't clobber your system clipboard with any Vim-specific editing unless you explicitly ask to do so.
|
![]() |
|
![]()
|
# ? Jun 21, 2024 20:54 |
|
I use emacs evil. I know how to define and vim style macros, but I've not been able work out the syntax to save them in my init.el between sessions. Any suggestions for the best way to do this, so I can call the macros with @m or similar?
|
![]() |
|
Deus Rex posted:Is there some way I can assign the system clipboard to a register on OS X? Vim has a nice feature where any interactions with the system clipboard go through the "*" register, so you won't clobber your system clipboard with any Vim-specific editing unless you explicitly ask to do so. I haven't tested this at all, but you should be able to disable the default behavior of putting all the Emacs kills into the clipboard (OS X calls it the pasteboard apparently, news to me) by advising the ns-set-pasteboard function and writing some wrapper functions. The following tells Emacs to only copy data to OS X's system clipboard if enable-copy-to-clipboard is set to something non-nil. Lisp code:
Lisp code:
Personally, if I wanted this (I don't, but hey, it's your thing), I'd set up a key to toggle between using/not using the system clipboard, and disable it when I was interested in moving data around. Lisp code:
I hope I didn't overthink this too much. I'm sure you were looking for a snippet that would just do the job for you, but nothing like that comes to mind. ![]() wooger posted:I use emacs evil. I know how to define and vim style macros, but I've not been able work out the syntax to save them in my init.el between sessions. I don't know anything about evil, but as a guy who used vim exclusively for 10 years, I'm interested in seeing the answer.
|
![]() |
|
Are there any decent videos/screencasts out there by emacs masters that are just doing their thing and maybe explaining some of the features they use? The Peepcode Play by Plays are the type of thing I'm talking about. I have the one with Jim Weirich and it was fun watching him work and chat about some of the emacs features he uses. There may have been other Play by Plays where they used emacs but I obviously can't go there anymore. Does that type of content exist?
|
![]() |
|
Emacsrocks and the companion series Extending Emacs are both great. Magnar's enthusiasm is infectious. https://www.youtube.com/watch?v=D6h5dFyyUX0
|
![]() |
|
Thanks, they are pretty great! I watched the first few and plan to go through the rest. Is he not creating any more? The last video was 5 months ago and the last "episode" was a year ago.
|
![]() |
|
Ok, when pressing page-up or page-down the cursor moves as I scroll through the file. But when I get to the top or bottom of the file, the cursor doesn't go all the way to the top or bottom. It just chills in the middle of the screen. What can I do about this? Also! holy crap I spent a few minutes and setup multiple cursors mode and now I can use emacs like how I use Sublime Text! ![]()
|
![]() |
|
PlesantDilemma posted:Ok, when pressing page-up or page-down the cursor moves as I scroll through the file. But when I get to the top or bottom of the file, the cursor doesn't go all the way to the top or bottom. It just chills in the middle of the screen. What can I do about this? Customize the scroll-error-top-bottom variable to t. PlesantDilemma posted:Also! holy crap I spent a few minutes and setup multiple cursors mode and now I can use emacs like how I use Sublime Text! Don't sweat it: your personal configuration will self-optimise to a point of stable comfort after a few decades. ynohtna fucked around with this message at 20:42 on May 12, 2014 |
![]() |
|
I know Xah is a controversial turd sometimes, but he seems to be in real trouble right now: http://ergoemacs.org/misc/xah_as_good_as_dead.html He's a bit of a wretched cave troll, but he does dedicate a great deal of his energy towards helping people learn Emacs (and other things.) I know that I would probably not have been able to integrate Emacs into my workflow if I hadn't come across his tutorials early in my newbie phase. Help him if you feel compelled, though I'm not sure how much good buying one of his tutorials will do him (or you). Just thought I would bring this up here, since you folks will have probably heard of him. Edit: In case you do feel like helping him, pay attention to this detail towards the bottom of the linked page: Probably mentally ill troll Xah Lee posted:i won't actually be able to draw money from paypal, due to bank/IRS problem. So dobbymoodge fucked around with this message at 15:24 on May 16, 2014 |
![]() |
|
dobbymoodge posted:I know Xah is a controversial turd sometimes, but he seems to be in real trouble right now: http://ergoemacs.org/misc/xah_as_good_as_dead.html So I remember several years ago he was living out of his car because he was a miserable turd who was far too brilliant to hold down a regular job with the rest of us plebs. Apparently he got some money at some point (sold the car?) and has been living, by himself, in a $1500/month apartment, despite no longer having an income source. Now surely even before the IRS took the money he owed, he knew he wouldn't be able to pay the next month's rent, but he still waited until he was absolutely penniless to actually get a goddamn job. Now he thinks that because he actually has a full-time job, there's just no possible time in the remaining 15 hours of the day to interview for something better? He's been a irredeemable shitlord since I first encountered him almost a decade ago, and it's apparently taken him this long to realize you don't get paid to call people stupid in newsgroups. I do like that he's not too distraught to download porn... and leave the download thingy up in his Chrome screenshot so we can all go to imgur and see his preferences. Edit: If people give him enough money to pay rent (via his friends, does that make them accessories to tax evasion), I'll bet he pays rent and quits his dishwashing job. He should perhaps consider getting a job that's not in computing, since over a decade of being a very vocal shitbird on the Internet means a LOT of interviewers are going to say, "Xah Lee? Hah, gently caress that guy." I know I would. Pham Nuwen fucked around with this message at 16:36 on May 16, 2014 |
![]() |
|
Pham Nuwen posted:So I remember several years ago he was living out of his car because he was a miserable turd who was far too brilliant to hold down a regular job with the rest of us plebs. Apparently he got some money at some point (sold the car?) and has been living, by himself, in a $1500/month apartment, despite no longer having an income source. Now surely even before the IRS took the money he owed, he knew he wouldn't be able to pay the next month's rent, but he still waited until he was absolutely penniless to actually get a goddamn job. Now he thinks that because he actually has a full-time job, there's just no possible time in the remaining 15 hours of the day to interview for something better? Looking at his history, I think it's apparent that he probably has some serious unaddressed mental or emotional problems. You're right, his behavior is pretty narcissistic and irresponsible, and I don't think tossing cash at him is going to change anything. Even if he had the self awareness to realize this, it wouldn't help. He's saying "I need cash for rent" but he should really be saying "I need a minimum of 3 years therapy, probably some meds, an employment counselor, and weekly visits from a nutritionist." You can't get that over paypal. I didn't make my last post in order to guilt people into donating to him; the guy is a grade-A bridge-burner, I'd be surprised if he gets enough donations to cover rent. That said, Emacs users are probably the only people on Earth who have any reason to care about his well-being, and he is a human being who deserves some compassion. I doubt anyone here really has the resources to get this guy the help and support that he truly needs. If there is some social worker who lives in the bay area, uses Emacs, is a goon, has nothing better to do and feels like helping him out, I'd feel pretty lovely if I only discovered that after Xah's bloated carcass is fished out of a storm drain. I'd be surprised if he didn't have scurvy or pellagra or something, homeboy has been eating just oats and noodles for 3+ years now? In his youtube interview with Sacha Chua his gums look pretty recessed, so who knows what else is going on. Pham Nuwen posted:I do like that he's not too distraught to download porn... and leave the download thingy up in his Chrome screenshot so we can all go to imgur and see his preferences. This is pretty hilarious. Pham Nuwen posted:Edit: If people give him enough money to pay rent (via his friends, does that make them accessories to tax evasion), I'll bet he pays rent and quits his dishwashing job. He should perhaps consider getting a job that's not in computing, since over a decade of being a very vocal shitbird on the Internet means a LOT of interviewers are going to say, "Xah Lee? Hah, gently caress that guy." I know I would. 100% with you on this; his prospects are probably whatever upwards mobility he has with his dishwashing gig, even if he does get all the help and rehabilitation in the world.
|
![]() |
|
dobbymoodge posted:I didn't make my last post in order to guilt people into donating to him; the guy is a grade-A bridge-burner, I'd be surprised if he gets enough donations to cover rent. That said, Emacs users are probably the only people on Earth who have any reason to care about his well-being, and he is a human being who deserves some compassion. I doubt anyone here really has the resources to get this guy the help and support that he truly needs. If there is some social worker who lives in the bay area, uses Emacs, is a goon, has nothing better to do and feels like helping him out, I'd feel pretty lovely if I only discovered that after Xah's bloated carcass is fished out of a storm drain. lmbo
|
![]() |
|
I've met him in person at a meetup, he's a nice guy as far as I can tell.
|
![]() |
|
Hey thread, Whats your flow to get tabs to work correctly? I'm in the javascript mode that comes with Emacs 24.3.1. I load a file that uses tabs for indent, and tabs are rendered as 8 spaces. When I press the tab key, I get 4 spaces inserted. I know every mode can set it up differently. What are the usual functions/variables that need to be tweaked to get tabs the way you like? My goal is to edit this javascript file and press tab and get a tab character that renders as 4 spaces.
|
![]() |
|
PlesantDilemma posted:Hey thread, Whats your flow to get tabs to work correctly? I'm in the javascript mode that comes with Emacs 24.3.1. I load a file that uses tabs for indent, and tabs are rendered as 8 spaces. When I press the tab key, I get 4 spaces inserted. I know every mode can set it up differently. What are the usual functions/variables that need to be tweaked to get tabs the way you like? My goal is to edit this javascript file and press tab and get a tab character that renders as 4 spaces. The first and perhaps most difficult thing will be convincing emacs to insert actual tab characters. I have managed it and will share my elisp when I'm back at my desk. Edit: Ok here's how I set up my C mode, you should be able to use something similar: code:
Theoretically you shouldn't have to do that define-key thing, but sometimes emacs loving Lies. They claim that (setq indent-tabs-mode t) would insert tabs, but it just didn't seem to do it. This is my scorched-earth approach and it seems to work. Pham Nuwen fucked around with this message at 23:25 on May 21, 2014 |
![]() |
|
I've got this for Python mode:code:
|
![]() |
|
I'd also recommend customizing backward-delete-char-untabify-method as nil, so that tabs will not be converted to spaces when you backspace. This may or may not be related to the problems that Pham has. It's a global customization, which is probably for the best. Use the customization UI and don't try to put it in the hook.
|
![]() |
|
Gazpacho posted:I'd also recommend customizing backward-delete-char-untabify-method as nil, so that tabs will not be converted to spaces when you backspace. This may or may not be related to the problems that Pham has. It's a global customization, which is probably for the best. Use the customization UI and don't try to put it in the hook. Oh, yeah, I have that elsewhere in my .emacs too. Good call.
|
![]() |
|
Does every major mode have a hook? I added this to my .emacsLisp code:
|
![]() |
|
PlesantDilemma posted:Does every major mode have a hook? I added this to my .emacs I think c-basic-offset might work in all modes, but I'm not sure about the c-mode-map thing for javascript mode. Also, it looks like the javascript mode is js-mode, so try (add-hook 'js-mode-hook 'fn-fix-the-tabs)
|
![]() |
|
Most major modes have a mode hook. css-mode is an example of one that doesn't and I would consider that a bug. You only need (interactive) in functions that you run from the minibuffer. vvvv yeah Gazpacho fucked around with this message at 20:06 on May 22, 2014 |
![]() |
|
Gazpacho posted:You only need (interactive) in functions that you run from the minibuffer. You need them on anything which is done 'interactively', whether from a keybinding or the minibuffer.
|
![]() |
|
Pham Nuwen posted:it looks like the javascript mode is js-mode, so try (add-hook 'js-mode-hook 'fn-fix-the-tabs) This did it for my Js stuff, and the php-mode-hook does work, I didn't realize that it wasn't enabling php-mode when I open a php file, it was still in fundamental haha. I added this and now I'm golden: Lisp code:
![]()
|
![]() |
|
I have the whitespace-style "lines-tail" option on so it highlights when I columns exceed X characters. I like it when I'm writing code, but it's super annoying when I'm in my personal org-mode files, especially since I use tables a whole bunch. I've had to turn the option off for now, but is there a way I can have it on all the time except when in org-mode?
|
![]() |
|
Xik posted:I have the whitespace-style "lines-tail" option on so it highlights when I columns exceed X characters. I like it when I'm writing code, but it's super annoying when I'm in my personal org-mode files, especially since I use tables a whole bunch. org-mode hook containing something like (set (make-local-variable 'whitespace-style) (remove 'lines-tail whitespace-style)) ?
|
![]() |
|
ynohtna posted:org-mode hook containing something like (set (make-local-variable 'whitespace-style) (remove 'lines-tail whitespace-style)) ? Beaten, but just for completeness: Lisp code:
Lisp code:
![]()
|
![]() |
|
pgroce posted:Beaten, but just for completeness: Awesome, thank you both, that did it! I really should learn (emacs) lisp at some point, it's just so drat foreign compared to what I already know.
|
![]() |
|
Xik posted:Awesome, thank you both, that did it! Learning the basics has done a lot of good for me, it makes it far easier to figure out what a thing is doing, especially these days when I use Company which has almost no documentation. I recently had to do a small project in C++ for Uni, it turns out that clang is much cooler than I thought and flycheck uses it to make C++ almost fun to write. In fact I am amazed at how good flycheck is. Through looking for documentation for Company I found this emacs config: http://steckerhalter.co.vu/steckemacs.html It contains a bunch of nice packages, like quelpa which manages emacs packages from a bunch of different sources, it is nicely formatted, and well explained.
|
![]() |
|
Ok I broke my emacs and now I'm sad. Emacs 24.3.1 on Ubuntu. I used the package manger to install the Sublime Text package, now when I start emacs I get some startup errors. Emacs runs but it doesn't load my .emacs file and I can't use the ESC button. Every time I press ESC to do a M-x the minibuff says "Cannot open load file: /yasnippet" Omg I can't do M-x that's like my main thing. How do I uninstall the sublime package I installed? Emacs told me to run emacs --debug-init and It points to yasnippet being where the problem is. Or at least that's where stuff breaks, the real problem could be elsewhere. I see both a yasnippet and sublime folder under .emacs.d/elpa/ should I delete those folders?
|
![]() |
|
I don't use a package manager for Emacs so take this for what it's worth.PlesantDilemma posted:I see both a yasnippet and sublime folder under .emacs.d/elpa/ should I delete those folders? You could start with just moving / renaming the folder and see how that goes. There's probably some init file somewhere loading those so Emacs will still complain it can't find sublime and yasnippet. I have no idea where the package manager stores its configuration but doing a code:
|
![]() |
|
Thanks for the tips Aerique. Renaming the two folders was enough to get everything working again. Whew. Hey, does anyone use keybindings other than M-w and C-w for copy/cut ? I don't like M-w for copy, but I don't know what other keybinding to use. I'm afraid I'll overwrite something useful that I just don't know about yet.
|
![]() |
|
I use C-w for backward-kill-word, as in Readline, and C-x C-k for killing a region. I find myself needing to kill a word way more often than a region, and this way I can minimize reaches for backspace.
|
![]() |
|
PlesantDilemma posted:Hey, does anyone use keybindings other than M-w and C-w for copy/cut ? I don't like M-w for copy, but I don't know what other keybinding to use. I'm afraid I'll overwrite something useful that I just don't know about yet. Don't be afraid of that. Emacs is meant to be customized. I've been using a evil-mode for a couple of years now which gives me Vim-like behavior, before that I had extensive custom keybindings of my own. The last iteration of which converged to what is considered default for standard Windows and Linux apps. So C-z, C-x, C-c, C-v for undo, cut, copy and paste. C-a for selected all. C-PgUp and -PgDn for cycling through tabs, etc. etc. It was nice but I had used Vim in the past and preferred that. Before that I had really my own custom bindings which were pretty optimal and nice but too different from other apps which irked me.
|
![]() |
|
aerique posted:Don't be afraid of that. Emacs is meant to be customized. Amen. And even stock Emacs is sensitive to the fact that the cut and paste commands are idiosyncratic; the Mac builds by default map Command-x/c/v to cut/copy/paste. (I unbind them because I use Command as Meta, and also I'm cranky and hate change. (Friends don't let friends use cua-mode.)) PlesantDilemma posted:I'm afraid I'll overwrite something useful that I just don't know about yet. The most helpful command for figuring out what key maps to what (and what you might be overwriting) is describe-key (bound to C-h k). It will also tell you if a key is not bound. If you're still concerned about keeping the default keybinds around (a lot of them are quite useful, and it's nice not to be completely lost when you sit down at someone else's Emacs ![]() How you do this is platform-specific. Noted I-guess-not-homeless-guy Xah Lee explains how to use Super and Hyper on Windows and Mac. (All the mac-prefixed variables he mentions are now aliases for variables prefixed with ns- because RMS is a big nerd. You can use either, but I guess mac- might go away someday. Maybe.) Presumably one does this on Linux through either X keymaps or terminal escape code voodoo, depending on whether you're running Emacs on the terminal or in a GUI window. I haven't dealt with that in years, hopefully someone knowledgeable can chime in.
|
![]() |
|
A reason to get familiar with the Emacs defaults would be that the Bash[1] shell uses them as well, but those can be rebound as too. [1] the readline library actually so the key bindings return in more apps
|
![]() |
|
aerique posted:A reason to get familiar with the Emacs defaults would be that the Bash[1] shell uses them as well, but those can be rebound as too. Also the standard GUI widgets on OS X!
|
![]() |
|
pgroce posted:Amen. And even stock Emacs is sensitive to the fact that the cut and paste commands are idiosyncratic; the Mac builds by default map Command-x/c/v to cut/copy/paste. (I unbind them because I use Command as Meta, and also I'm cranky and hate change. (Friends don't let friends use cua-mode.)) On Linux, I have Hyper mapped to Capslock, though I don't use it in Emacs but for i3wm as my general mod-key there. It's a bit of a pain to do though; I used Xmodmap (and ~/.Xmodmap as the config file for it) to unbind the modifiers, set they specific keys via keycodes, then reassigned the modifiers, which ends up looking like this: code:
Hollow Talk fucked around with this message at 01:33 on Jul 3, 2014 |
![]() |
|
So I used M-x upcase-region and got a warning about it often confusing new users. What's the story on that? Is it doing something besides just making all the letters capitol? I was surprised by the warning.
|
![]() |
|
PlesantDilemma posted:So I used M-x upcase-region and got a warning about it often confusing new users. What's the story on that? Is it doing something besides just making all the letters capitol? I was surprised by the warning. Essentially, there are some functions which the average (or new) user usually doesn't use or that would confuse them. One such example is the narrowing down of a buffer which might sometimes be useful but to a new user might seem like most of their document just vanished. M-x upcase-region is probably another such function, because it won't be used that often, hence the warning. It's really just a way to keep people from activating something unknowingly yet still giving people who do need the functionality a way to do so. When the message pops up, you will also get presented with a number of shortcuts in the minibuffer, which are essentially "use despite warning" or "cancel", but also "unlock for future use", which means you won't see the warning again as a variable is written to your profile file. Essentially, upcase-region will do exactly what it says, it's just that what it does is rarely what most people would want. If you need to use it, just do, there aren't any other undocumented consequences!
|
![]() |
|
![]()
|
# ? Jun 21, 2024 20:54 |
|
On top of what Hollow Talk correctly states, upcase-region is also mapped by default to a key sequence that a new user may invoke accidentally before they have learnt the core of how Emacs works and - vitally - how to invoke the essential undo operation.
|
![]() |