Thread (95 messages) flat view 95 messages, 33 authors, 2016-06-15

Re: On Tabs and Spaces

From: Lars Hjemli <hidden>
Date: 2016-06-15 22:43:41

On 10/16/07, Adam Piatyszek [off-list ref] wrote:
I am kindly asking for some tips on configuring
Emacs and Vim to follow the rules used for Git and kernel code
indentation/alignment.
From http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Documentation/CodingStyle;h=7f1730f1a1ae2e9a6f368bdb10ff65f4568863d5;hb=HEAD
(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))

--
larsh
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help