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

Neil Roberts neil at linux.intel.com
Wed Apr 8 05:21:34 PDT 2015


It seems a bit strange that this has stopped working for you. If you
specify a mode in the .dir-locals.el file then it's supposed to set the
variable for any files with that mode or any modes inherited from that
mode. The C and C++ modes both inherit from prog-mode, as well as a
bunch of other ones such as Python and lisp files. If you are using a
non-standard mode for C files it would be surprising if it doesn't also
inherit from prog-mode. I have just tested this with emacs -q (to
prevent it from loading my personal config) on Emacs 24.3.1 and it does
work as is.

I don't think the patch would break anything for me since you explicitly
set the fill-column back to 70 for commit messages so I don't care
enough to complain if you want to commit it anyway, but it does seem
like something fishy is going on and the reasoning in the commit message
doesn't add up.

Regards,
- Neil

Carl Worth <cworth at cworth.org> writes:

> 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
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list