GNU bug report logs - #33247
makefile mode comment color

Previous Next

Package: emacs;

Reported by: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>

Date: Sat, 3 Nov 2018 03:41:02 UTC

Severity: minor

Merged with 9407, 24380

Full log


Message #10 received at 33247 <at> debbugs.gnu.org (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Cc: 33247 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#33247: makefile mode comment color
Date: 6 Nov 2018 09:47:21 -0000
Hello, Dan.

In article <mailman.3320.1541216477.1284.bug-gnu-emacs <at> gnu.org> you wrote:
> Makefile-mode should show comment color for both of
> xxx:# yyyy
> xxx: #zzzz
> not just the last.

Yes.  In make-mode.el, at line 525, there's a syntax-propertize-function
setting which decommentises a # unless the previous character was one of
|, &, ;, <, > (, ), `, \, ", ', <space>, <tab>, <newline>.  : is not in
that list.

The comment to this setting:

   ;; From sh-script.el.
   ;; A `#' begins a comment in sh when it is unquoted and at the beginning
   ;; of a word.  In the shell, words are separated by metacharacters.
   ;; The list of special chars is taken from the single-unix spec of the
   ;; shell command language (under `quoting') but with `$' removed.

confirms that the setting was taken over from shell-script-mode, and it
is essentially unchanged.

Why do we have this setting for makefiles at all?  Are there any such
restrictions on comments in Makefiles?  Stefan?

As a quick fix, please try the following (based off of master, though
it'll probably work on released versions, too):


diff --git a/lisp/progmodes/make-mode.el b/lisp/progmodes/make-mode.el
index f67407f48e..27da624086 100644
--- a/lisp/progmodes/make-mode.el
+++ b/lisp/progmodes/make-mode.el
@@ -522,7 +522,7 @@ makefile-syntax-propertize-function
    ;; of a word.  In the shell, words are separated by metacharacters.
    ;; The list of special chars is taken from the single-unix spec of the
    ;; shell command language (under `quoting') but with `$' removed.
-   ("[^|&;<>()`\\\"' \t\n]\\(#+\\)" (1 "_"))
+   ;; ("[^|&;<>()`\\\"' \t\n]\\(#+\\)" (1 "_"))
    ;; Change the syntax of a quoted newline so that it does not end a comment.
    ("\\\\\n" (0 "."))))
 


-- 
Alan Mackenzie (Nuremberg, Germany).





This bug report was last modified 6 years and 221 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.