mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andi Kleen <andi@firstfloor.org>
To: Dan Carpenter <error27@gmail.com>
Cc: Andi Kleen <andi@firstfloor.org>,
	linux-kernel@vger.kernel.org, hannes@saeurebad.de
Subject: Re: emacs indenting howto
Date: Wed, 21 Jan 2009 10:28:20 +0100	[thread overview]
Message-ID: <20090121092820.GF15750@one.firstfloor.org> (raw)
In-Reply-To: <alpine.DEB.2.00.0901211145370.4514@bikeee>

On Wed, Jan 21, 2009 at 11:49:29AM +0300, Dan Carpenter wrote:
> On Wed, 21 Jan 2009, Andi Kleen wrote:
> >Dan Carpenter <error27@gmail.com> writes:
> >
> >>I don't think emacs understands tilda expansion.  It didn't work for me.
> >
> >It does when you use expand-file-name
> >
> >-Andi
> 
> No problem.  Here is the updated patch.

FWIW this is what I use. It turns on linux-c-mode for anything with
linux in the path name. While that occasionally mis-hits, it only
does seldom.

(defvar is-emacs20 (if (string-match "2[0-9]\\." emacs-version) t nil))

(defun linux-c-mode ()
  "C mode with adjusted defaults for use with the Linux kernel."
  (interactive)
  ;; grr - still does not seem to work properly
  (make-variable-buffer-local 'tab-width)
  (make-variable-buffer-local 'c-basic-offset)
  (c-mode)
;  (if window-system
;         (change-mode 'passive))
  (make-variable-buffer-local 'version-control)
  (setq version-control 't)
  (c-set-style (if is-emacs20 "linux" "K&R")) 
  (setq tab-width 8)
  (setq c-basic-offset 8))

(push '(".*/linux.*/.*\\.[ch]\\'" . linux-c-mode) auto-mode-alist)
(push '(".*/linux.*/.*\\.[ch]\\(-[a-z]+\\)?\\'" . linux-c-mode) auto-mode-alist)

I also have that one but it's probably obsolete by now:

(defun reiserfs-c-mode () 
  "Hide silly ifdefs for reiserfs" 
  (interactive)
  (linux-c-mode) 
  (setq  hide-ifdef-initially t) 
  (hide-ifdef-mode 1)
  (hide-ifdef-define '__KERNEL__)
  (hide-ifdef-define 'REISERFS_PREALLOCATE) 
  (hide-ifdef-undef 'CONFIG_REISERFS_CHECK)
  (hide-ifdef-undef 'REISERFS_CHECK))

(push '(".*/linux.*/fs/reiserfs/[^/]+\\.[ch]\\'" . reiserfs-c-mode) auto-mode-alist)


-Andi


      reply	other threads:[~2009-01-21  9:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-19 12:56 Dan Carpenter
2009-01-21  5:16 ` Andi Kleen
2009-01-21  8:49   ` Dan Carpenter
2009-01-21  9:28     ` Andi Kleen [this message]

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=20090121092820.GF15750@one.firstfloor.org \
    --to=andi@firstfloor.org \
    --cc=error27@gmail.com \
    --cc=hannes@saeurebad.de \
    --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

Powered by JetHome