Thoughts on Perl and Emacs, technology and writing

Miscellaneous Emacs Tips From My Commenters

I really appreciate all of the comments that people leave on this blog. Occasionally, someone drops by and leaves an great comment with an incredibly useful tip.

shell-command and prefix argument

The first tip I’d like to highlight was at the end of a comment by Steve Vinoski. I didn’t realise how useful it would be when I first saw it but now I find it indispensable.

The tip was that using a prefix argument (i.e. pressing C-u before the command) before the synchronous shell calls inserts the output at point. Without the prefix, the output is (far less usefully) dumped in the mini-buffer.

One thing I use this for is for creating Makefiles where I need to pull in the list of headers and source files. I can now type C-u M-! ls *.H<RET>

HEADER_FILES=a.H \
b.H \
c.H \
... \

Filtering ido results

Another thing I didn’t know about was that it is possible to filter ido results. Thanks very much to Reynaldo for pointing this out.

I don’t use emacs -daemon so I’m not really familiar with the problem (see here for what I use). Having said that, perhaps adding a function to find-file-hook that sets the current directory might be what you want, or are you looking for a more complete solution?