Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've used Emacs quite a bit, and I'm comfortable with the most basic commands/shortcuts, but I know Emacs has a lot more to offer than what I'm using. What are some of the lesser known features of emacs that can help me become a more productive programmer?

share|improve this question

closed as too broad by MichaelT, Snowman, jwenting, durron597, Bart van Ingen Schenau Sep 23 '15 at 18:31

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.If this question can be reworded to fit the rules in the help center, please edit the question.

@Whoever voted to close: this is definitely not off topic... – Chinmay Kanchi Sep 20 '10 at 21:26
If this is off topic, I suppose the main purpose of this site would be for "tell me your favorite story" type questions. – MIA Sep 21 '10 at 3:26
I don't see how this can be considered off-topic. If I asked this at Stack Overflow, it would probably be closed there as subjective. So if This doesn't fit at either site, where I am supposed to ask such a question? – GSto Sep 21 '10 at 15:04
Productive programmer eh.. – Daniel Little Sep 24 '10 at 5:43
I'm voting to close this question as off-topic because it is asking about a software tool. However, it is both too broad and too old to migrate to Stack Overflow. – Snowman Sep 23 '15 at 0:33
up vote 16 down vote accepted

Learn elisp.

  1. It allows you to program any shortcut you can think of. Any time you find yourself performing a multi-step process for something useful, you make a function out of it and bind it to a hotkey combo.

  2. It lets you experiment with functional programming - learning a new paradigm is a good way to expand your horizons.

share|improve this answer
Plus having some level of elisp fluency, will open a world of configurability. As soon as something annoys me I just try to fix it. Also yasnippet allows for programmable snippets which can save tons of typing (like alter the pattern inserted if you're in a header or implementation file, and about a million other tricks). – julien Sep 21 '10 at 11:58

Check out this SO page, it has enough tips to boost your Emacs productivity by at least 2x:

Also, you absolutely positively must use Org-mode if you're an Emacs user:

Org: Your Life in Plain Text

EDIT: Unfortunately, it seems the SO moderators not only closed the first question/link, but removed it as well, destroying knowledge and wisdom in the process. (Let's burn this book, we don't know where it belongs!) For now the only useful alternative link I've found is the HN thread discussing the SO thread:

The single most useful Emacs feature - Hacker News

share|improve this answer
SO link no longer works – funkybro Jul 27 '12 at 8:46
Thanks for the heads-up, stuck an alternative in, it's not as good but has some tips. – limist Jul 27 '12 at 14:09
You can still find the removed post in see:… – barracel Jun 12 '13 at 13:29
@barracel Thank you! A program/service has saved us from the foolishness of moderators. – limist Jun 21 '13 at 6:42

Off the top of my head:

M-x compile     (now do C-x ` to cycle through errors)
M-x gdb
M-x grep-find
M-x find-tag    (aka M-.  and C-u M-. is "next" tag)
inferior-processes (if you use an interpreted language, 
                    you can eval directly from Emacs)
C-x v v         ([version control][1])

In general, the Compiling and Testing Programs chapter of the info pages is a good read.

share|improve this answer

The great Steve Yegge has written a very nice blog post 10 Specific Ways to Improve Your Productivity With Emacs. It includes tricks and habits like

  • keyboard configuration (Swap Caps-Lock and Control, rebinding M-X)
  • Deleting word with backspace (if you are fast enough typer, getting rid of the whole word and retyping it is more convenient than continuously hitting backspace until your typo is erased)
  • Navigation by incremental searching
  • Using temporary buffers and learn to navigate buffers efficiently
  • Getting rid of navigation by mouse, menus and other GUI things
  • Learning to use the help system
  • Learning the power of regular expressions

He also lists some useful emacs modes and mentions many other tricks that make people wait in anticipation for future updates to the blog post.

share|improve this answer

I know you specifically asked about methods and commands, but I would suggest the following all-around approach:

  1. Read a book on Emacs: there are several including the Emacs Manual, and Learning Gnu Emacs by Cameron Et al. I know "read the manual" sounds trite and condescending, but what I'm really saying is that every time I read the manual, I find out about something really cool that I didn't even think of. I always feel like I haven't spent enough time reading the manual.
  2. Get into the Emacs Community: Emacswiki is a great place to communicate with other Emacs users and find out about cool packages. Also joining help-gnu-emacs can be good, because people will ask for help on features that they're using, and by proxy you can find out about those features. I have found many interesting features by seeing someone asking for help and then reading about it in the manual.
  3. Learn some Lisp: When you can at least discuss Emacs Lisp, you'll be in a much better place to learn about new features.
  4. Use Emacs all the time. I use Emacs for everything except web browsing (which it you can also do), and I'm therefore always in an opportunity to learn how to do some new thing better with some feature provided by Emacs. I use Emacs for mail, scheduling and planning, version control, LaTeX documents, and programming. About all my time is spent in either Emacs or Firefox.
share|improve this answer

Custom workflow specific modifications

When I started doing Test Driven Development, I made an elisp function that would let me jump between the file with the unit-tests and the file with the production code in an easy fashion.

I also started using yasnippets for a few key language constructs, reducing the time it takes me to write the thing I write hundreds of times every day.

Last, but not least; I created luddite-mode, it simply turns off the menu/tool bars, fringes and scrollbars, forcing me to use keyboard shortcuts as much as possible.

share|improve this answer

Two commands I tend to use every now and then are string-rectangle and kill-rectangle. The former allows you to insert repeated text in a particular column over several rows; the latter does the opposite.

share|improve this answer

I guess this is not the "lesser known" feature, but I tend to use Emacs for any repetitive text editing. Keyboard-macros rule!

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.