HowTo Disable indent-tabs-mode
My post also received a comment asking how to add a tabs if you have disabled indent-tabs-mode. If you need a single tab, use
C-q <TAB> (quoted-insert). Otherwise, if you need to enter many tabs you can enable
M-x eval-expression <RET>(setq indent-tabs-mode t)<RET> or bind tab to (self-insert-command).
Working With Multiple Databases
To much wailing and nashing of teeth, several weeks ago I introduced my emacs db mode. I have made an extension for quickly and easily switching between multiple databases using ido. It also serves as a nice tutorial for adding custom sections to the mode-line.
Always Prompting Before Exiting Emacs
Nilesh has a post about prompting before exiting to avoid accidents. Now, I occasionally want a prompt – I often get a prompt anyway as I have either processes or unsaved buffers. Occasionally I am caught out when I am sketching things out in scratch buffers (with, e.g.
C-x b *stuff* <RET>).
Most functions that are called when emacs is exiting call
(save-buffers-kill-emacs) which has a customizable variable you can set to control if and how emacs prompts when exiting. I like to timeout these type of prompts, just in case I was attempting to exit while the screen was off.
(setq confirm-kill-emacs (lambda (e) (y-or-n-p-with-timeout "Really exit Emacs (automatically exits in 5 secs)? " 5 t)))
Emacs As A Windows Editor?
There was a strange thread in the Joel On Software forums. Someone wanted an alternative to Emacs on Windows with the following features:
- good windows integration
- syntax highlighting for multiple file types
- free as in beer
Why strange? Well, emacs has all of this and more. Keyboard macros are available with
C-x ( and
C-x ) or
<f4> in more modern versions. In addition, Emacs 23 is extremely good-looking.
Setting cua-mode and recentf will get you most of the way to that authentic windows app experience.
(cua-mode t) (recentf-mode t)
Remember to use the Emacs Win32 build.
Here is a mention of the fantastic occur command.
Someone made a brief post (http://rydow.wordpress.com/2009/06/11/emacs-history-between-sessions) about savehist-mode although they couldn’t remember where they had seen the original. Along with many great Emacs hints, it was from Emacs-fu (it was in a comment by valvo).