[Mesa-dev] [PATCH] Fix automatic indentation mode for recent emacs, use fewer columns in .git

Carl Worth cworth at cworth.org
Thu Apr 2 14:38:53 PDT 2015


I recently noticed (after upgrading to emacs 24?) that I was no longer
getting automatic C-style settings in emacs like I was accustomed to
getting. That is, I was now getting a default indentation of 8 and
indentation with tabs instead of spaces.

It appears that the .dir-locals.el file is no longer taking
effect. Presumably, emacs was previously using "prog-mode" for C and
C++ source files but is now using a mode with some other name?

I didn't chase down the name of the current mode, but just using "nil"
makes these variables get set on all files, (which should be mostly
harmless), and should be compatible with both old and new emacs.

I did verify that the later change in this file (to indent with tabs
when in makefile-mode) still takes precendence as desired.

While editing these files, I've also set things up to use a smaller
value for fill-column when editing a file within the ".git"
directory. This will help avoid commit messages getting wrapped when
"git log" adds some extra indentation.

Note: If this change causes .dir-locals.el to take effect for someone
when it never had before, then emacs may prompt about the potentially
"unsafe" eval block here. User can reply to that prompt with "!" to
permanently whitelist this particular eval block as safe so that
prompt will not be seen again in the future.
---
 .dir-locals.el                                | 4 ++--
 src/gallium/drivers/freedreno/.dir-locals.el  | 2 +-
 src/gallium/drivers/r600/.dir-locals.el       | 2 +-
 src/gallium/drivers/radeon/.dir-locals.el     | 2 +-
 src/gallium/drivers/radeonsi/.dir-locals.el   | 2 +-
 src/gallium/drivers/vc4/.dir-locals.el        | 2 +-
 src/gallium/drivers/vc4/kernel/.dir-locals.el | 2 +-
 src/gallium/winsys/radeon/.dir-locals.el      | 2 +-
 src/mesa/drivers/dri/nouveau/.dir-locals.el   | 2 +-
 9 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/.dir-locals.el b/.dir-locals.el
index d95eb48..f44d964 100644
--- a/.dir-locals.el
+++ b/.dir-locals.el
@@ -1,12 +1,12 @@
-((prog-mode
+((nil
   (indent-tabs-mode . nil)
   (tab-width . 8)
   (c-basic-offset . 3)
   (c-file-style . "stroustrup")
-  (fill-column . 78)
   (eval . (progn
 	    (c-set-offset 'innamespace '0)
 	    (c-set-offset 'inline-open '0)))
   )
+ (".git" (nil (fill-column . 70)))
  (makefile-mode (indent-tabs-mode . t))
  )
diff --git a/src/gallium/drivers/freedreno/.dir-locals.el b/src/gallium/drivers/freedreno/.dir-locals.el
index aa20d49..c26578b 100644
--- a/src/gallium/drivers/freedreno/.dir-locals.el
+++ b/src/gallium/drivers/freedreno/.dir-locals.el
@@ -1,4 +1,4 @@
-((prog-mode
+((nil
   (indent-tabs-mode . true)
   (tab-width . 4)
   (c-basic-offset . 4)
diff --git a/src/gallium/drivers/r600/.dir-locals.el b/src/gallium/drivers/r600/.dir-locals.el
index 4e35c12..8be6a30 100644
--- a/src/gallium/drivers/r600/.dir-locals.el
+++ b/src/gallium/drivers/r600/.dir-locals.el
@@ -1,4 +1,4 @@
-((prog-mode
+((nil
   (indent-tabs-mode . true)
   (tab-width . 8)
   (c-basic-offset . 8)
diff --git a/src/gallium/drivers/radeon/.dir-locals.el b/src/gallium/drivers/radeon/.dir-locals.el
index 4e35c12..8be6a30 100644
--- a/src/gallium/drivers/radeon/.dir-locals.el
+++ b/src/gallium/drivers/radeon/.dir-locals.el
@@ -1,4 +1,4 @@
-((prog-mode
+((nil
   (indent-tabs-mode . true)
   (tab-width . 8)
   (c-basic-offset . 8)
diff --git a/src/gallium/drivers/radeonsi/.dir-locals.el b/src/gallium/drivers/radeonsi/.dir-locals.el
index 4e35c12..8be6a30 100644
--- a/src/gallium/drivers/radeonsi/.dir-locals.el
+++ b/src/gallium/drivers/radeonsi/.dir-locals.el
@@ -1,4 +1,4 @@
-((prog-mode
+((nil
   (indent-tabs-mode . true)
   (tab-width . 8)
   (c-basic-offset . 8)
diff --git a/src/gallium/drivers/vc4/.dir-locals.el b/src/gallium/drivers/vc4/.dir-locals.el
index ac94242..ed10dc2 100644
--- a/src/gallium/drivers/vc4/.dir-locals.el
+++ b/src/gallium/drivers/vc4/.dir-locals.el
@@ -1,4 +1,4 @@
-((prog-mode
+((nil
   (indent-tabs-mode . nil)
   (tab-width . 8)
   (c-basic-offset . 8)
diff --git a/src/gallium/drivers/vc4/kernel/.dir-locals.el b/src/gallium/drivers/vc4/kernel/.dir-locals.el
index 49403de..2e58e90 100644
--- a/src/gallium/drivers/vc4/kernel/.dir-locals.el
+++ b/src/gallium/drivers/vc4/kernel/.dir-locals.el
@@ -1,4 +1,4 @@
-((prog-mode
+((nil
   (indent-tabs-mode . t)
   (tab-width . 8)
   (c-basic-offset . 8)
diff --git a/src/gallium/winsys/radeon/.dir-locals.el b/src/gallium/winsys/radeon/.dir-locals.el
index d5f0f04..0e937bb 100644
--- a/src/gallium/winsys/radeon/.dir-locals.el
+++ b/src/gallium/winsys/radeon/.dir-locals.el
@@ -1,4 +1,4 @@
-((prog-mode
+((nil
   (indent-tabs-mode . nil)
   (tab-width . 8)
   (c-basic-offset . 4)
diff --git a/src/mesa/drivers/dri/nouveau/.dir-locals.el b/src/mesa/drivers/dri/nouveau/.dir-locals.el
index 774f023..29735e8 100644
--- a/src/mesa/drivers/dri/nouveau/.dir-locals.el
+++ b/src/mesa/drivers/dri/nouveau/.dir-locals.el
@@ -1,4 +1,4 @@
-((prog-mode
+((nil
   (indent-tabs-mode . true)
   (tab-width . 8)
   (c-basic-offset . 8)
-- 
2.1.4



More information about the mesa-dev mailing list