Emacs-fu Emacs Tips
Emacs-fu started a great post requesting little tricks. I gave my own response, covering cut-and-paste, ido mode, uniquify and tidy backups. Da Zhang has a nice summary of some of the other tips.
Using/Extending Core Libraries
There are a few emacs libraries that store current state in global variables. For example, ido stores the list of current matches in
ido-matches. Accessing this variable while filtering using ido can be a little convoluted. I gave an example of how to do this in Shell Command on Multiple Buffers.
Dabbrev also uses global variables although it provides [internal] functions for completing an abbreviation. I have a complete example at Autocomplete with a Dabbrev Twist but the core is very simple:
(let ((dabbrev-check-all-buffers t)) (dabbrev--reset-global-variables) (dabbrev--find-all-expansions <abbreviation> t))
I really liked this post from Ian Eure demonstrating how to do multi-file search and replace in emacs. I frequently see emacs proponents saying its awesome and you’ll know when you reach emacs nirvana so it is nice to see a practical demonstration of emacs power. And of course I know it is possible in shell but the simplicity and the interactive nature of emacs makes this a much more pleasant experience. A quick summary:
M-x find-grep-dired RET <pattern>(put matching files in dired buffer)
m .php$ RET(mark all php files)
Q <pattern> RET <replace string>(run query-replace on marked files)
C-x s(save all modified files)
So first of all I found this post referring to a thread where a guy says he recommends nano as he has used Unix-like systems that don’t have vi. Hmmm… okay, and then that post has this one from 2007 in the auto-generated links list about Emacs losing in popularity.
And from there I get to this one which has a poll where 56% of the almost 750 respondants chose vim1 as their favourite Linux text editor compared to 9% choosing emacs. Of course it is a highly unscientific result, but do you think more than 6 times as many people use vim as emacs?
1. Fair enough – it is a fine editor