Emacs auto-modes and tabs
Jason Stephenson
jason at sigio.com
Thu Apr 17 01:50:21 EDT 2003
Kevin D. Clark wrote:
> Precisely speaking, what you want seems to be pretty difficult to
> accomplish, given that each mode tends to install their own
> keybindings. I can't think of a way to globally nuke all of these.
I was waiting for someone to mention this. The different mode scripts
usually install their own keybindings, and you can set certain variables
on a per-mode basis that tells the mode what to do with tabs and other
funny characters.
> My suggestion is to configure what you want via elisp hooks, 1 per
> mode that you want to use. For example:
>
> (setq c-mode-hook '(lambda () (interactive)
> (define-key c-mode-base-map "\t"
> '(lambda () (interactive) (insert-char (string-to-char "\t"))))))
>
> I'm still mulling over a better way to do this...
I can't think of one, either. You'd have to do the above for every major
(and possibly some minor) mode that you use. It's a pain, though you put
it in your .emacs file so you only have to do it once. If you're feeling
particularly bold, you could hack the elisp source files for the modes
on your system so that everything goes to tabs instead of spaces. They
seem to be under /usr/share/emacs on my RH 8.0 system.
This reminds me. I should get a more up-to-date edition of the Emacs
Lisp Programmer's manual and the Emacs manual, or at least read the GNU
Info versions again. My copies are over ten years' old, and some of the
stuff doesn't work exactly the same anymore. I know that some of the
macros that I had set up for C-mode stopped working somewhere around
version 20. (I'd like to know why (setq inhibit-default-init 1) stopped
working and why the names of c-mode hooks were changed.
> (not to start a flamewar or anything, but you do know that inserting
> real tabs in certain files (i.e. source code files) is frowned upon
> (by some people) right?)
Please, let's not get that started. I like spaces, other folks like
tabs. That's why I use Emacs. Switching from one to the other is a
keystroke away.
> Will hack Lisp for good beer,
>
> --kevin
Don't mention good beer, either. That could start another flame war. :-)
More information about the gnhlug-discuss
mailing list