Thoughts on Perl and Emacs, technology and writing

Interesting Emacs Links – 2009 Week 23

HowTo Disable indent-tabs-mode

It sounds like this guy is having problems with emacs automatically converting spaces to tabs. I can sympathise – it took me a while to figure out how to disable indent-tabs-mode correctly.

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.

“This guy” didn’t have any problems with setting up disable-indent-tabs-mode — I hook up a local function setting it with python-mode-hook. However, this setting is not completly reliable. Try hitting “C-q TAB”: you can insert a tab regardless of whether you have indent-tabs-mode set to nil or not (at least with a quite current XEmacs 21.5-b28.

I do set (set-indent-tabs-mode nil) in my .emacs for python-mode, however, I still occasionally somehow manage to insert some tabs in my source buffers.

(Emphasis mine). Which implies to me that you’re not quite sure how you entered the tabs. Presumably you didn’t do it by quoting them right? If your problem is that you deliberately enter error causing tabs using C-q then I recommend that you simply stop doing that.

Note that the snippet in your post doesn’t work in my emacs. Have you defined set-indent-tabs-mode?