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

Re: On Tabs and Spaces

From: Adam Piatyszek <hidden>
Date: 2016-06-15 22:43:41

* Lars Hjemli [16 X 2007 11:04]:
quoted
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))
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   .:.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help