lkml.org 
[lkml]   [2008]   [Jul]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH -mm] documentation: update CodingStyle tips for Emacs users
Date
Hi,

Jonathan Corbet <corbet@lwn.net> writes:

> On Fri, 04 Jul 2008 19:52:16 +0200
> Johannes Weiner <hannes@saeurebad.de> wrote:
>
>> +(add-hook 'c-mode-hook
>> + (lambda ()
>> + (let ((filename (buffer-file-name)))
>> + ;; Enable kernel mode for the appropriate files
>> + (when (and file
>> + (string-match "/usr/src/linux" filename))
>
> Shouldn't that be "(and filename ..." rather than "file"?

Whoops, you are right.

> A test for /usr/src/linux seems misplaced, though; I don't think a
> whole lot of people keep their kernel trees there anymore. There must
> be a better heuristic one can use to figure out whether a kernel source
> file is being edited.

Is this really needed? I think most people have their kernel trees in
one directory and I used /usr/src/linux explicitely because it is so
well known and whoever reads this snippet knows what to substitute it
for.

But perhaps it should be "~/src/linux-trees/" to emphasize that it it
matches everything descendant from this directory.

A heuristics seems overkill as this snippet is not distributed code that
needs to be portable but it is just a tip for ones .emacs. I don't want
heuristics in my .emacs if I know exactly where my kernel trees are.

But then, we should remove the check for linux-files completely and make
people use this coding style for every code they write ;)

Hannes


\
 
 \ /
  Last update: 2008-07-05 13:41    [W:0.288 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site