From: Johannes Weiner <hannes@saeurebad.de>
To: Jonathan Corbet <corbet@lwn.net>
Cc: Andrew Morton <akpm@linux-foundation.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH -mm] documentation: update CodingStyle tips for Emacs users
Date: Sat, 05 Jul 2008 11:36:44 +0000 [thread overview]
Message-ID: <878wwg4l6b.fsf@saeurebad.de> (raw)
In-Reply-To: <20080704134159.4dd9f74e@bike.lwn.net> (Jonathan Corbet's message of "Fri, 4 Jul 2008 13:41:59 -0600")
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
next prev parent reply other threads:[~2008-07-05 11:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-04 17:52 [PATCH -mm] documentation: update CodingStyle tips for Emacs users Johannes Weiner
2008-07-04 19:41 ` Jonathan Corbet
2008-07-05 11:36 ` Johannes Weiner [this message]
2008-07-05 14:32 ` Jonathan Corbet
2008-07-05 18:33 ` [PATCH -mm] documentation: update CodingStyle tips for Emacs users v2 Johannes Weiner
2009-02-18 9:19 ` [PATCH -mm] documentation: update CodingStyle tips for Emacs users Patrick Ohly
2009-02-18 9:59 ` Johannes Weiner
2009-02-18 10:23 ` Patrick Ohly
2009-02-18 17:28 ` Johannes Weiner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=878wwg4l6b.fsf@saeurebad.de \
--to=hannes@saeurebad.de \
--cc=akpm@linux-foundation.org \
--cc=corbet@lwn.net \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox