qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 1/2] .dir-locals.el: add makefiles to auto-mode


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH 1/2] .dir-locals.el: add makefiles to auto-mode
Date: Fri, 01 Sep 2017 11:29:40 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)

Marc-André Lureau <address@hidden> writes:

> QEMU uses non-conventional makefile filenames. Ease the life of emacs
> developpers a bit by appending to the auto-mode-alist.
>
> Signed-off-by: Marc-André Lureau <address@hidden>
> ---
>  .dir-locals.el      | 7 ++++++-
>  Makefile.target     | 2 --
>  trace/Makefile.objs | 2 --
>  3 files changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/.dir-locals.el b/.dir-locals.el
> index 3ac0cfc6f0..13ec483765 100644
> --- a/.dir-locals.el
> +++ b/.dir-locals.el
> @@ -1,2 +1,7 @@
>  ((c-mode . ((c-file-style . "stroustrup")
> -         (indent-tabs-mode . nil))))
> +            (indent-tabs-mode . nil)))
> + (nil . ((eval . (setq auto-mode-alist (append
> +                                        '(("Makefile.*" . 
> makefile-gmake-mode)
> +                                          ("\\.mak\\'" . 
> makefile-gmake-mode))
> +                                        auto-mode-alist))))
> +      ))

This makes Emacs ask for confirmation like this:

    The local variables list in /home/armbru/work/qemu/
    contains values that may not be safe (*).

    Do you want to apply it?  You can type
    y  -- to apply the local variables list.
    n  -- to ignore the local variables list.
    !  -- to apply the local variables list, and permanently mark these
          values (*) as safe (in the future, they will be set automatically.)

      * eval : (setq auto-mode-alist (append (quote (("Makefile.*" . 
makefile-gmake-mode) ("\\.mak\\'" . makefile-gmake-mode) ("\\.json\\'" . 
python-mode))) auto-mode-alist))

Not a nice user experience.  For detailed information why and how this
stuff works, see
https://www.gnu.org/software/emacs/manual/html_node/emacs/Safe-File-Variables.html

Why can't we simply use the usual file name extension like a normal
person?

If that's too much to ask, then I'd recommend adding modelines (like the
ones you delete) to the Makefiles that lack one.

> diff --git a/Makefile.target b/Makefile.target
> index 7f42c45db8..159602c83c 100644
> --- a/Makefile.target
> +++ b/Makefile.target
> @@ -1,5 +1,3 @@
> -# -*- Mode: makefile -*-
> -
>  BUILD_DIR?=$(CURDIR)/..
>  
>  include ../config-host.mak
> diff --git a/trace/Makefile.objs b/trace/Makefile.objs
> index afd571c3ec..d1f1e646e5 100644
> --- a/trace/Makefile.objs
> +++ b/trace/Makefile.objs
> @@ -1,5 +1,3 @@
> -# -*- mode: makefile -*-
> -
>  $(BUILD_DIR)/trace-events-all: $(trace-events-files)
>       $(call quiet-command,cat $^ > $@)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]