[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Libguestfs] [PATCH libguestfs] doc: improve emacs snippets



Jim Meyering wrote:

> I've made some local commits that introduce TABs as indentation,
> and thus provoke a "make syntax-check" failure.
>
> This would have prevented it:
>
>>From 4740b66adc5985d9a72a7648aa60c5389ffc31af Mon Sep 17 00:00:00 2001
> From: Jim Meyering <meyering redhat com>
> Date: Tue, 11 Aug 2009 09:53:16 +0200
> Subject: [PATCH libguestfs] doc: improve emacs snippets

How ironic.
That very patch introduced leading TABs ;-)
This one doesn't:

>From a891dcc2e2fa47d751d5be7c44ca3c34201af054 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering redhat com>
Date: Tue, 11 Aug 2009 09:53:16 +0200
Subject: [PATCH libguestfs] doc: improve emacs snippets

* HACKING: Make (setq indent-tabs-mode nil) apply to nearly all
files, not just C-mode ones.
---
 HACKING |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/HACKING b/HACKING
index cb339bd..3746ffd 100644
--- a/HACKING
+++ b/HACKING
@@ -35,16 +35,24 @@ indentation level, and other than that, follow the K&R style.
 If you use Emacs, add the following to one of one of your start-up files
 (e.g., ~/.emacs), to help ensure that you get indentation right:

+  ;;; In libguestfs, indent with spaces everywhere (not TABs).
+  ;;; Exceptions: Makefile and ChangeLog modes.
+  (add-hook 'find-file-hook
+      '(lambda () (if (and buffer-file-name
+                           (string-match "/libguestfs\\>" (buffer-file-name))
+                           (not (string-equal mode-name "Change Log"))
+                           (not (string-equal mode-name "Makefile")))
+                      (setq indent-tabs-mode nil))))
+
   ;;; When editing C sources in libguestfs, use this style.
   (defun libguestfs-c-mode ()
     "C mode with adjusted defaults for use with libguestfs."
     (interactive)
     (c-set-style "K&R")
-    (setq indent-tabs-mode nil) ; indent using spaces, not TABs
     (setq c-indent-level 2)
     (setq c-basic-offset 2))
   (add-hook 'c-mode-hook
-            '(lambda () (if (string-match "/libguestfs" (buffer-file-name))
+            '(lambda () (if (string-match "/libguestfs\\>" (buffer-file-name))
                             (libguestfs-c-mode))))

 Directories
-- 
1.6.4.337.g5420e


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]