Re: On Tabs and Spaces
From: Adam Piatyszek <hidden>
Date: 2016-06-15 22:43:41
* Lars Hjemli [16 X 2007 11:04]:
(defun linux-c-mode ()
"C mode with adjusted defaults for use with the Linux kernel."
(interactive)
(c-mode)
(c-set-style "K&R")
(setq tab-width 8)
(setq indent-tabs-mode t)
(setq c-basic-offset 8))
And to use this only in a specific directory:
(setq auto-mode-alist (cons '("/usr/src/linux.*/.*\\.[ch]$" . linux-c-mode)
auto-mode-alist))
Thanks!
But it seems that the above settings are still imperfect, since they
mixes tabs and spaces when aligning. For instance:
int some_function(int some_variable)
{
<T> int result;
<T> result = execute_another_function(some_variable,
<T> <T> <T> <T> <T> ..other_variable);
<T> return result;
}
<T> - represents tab here, `.' - space
And if one change the tab size, it will result in a messy alignment in
line 5.
I guess there is no ideal solution for this in Emacs.
BR,
/Adam
--
.:. Adam Piatyszek - "ediap" .:. JID: ediap(at)jabber.org .:.
.:. ediap(at)users.sourceforge.net .:. PGP key ID: 0x1F115CCB .:.