11 ms·
The single most useful Emacs feature
- calibraxis 15y agoUndo-tree handles all my undo'ing needs, and non-emacs users like looking at its strikingly elegant tree visualizer. (http://www.emacswiki.org/emacs/UndoTree http://www.emacswiki.org/emacs/UndoTree) Scroll down for screenshot. And follow-mode on a monitor turned sideways is pretty funny. Doubles your vertical space (good for eyeballing logs and data dumps).
- markbao 15y agoFor Vim users like myself, there's a related Stack Overflow Discussion: What is your most productive shortcut with Vim? http://stackoverflow.com/questions/1218390/what-is-your-most-productive-shortcut-with-vim http://stackoverflow.com/questions/1218390/what-is-your-most...
- rryan 15y agoThe very phrasing of these two questions highlights the philosophical differences between emacs and vim: "feature" vs. "shortcut".
- nyellin 15y agoIt isn't an official part of Emacs, but no Emacs user should go without installing el-get, the meta-package-manager for Emacs. https://github.com/dimitri/el-get https://github.com/dimitri/el-get El-get can install and update elisp from git, svn, http, and EmacsWiki. (It also wraps ELPA and apt-get where packages exist.) If el-get doesn't have a recipe for your favorite Emacs extension, please consider adding the recipe and pushing to GitHub. (It doesn't take long - most recipes are only a few lines long.) Don't forget to issue a pull request for the rest of us.
- justinhj 15y agoI use package.el Any advantage to swapping to el-get?
- nyellin 15y agoYes, package.el doesn't install arbitrary snippets from anywhere on the internet.
- technomancy 15y agoIt takes about five minutes to take a library that isn't packaged and publish it on Marmalade, and then anyone can depend upon it. el-get made lots of sense back in the day when package.el only supported tromey.com, but now that there's a community repository I don't see the point.
- nyellin 15y agoOK. My old complaints against package.el were as follows: 1. Packages need to be updated manually by maintainers. I can't use package.el to install the master branch of my favorite project on GitHub, or an old snippet on EmacsWiki. 2. Marmalade (the community repository) has licensing requirements for package inclusion. Are those two assumptions incorrect?
- technomancy 15y ago> 1. Packages need to be updated manually by maintainers. Yes, but considering uploading new versions can be done with M-x marmalade-upload-buffer, generally Marmalade encourages short release cycles. So there's not much reason to ever work from master unless you're hacking on it yourself, in which case you already have it checked out. > 2. Marmalade (the community repository) has licensing requirements for package inclusion. This is not specific to Marmalade since Emacs itself has licensing requirements. Every elisp library is a derivative work of Emacs itself, therefore it must be distributed under the same license. EDIT: Perhaps you're thinking of elpa.gnu.org? That repository requires copyright assignment for libraries to be included, but Marmalade does not.
- nyellin 15y agoOK. I was wrong about licensing requirements. I think you're slightly confused about el-get's purpose: it isn't to replace package.el. el-get supplements package.el and provides options for people who want to run the latest and greatest versions of libraries, or who can't be bothered to monitor the odd elisp snippet and update Marmalade every time it changes. Personally, I find el-get recipes so easy to install and create that I never use package.el at all, but that isn't the goal of el-get developers. Here is an example recipe for el-get. I haven't tried creating uploading anything to Marmalade yet, so I can't compare the ease of use. https://github.com/dimitri/el-get/blob/master/recipes/evil.rcp https://github.com/dimitri/el-get/blob/master/recipes/evil.r... One last note: You may find that el-get lowers the barrier for contributing to libraries. If you find the odd bug in a mode you use, the source code is always checked out in ~/.emacs.d/el-get and it would be practically criminal to not fix it. With package.el, you have to reinstall the library first.
- vdm 15y ago+1. el-get is the homebrew of Emacs, and is even better for letting you hook in to do custom init.
- dman 15y agoslime - emacs package for editing, running, debugging and enjoying lisp.
- pjscott 15y agoIt's the finest IDE I've seen for any language.
- kakuri 15y agoI can't switch away from Notepad++ to any editor that lacks instantaneous, no-hassle (no extra key presses), buttery smooth current buffer word auto-complete.
- tptacek 15y agohi-lock-mode! Hi-lock lets you specify regexes to highlight anywhere in a file; it's like domain-specific font-lock. It's astoundingly useful in code review. For instance, given a giant blob of J2EE web handler code, I can eyeball one handler, recognize the annotation mapping the method to URL syntax, and then punch in a hi-lock regex to light up similar annotations everywhere in the file, then glance through the whole file looking for color patterns. I can read any of those functions and recognize the code that checks "am I an admin", hi-lock it, and then quickly spot any function mapped to a URL that doesn't check admin credentials. That's just one tiny use case. I used hi-lock so much I ported it into our web-based code review tool. I converted one person to Emacs just to get that feature (my office would be thrilled if someone could point out the vim package that does the same thing). CUA column editing (CTR-SPC arrow-arrow-&c type-type-&c) is probably my #2. Late edit: Holy hell how do you forget magit! Magit is a near-complete UI for git; it figures out what git repo you're working from, and then gives you up-to-date status on the contents of your checkout, spots untracked files, allows you to visually stage your commits, gives you single-key revert and a browsable repo history. Magit is one of the rare Emacs extensions that not only improves Emacs but also the external service it integrates with. I am actually a better git user (or, git is just better) when I've got magit running.
- jrockway 15y agoOccur also works nicely for this use case, as you can visit each place in order with C-x `. Actually, something like eproject-grep is even nicer, because you can visit every occurrence in the project that way.
- tptacek 15y agoI didn't know about occur, which is awesome and thanks. The benefit of hi-lock is that I can "read" code without actually having to "read" it. Instead, I can either set myself up to look for patterns of colors (function --- red line --- shit no blue line!), or set myself to serendipitously discover things as I actually do read code. I have never, ever, ever, ever figured out an Emacs "grep" that I liked enough to stop using find/xargs/grep from eshell.
- jpdoctor 15y agoGood god. I've been using emacs since 1981 and this thread is teaching me things.
- mark_h 15y agoI've "only" been using it since 1998, but I always skim threads like this -- even lots of short articles -- because there's nearly always something new to discover! Sometimes it's hard not to gush, but it's just such an amazing and organic piece of software.
- diminish 15y agoi was escaping it since 1992, and now i jumped into it while reading this.. and i admire.
- nessus42 15y agoLikewise! How will I ever get any work done with all these new productivity features I'm learning about! My favorite Emacs feature that I've learned about in the past year is Org-Mode. I use it now for just about everything.
- rodw 15y agoOrg-mode is what finally converted me to being an emacs user. I'd been searching for a lightweight, console/cli-mode outliner/task-manager when it occurred to me "surely emacs has something for this". It did, of course. For several weeks I used emacs only for org-mode. Slowly but surely emacs started to take over my more and more of my editing tasks. Now I find myself not even bothering to launch X, but simply emacs from the Linux console (run level 3?). It's amazing how responsive a computer is when you're not using any gui at all. I've since discovered that org-mode is pretty common gateway into emacs.
- bbwharris 15y agoIsn't it funny how the rabbit hole just keeps going?
- tjr 15y agoIt's nothing unique to Emacs, but I get a lot of use out of M-q.
- bitstream 15y agoThe kill ring gets my vote. Regional undo/redo is a close second.
- ordinary 15y agoThis is not really a feature, as such, but it is a classic work-around for one emacs' many silly defaults: ; Ask for y/n on all queries that normally ask for yes/no. (fset 'yes-or-no-p 'y-or-n-p)
- tikhonj 15y agoI personally don't think that default is silly. I've noticed that some (usually less important) questions use y or n already; the yes/no is reserved for important ones. I don't mind having to type a bit more before recursively deleting a directory, for example.
- jrockway 15y agoI do this, but defalias is a better choice for implementing it than fset.
- jlongster 15y ago`ansi-term` is probably is for me. Integrating your terminal closer with your editor is really amazing. Using `multi-term` to make it easier to handle multiple terminals, and you've got a really nice integrated environment. That's probably the killer feature for me.
- SonicSoul 15y agoon a side note, whenever i asked such open ended question on stackoverflow, it would quickly get closed by some other user claiming that "there is no right answer" and the question must be closed. But there are so many great open ended questions on there that score so high among users. i guess it's a matter of luck that some anal retentive person doesn't get to it first?
- JeremyBanks 15y agoIt's not exactly luck. Until today this question hasn't been active since 2009, when opened-ended questions were permitted. Now that it's been bumped it'll be closed shortly.
- smackfu 15y agoClosed now. I'm actually surprised that someone hasn't gone through all the older questions looking for stuff to close, given how rigid their mods tend to be.
- deleted 15y ago[deleted]
- rcthompson 15y agoThe moderation is lazily-evaluated on-demand. Before today it was just a moderation thunk.
- michaelty 15y agoC-x C-t Transpose the current line with the previous line.
- xtacy 15y agoI like idomenu, which lists variable/function definitions in your file. When you combine it with ido-menu, it's magic. Bind it to C-c s, and you get a list of symbols you can navigate extremely fast. The downside is that if the symbol locations change in a file, you'd have to refresh it. :(
- thurn 15y agoSorry, is there a typo in here somewhere? Are "idomenu" and "ido-menu" different things?
- noelwelsh 15y agoThe single most useful Emacs feature is the design of Emacs as a platform for hosting ELisp. Without ELisp, and the OS and text editing services provided by the Emacs run-time, none of these extensions would be possible. Trite but true!
- veyron 15y agoC-x C-c is to exit :)
- mmc 15y agoToo hard to pick one, it depends on the task. Maybe I'd go with M-x Occur. Other candidates are regex i-search, registers, yasnippet, kill/copy/(insert)string-rectangle, etc etc. Also, emacsclient.
- paddy_m 15y agofor me it has to be comint mode and every mode that wraps comint. I run M-x shell all the time, being able to use all my favourite editing commands to go back through shell history is just killer.
- plq 15y agoI thought StackOverflow was done with such poll-type questions? I was sorry to see the "Best Programming Comics" question go.
- justinhj 15y agoI use `self-insert-command' an awful lot. I'd say it was the single most important feature.
- juanre 15y agoIt's interesting that it's hard to explain, because the fingers will play the chord by themselves and I need to stop and think to know what I am actually typing. C-x r k to cut a rectangle, and C-x r t to add one filled with, for example, the comment symbol: (C-space)this to comment C-x r t # #this #to comment
- tikhonj 15y agoYou can also use the M-x comment-region and M-x uncomment region to comment stuff. If you use it a lot, just bind them to a convenient key stroke.
- mark_h 15y agoDon't forget M-; is comment-dwim which usually does... what you mean (uncomments the region if it looks commented, comments it otherwise)
- rebelnz 15y agoThis was my contribution to the SO thread! Super handy feature. I also use the - highlight block - then 'C shift -' to undo in region
- draven 15y agoand/or M-x comment-box
- ludwigvan 15y agoI find cua-mode's rectangle support superior. http://trey-jackson.blogspot.com/2008/10/emacs-tip-26-cua-mode-specifically.html http://trey-jackson.blogspot.com/2008/10/emacs-tip-26-cua-mo...
- to3m 15y agoHoly crap, thank you very much! Looks like cua-mode rectangle select might actually be the equal of Visual Studio's very straightforward rectangle selections...
- gaving 15y agoM-! open http://www.vim.org/ http://www.vim.org/
- jbp 15y ago- ido mode with ido-enable-flex-matching set. - recentf-mode integrated with ido. Too many to list.
- RockyMcNuts 15y agorecord and play macro (someone had to mention) C-x ( <type some magic /> C-x ) C-x e M-x 99 C-x e (play macro 99 times)
- tikhonj 15y agoAlso note that C-u 0 C-x e plays the macro until it rings the bell (e.g. runs out of buffer space or tries to forward-search for a name that doesn't exist. This is great when you don't know how many times it needs to be run.
- vedang 15y ago^ This. super-useful under appreciated keyboard macro feature.
- jrockway 15y agoM-x 99 C-x e (play macro 99 times) Actually, that would be M-9 M-9 C-x e or C-u 99 C-x e.
- RockyMcNuts 15y agooops... yes, what you said. ie Esc 9 9 C-x e
- parbo 15y agoUndo in region saves me every day.
- avar 15y agoTRAMP. Being able to seamlessly remotely edit files and run remote modes. At work I regularly edit files on 10-15 remote machines. But I never ssh to them and run an editor. Instead I'll just visit them through TRAMP, run Magit to commit stuff that I've done etc.
- tikhonj 15y agoMy coworkers often don't even realize I'm editing a remote file or working in a remote shell. It's really that seamless. Of course, sometimes I forget I'm working remotely, and hilarity ensues. The worst episode was in a recent school project. I thought "oh, I'll just finish this on the train". And then, when I got on the train, realized I had actually been working remotely. Oops.
- technomancy 15y ago> It's really that seamless. Not only is it seamless editing, you can actually use tramp to "cd" into a directory on a remote machine using eshell.
- rcthompson 15y agoDoes magit actually work in git repos on remote servers? Edit: Holy crap, it does. That's going to be useful.
- thingie 15y agoI use tramp as well, but can't say I like it. Blocking whole UI because of network problems, leaving garbage in the shell history on the machines I'm connecting to, getting confused (and hung-up) by different prompts. It's nice, but too volatile.
- jfb 15y agoThe kill ring. I would marry the kill ring and have its babies. Why have other editors not adopted this? Have they?
- billswift 15y agoI wish the Windows Clipboard would implement a version of the kill ring. I really, really hate not having previous cuts and copies available. As a rather clumsy work-around I keep an emacs scratch file open on my task bar and copy stuff I might need more than once to it.
- jfb 15y agoSame with the Mac clipboard.
- lucaspiller 15y agoThe pro version of Alfred has this functionality built in: http://www.alfredapp.com/powerpack/ http://www.alfredapp.com/powerpack/
- jfb 15y agoI will try this out, thanks.
- hn_reader 15y agoThe ditto clipboard manager for Windows http://ditto-cp.sourceforge.net/ http://ditto-cp.sourceforge.net/ has completely solved this problem for me.
- jharsman 15y agoSounds like you want XKeymacs it gives Emacs keyboard commands to all Windows applications, including a kill ring. http://www.cam.hi-ho.ne.jp/oishi/indexen.html http://www.cam.hi-ho.ne.jp/oishi/indexen.html
- winestock 15y ago
- ww520 15y agoBreadcrumb for Emacs
- T_S_ 15y agoCtrl-k
- Semiapies 15y agoIt's definitely up there for me, which I find amusing as I thought it was such an odd action to mention early in tutorials - and yet it's so damn handy once you get get it in muscle memory.
- gnuvince 15y ago`C-u SPC` which pops the mark. This allows you to go back to different places in your buffer quickly. For example, if you are editing a program and need to add an import statement, you could do it like this: `C-SPC M-< [add your import] C-u SPC` and you'll be back to where you were editing. If you are using transient-mark-mode, you can use `C-SPC C-SPC` to active and deactive the highlighted region. That'll still leave a mark.
- etfb 15y agoI love how every post on Stack Overflow that gets popular on Hacker News always gets closed by SO admins as "not constructive". It's like they really are annoyed when their stuff gets noticed by the world outside their walled garden. What are they - hipsters? "I was a fan of internet startups before they got popular, dude." It's bad enough on Wikipedia, which appears to operate on the principle that a megabyte of hard disk still costs $100, but on Stack Overflow it's just plain foolish.
- thristian 15y agoLess cynically, Stack Overflow is about specific answers to specific questions. Any question broad enough to be interesting to a site like Hacker News is too broad for Stack Overflow, apparently.
- etfb 15y agoMakes sense, but it's insane. More general answers are more generally useful than specific ones, by definition.
- thristian 15y agoNot always. The only question that the linked StackOverflow page can answer is "What Emacs features did a self-selecting set of StackOverflow users find particularly useful as of early December 2011". While it's quite possible that somebody might someday want that very specific piece of information, I can't blame Joel and Jeff for preferring that particular database-space had been used to record a workaround or explanation for some uncommon error message.
- kabdib 15y agoKeyboard macros. Multiple buffers, and windows against them. Followed closely by mode-specific buffers (c-mode, etc.). Buffers with command shells are the bee's knees. I love those things.
- Semiapies 15y agoFor newcomers, C-g is a delight (it certainly was for me). Especially with the arcane reputation of Emacs, it was awfully reassuring to know how to get out of whatever unfamiliar function I'd fat-fingered myself into.
- jrockway 15y agoWell, it won't get you out of recursive edits. I remember visiting a coworker's machine before telling him about those, and the modeline was something like [[[[[[[[[[(CPerl)]]]]]]]]]]. ESC ESC ESC is a much better "get me out of here!" command to remember.
- Semiapies 15y agoI haven't managed to get into such a position; I may not be as clever as your coworker.
- einhverfr 15y agoHard to argue with C-x C-s being the most useful feature of EMACS......... It's so useful people take it for granted ;-)