1
1
I love Emacs, but my customization powers are weak, and I would appreciate any help on this.
My default settings are to never use literal tab stops (indent-tabs-mode nil
). However, for one particular project I do need to use tab stops, and I need to display tabs with spacing 4 (not the default 8), and I want the tab-stop-list
to be 4, 8, 12, ....
Now the question: How can I define (in my ~/.emacs.d
) a single function that I can M-x
invoke from within any mode I might already be in so that these particular settings are overridden to those requirements? Alternatively, how can I make these settings a minor mode that I can activate optionally inside a given major mode (say some fictitious PHP-mode (which I haven't found yet))?
No no, I don't want this to happen by default - rather, I only want to enable this behaviour in very particular situations, so I'd like a command that I call in those situations and that only changes the local settings for that one buffer. – Kerrek SB – 2011-09-04T12:08:44.617
updated the answere – kindahero – 2011-09-04T12:27:19.610
Great, this is already working well in fundamental mode. But now, say, I finally do find a PHP mode which already defines everything, how can I make the command override the mode's settings? – Kerrek SB – 2011-09-04T12:38:25.677
doesn't it make local variables if you call the function in the buffer?? – kindahero – 2011-09-04T12:48:29.793
I just tested it in C++ mode, where it doesn't override the mode's indentation settings :-( – Kerrek SB – 2011-09-04T12:50:53.457
did you try using
M-i
which runs the commandtab-to-tab-stop
. check your variable values usingC-h v tab-width RET
in your cpp buffer – kindahero – 2011-09-04T13:00:46.950Well,
M-i
does advance, but it inserts spaces, while I expressly want tabs -- I did addindent-tabs-mode t
to your command, and it does work in fundamental mode, but it just gets overwritten by the C++ major mode, it seeems. – Kerrek SB – 2011-09-04T13:02:37.743Together with php-mode in "java" indentation style as a basis, this function implements my requirements on demand, perfect. Thank you!
– Kerrek SB – 2011-09-04T16:06:16.300