All of lore.kernel.org
 help / color / mirror / Atom feed
* emacs indenting howto
@ 2009-01-19 12:56 Dan Carpenter
  2009-01-21  5:16 ` Andi Kleen
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2009-01-19 12:56 UTC (permalink / raw)
  To: linux-kernel; +Cc: hannes

I don't think emacs understands tilda expansion.  It didn't work for me.

regards,
dan carpenter

Signed-off-by: Dan Carpenter <error27@gmail.com>

--- orig/Documentation/CodingStyle	2009-01-16 17:46:16.000000000 +0300
+++ devel/Documentation/CodingStyle	2009-01-16 17:48:13.000000000 +0300
@@ -488,7 +488,7 @@
              (let ((filename (buffer-file-name)))
                ;; Enable kernel mode for the appropriate files
                (when (and filename
-                         (string-match "~/src/linux-trees" filename))
+                         (string-match "/path/to/linux-trees" filename))
                  (setq indent-tabs-mode t)
                  (c-set-style "linux")
                  (c-set-offset 'arglist-cont-nonempty

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: emacs indenting howto
  2009-01-19 12:56 emacs indenting howto Dan Carpenter
@ 2009-01-21  5:16 ` Andi Kleen
  2009-01-21  8:49   ` Dan Carpenter
  0 siblings, 1 reply; 4+ messages in thread
From: Andi Kleen @ 2009-01-21  5:16 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linux-kernel, hannes

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
-- 
ak@linux.intel.com -- Speaking for myself only.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: emacs indenting howto
  2009-01-21  5:16 ` Andi Kleen
@ 2009-01-21  8:49   ` Dan Carpenter
  2009-01-21  9:28     ` Andi Kleen
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2009-01-21  8:49 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Dan Carpenter, linux-kernel, hannes

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.

regards,
dan carpenter

Signed-off-by: Dan Carpenter <error27@gmail.com>

--- orig/Documentation/CodingStyle	2009-01-21 11:06:56.000000000 +0300
+++ devel/Documentation/CodingStyle	2009-01-21 11:01:35.000000000 +0300
@@ -488,7 +488,8 @@
              (let ((filename (buffer-file-name)))
                ;; Enable kernel mode for the appropriate files
                (when (and filename
-                         (string-match "~/src/linux-trees" filename))
+                         (string-match (expand-file-name "~/src/linux-trees")
+                              filename))
                  (setq indent-tabs-mode t)
                  (c-set-style "linux")
                  (c-set-offset 'arglist-cont-nonempty

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: emacs indenting howto
  2009-01-21  8:49   ` Dan Carpenter
@ 2009-01-21  9:28     ` Andi Kleen
  0 siblings, 0 replies; 4+ messages in thread
From: Andi Kleen @ 2009-01-21  9:28 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Andi Kleen, linux-kernel, hannes

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-01-21  9:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-19 12:56 emacs indenting howto Dan Carpenter
2009-01-21  5:16 ` Andi Kleen
2009-01-21  8:49   ` Dan Carpenter
2009-01-21  9:28     ` Andi Kleen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.