Re: [PATCH] Update emacs indentation instructions.

From: Johannes Weiner
Date: Sat Jan 19 2008 - 20:39:53 EST


Hi,

David Brown <lkml@xxxxxxxxxx> writes:

> +Fortunately, modern versions of GNU emacs support different indentation
> +styles. If you want to use the Linux kernel style for all C code, place
> +the following in your .emacs file:
> +
> +(setq c-default-style "linux")

This variable is not defined when emacs starts up. Best is to always
use a hook.

So I'd suggest either

(add-hook 'c-mode-hook (lambda () (c-set-style "linux")))

or for the conditional case

(add-hook 'c-mode-hook
(lambda ()
(c-set-style
(or (and (string-match "/usr/src/linux"
(or (buffer-file-name) ""))
"linux")
"free-group-style"))))

Perhaps the logic could be a bit more readable :-)

Other than that, good idea to finally remove this ugly recommendation!

Hannes
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/