all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#33247: makefile mode comment color
@ 2018-11-03  3:39 積丹尼 Dan Jacobson
       [not found] ` <mailman.3320.1541216477.1284.bug-gnu-emacs@gnu.org>
  2018-11-06 10:01 ` 積丹尼 Dan Jacobson
  0 siblings, 2 replies; 4+ messages in thread
From: 積丹尼 Dan Jacobson @ 2018-11-03  3:39 UTC (permalink / raw)
  To: 33247

Makefile-mode should show comment color for both of
xxx:# yyyy
xxx: #zzzz
not just the last.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#33247: makefile mode comment color
       [not found] ` <mailman.3320.1541216477.1284.bug-gnu-emacs@gnu.org>
@ 2018-11-06  9:47   ` Alan Mackenzie
  2018-11-06 13:25     ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Alan Mackenzie @ 2018-11-06  9:47 UTC (permalink / raw)
  To: 積丹尼 Dan Jacobson; +Cc: 33247, Stefan Monnier

Hello, Dan.

In article <mailman.3320.1541216477.1284.bug-gnu-emacs@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).






^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#33247: makefile mode comment color
  2018-11-03  3:39 bug#33247: makefile mode comment color 積丹尼 Dan Jacobson
       [not found] ` <mailman.3320.1541216477.1284.bug-gnu-emacs@gnu.org>
@ 2018-11-06 10:01 ` 積丹尼 Dan Jacobson
  1 sibling, 0 replies; 4+ messages in thread
From: 積丹尼 Dan Jacobson @ 2018-11-06 10:01 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: 33247, Stefan Monnier

Glad you found the bug.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#33247: makefile mode comment color
  2018-11-06  9:47   ` Alan Mackenzie
@ 2018-11-06 13:25     ` Stefan Monnier
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2018-11-06 13:25 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: 33247, 積丹尼 Dan Jacobson

> Why do we have this setting for makefiles at all?

That's to handle the /bin/sh comments on the command lines of rules,
where the code is run by /bin/sh and hence obeys the corresponding
rules.  E.g.

   foo.o: foo.c
   	echo This is#not a comment
   	$(CC) $(CFLAGS) -o $@ $<  #This is an sh comment

> Are there any such
> restrictions on comments in Makefiles?  Stefan?

Maybe we should conditionalize on the presence of a leading TAB at the
beginning of the line.

BTW, I recently saw that the above is wrong in cases like

   foo.o: foo.c
   	@#An sh comment not recognized by current makefile mode
   	$(CC) $(CFLAGS) -o $@ $<  #This is a comment

so if you can fix both of those while you're there, that'd be great!


-- Stefan





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-11-06 13:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-03  3:39 bug#33247: makefile mode comment color 積丹尼 Dan Jacobson
     [not found] ` <mailman.3320.1541216477.1284.bug-gnu-emacs@gnu.org>
2018-11-06  9:47   ` Alan Mackenzie
2018-11-06 13:25     ` Stefan Monnier
2018-11-06 10:01 ` 積丹尼 Dan Jacobson

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.