aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/make-mode.el
diff options
context:
space:
mode:
authorKaroly Lorentey2005-06-15 12:57:51 +0000
committerKaroly Lorentey2005-06-15 12:57:51 +0000
commitef85512e51f043d73788f00a2aed13cccde0682c (patch)
treefc1fa1378533250f260ef8eaa9a84ae882d9df84 /lisp/progmodes/make-mode.el
parent8736257554f49445f7b4402ac7a9436b38ce6452 (diff)
parentef88a9999004e6c26148c8d280d6a41f623d7249 (diff)
downloademacs-ef85512e51f043d73788f00a2aed13cccde0682c.tar.gz
emacs-ef85512e51f043d73788f00a2aed13cccde0682c.zip
Merged from miles@gnu.org--gnu-2005 (patch 80-82, 350-422)
Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-350 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-351 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-352 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-353 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-354 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-355 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-356 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-357 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-358 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-359 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-360 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-361 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-362 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-363 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-364 Remove "-face" suffix from widget faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365 Remove "-face" suffix from custom faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366 Remove "-face" suffix from change-log faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-367 Remove "-face" suffix from compilation faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-368 Remove "-face" suffix from diff-mode faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-369 lisp/longlines.el (longlines-visible-face): Face removed * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-370 Remove "-face" suffix from woman faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-371 Remove "-face" suffix from whitespace-highlight face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372 Remove "-face" suffix from ruler-mode faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-373 Remove "-face" suffix from show-paren faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-374 Remove "-face" suffix from log-view faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-375 Remove "-face" suffix from smerge faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-376 Remove "-face" suffix from show-tabs faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-377 Remove "-face" suffix from highlight-changes faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-378 Remove "-face" suffix from and downcase info faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-379 Remove "-face" suffix from pcvs faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-380 Update uses of renamed pcvs faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-381 Tweak ChangeLog * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-382 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-383 Remove "-face" suffix from strokes-char face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-384 Remove "-face" suffix from compare-windows face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-385 Remove "-face" suffix from calendar faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-386 Remove "-face" suffix from diary-button face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-387 Remove "-face" suffix from testcover faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-388 Remove "-face" suffix from viper faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389 Remove "-face" suffix from org faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-390 Remove "-face" suffix from sgml-namespace face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-391 Remove "-face" suffix from table-cell face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-392 Remove "-face" suffix from tex-mode faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-393 Remove "-face" suffix from texinfo-heading face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-394 Remove "-face" suffix from flyspell faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-395 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-396 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-397 Remove "-face" suffix from gomoku faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-398 Remove "-face" suffix from mpuz faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-399 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-400 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-401 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-402 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-403 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-404 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-405 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-406 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-407 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-408 Remove "-face" suffix from Buffer-menu-buffer face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-409 Remove "-face" suffix from antlr-mode faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-410 Remove "-face" suffix from ebrowse faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-411 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-412 Remove "-face" suffix from flymake faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-413 Remove "-face" suffix from idlwave faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-414 Remove "-face" suffix from sh-script faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-415 Remove "-face" suffix from vhdl-mode faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-416 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-417 Remove "-face" suffix from which-func face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-418 Remove "-face" suffix from cperl-mode faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-419 Remove "-face" suffix from ld-script faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-420 Fix cperl-mode font-lock problem * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-421 Tweak which-func face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-422 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-80 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-81 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-82 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-350
Diffstat (limited to 'lisp/progmodes/make-mode.el')
-rw-r--r--lisp/progmodes/make-mode.el118
1 files changed, 75 insertions, 43 deletions
diff --git a/lisp/progmodes/make-mode.el b/lisp/progmodes/make-mode.el
index 055cdf7fc7d..d9c38349b49 100644
--- a/lisp/progmodes/make-mode.el
+++ b/lisp/progmodes/make-mode.el
@@ -99,35 +99,38 @@
99 :group 'tools 99 :group 'tools
100 :prefix "makefile-") 100 :prefix "makefile-")
101 101
102(defface makefile-space-face 102(defface makefile-space
103 '((((class color)) (:background "hotpink")) 103 '((((class color)) (:background "hotpink"))
104 (t (:reverse-video t))) 104 (t (:reverse-video t)))
105 "Face to use for highlighting leading spaces in Font-Lock mode." 105 "Face to use for highlighting leading spaces in Font-Lock mode."
106 :group 'faces 106 :group 'faces
107 :group 'makefile) 107 :group 'makefile)
108 108
109(defface makefile-targets-face 109(defface makefile-targets
110 ;; This needs to go along both with foreground and background colors (i.e. shell) 110 ;; This needs to go along both with foreground and background colors (i.e. shell)
111 '((t (:underline t))) 111 '((t (:inherit font-lock-function-name-face)))
112 "Face to use for additionally highlighting rule targets in Font-Lock mode." 112 "Face to use for additionally highlighting rule targets in Font-Lock mode."
113 :group 'faces 113 :group 'faces
114 :group 'makefile) 114 :group 'makefile
115 :version "22.1")
115 116
116(defface makefile-shell-face 117(defface makefile-shell
117 '((((class color) (background light)) (:background "seashell1")) 118 ()
118 (((class color) (background dark)) (:background "seashell4")) 119 ;;'((((class color) (min-colors 88) (background light)) (:background "seashell1"))
119 (t (:reverse-video t))) 120 ;; (((class color) (min-colors 88) (background dark)) (:background "seashell4")))
120 "Face to use for additionally highlighting Shell commands in Font-Lock mode." 121 "Face to use for additionally highlighting Shell commands in Font-Lock mode."
121 :group 'faces 122 :group 'faces
122 :group 'makefile) 123 :group 'makefile
124 :version "22.1")
123 125
124(defface makefile-makepp-perl-face 126(defface makefile-makepp-perl
125 '((((class color) (background light)) (:background "LightBlue1")) ; Camel Book 127 '((((class color) (background light)) (:background "LightBlue1")) ; Camel Book
126 (((class color) (background dark)) (:background "DarkBlue")) 128 (((class color) (background dark)) (:background "DarkBlue"))
127 (t (:reverse-video t))) 129 (t (:reverse-video t)))
128 "Face to use for additionally highlighting Perl code in Font-Lock mode." 130 "Face to use for additionally highlighting Perl code in Font-Lock mode."
129 :group 'faces 131 :group 'faces
130 :group 'makefile) 132 :group 'makefile
133 :version "22.1")
131 134
132(defcustom makefile-browser-buffer-name "*Macros and Targets*" 135(defcustom makefile-browser-buffer-name "*Macros and Targets*"
133 "*Name of the macro- and target browser buffer." 136 "*Name of the macro- and target browser buffer."
@@ -259,9 +262,14 @@ not be enclosed in { } or ( )."
259;; index in makefile-imenu-generic-expression. 262;; index in makefile-imenu-generic-expression.
260(defvar makefile-dependency-regex 263(defvar makefile-dependency-regex
261 ;; Allow for two nested levels $(v1:$(v2:$(v3:a=b)=c)=d) 264 ;; Allow for two nested levels $(v1:$(v2:$(v3:a=b)=c)=d)
262 "^ *\\(\\(?: *\\$\\(?:[({]\\(?:\\$\\(?:[({]\\(?:\\$\\(?:[^({]\\|.[^\n$#})]+?[})]\\)\\|[^\n$#)}]\\)+?[})]\\|[^({]\\)\\|[^\n$#)}]\\)+?[})]\\|[^({]\\)\\| *[^ \n$#:=]+\\)+?\\)[ \t]*\\(:\\)\\(?:[ \t]*$\\|[^=\n]\\(?:[^#\n]*?;[ \t]*\\(.+\\)\\)?\\)" 265 "^\\(\\(?:\\$\\(?:[({]\\(?:\\$\\(?:[({]\\(?:\\$\\(?:[^({]\\|.[^\n$#})]+?[})]\\)\\|[^\n$#)}]\\)+?[})]\\|[^({]\\)\\|[^\n$#)}]\\)+?[})]\\|[^({]\\)\\|[^\n$#:=]\\)+?\\)\\(:\\)\\(?:[ \t]*$\\|[^=\n]\\(?:[^#\n]*?;[ \t]*\\(.+\\)\\)?\\)"
263 "Regex used to find dependency lines in a makefile.") 266 "Regex used to find dependency lines in a makefile.")
264 267
268(defconst makefile-bsdmake-dependency-regex
269 (progn (string-match (regexp-quote "\\(:\\)") makefile-dependency-regex)
270 (replace-match "\\([:!]\\)" t t makefile-dependency-regex))
271 "Regex used to find dependency lines in a BSD makefile.")
272
265(defvar makefile-dependency-skip "^:" 273(defvar makefile-dependency-skip "^:"
266 "Characters to skip to find a line that might be a dependency.") 274 "Characters to skip to find a line that might be a dependency.")
267 275
@@ -269,11 +277,21 @@ not be enclosed in { } or ( )."
269 "^\t[ \t]*\\([-@]*\\)[ \t]*\\(\\(?:.*\\\\\n\\)*.*\\)" 277 "^\t[ \t]*\\([-@]*\\)[ \t]*\\(\\(?:.*\\\\\n\\)*.*\\)"
270 "Regex used to highlight rule action lines in font lock mode.") 278 "Regex used to highlight rule action lines in font lock mode.")
271 279
280(defconst makefile-makepp-rule-action-regex
281 ;; Don't care about initial tab, but I don't know how to font-lock correctly without.
282 "^\t[ \t]*\\(\\(?:\\(?:noecho\\|ignore[-_]error\\|[-@]+\\)[ \t]*\\)*\\)\\(\\(&\\S +\\)?\\(?:.*\\\\\n\\)*.*\\)"
283 "Regex used to highlight makepp rule action lines in font lock mode.")
284
285(defconst makefile-bsdmake-rule-action-regex
286 (progn (string-match "-@" makefile-rule-action-regex)
287 (replace-match "-+@" t t makefile-rule-action-regex))
288 "Regex used to highlight BSD rule action lines in font lock mode.")
289
272;; Note that the first and second subexpression is used by font lock. Note 290;; Note that the first and second subexpression is used by font lock. Note
273;; that if you change this regexp you might have to fix the imenu index in 291;; that if you change this regexp you might have to fix the imenu index in
274;; makefile-imenu-generic-expression. 292;; makefile-imenu-generic-expression.
275(defconst makefile-macroassign-regex 293(defconst makefile-macroassign-regex
276 "^ *\\([^ \n\t][^:#= \t\n]*\\)[ \t]*\\(?:!=[ \t]*\\(\\(?:.+\\\\\n\\)*.+\\)\\|[*:+]?[:?]?=[ \t]*\\(\\(?:.*\\\\\n\\)*.*\\)\\)" 294 "^ *\\([^ \n\t][^:#= \t\n]*\\)[ \t]*\\(?:!=\\|[*:+]?[:?]?=\\)"
277 "Regex used to find macro assignment lines in a makefile.") 295 "Regex used to find macro assignment lines in a makefile.")
278 296
279(defconst makefile-var-use-regex 297(defconst makefile-var-use-regex
@@ -285,8 +303,8 @@ not be enclosed in { } or ( )."
285 "Regex for filenames that will NOT be included in the target list.") 303 "Regex for filenames that will NOT be included in the target list.")
286 304
287(if (fboundp 'facemenu-unlisted-faces) 305(if (fboundp 'facemenu-unlisted-faces)
288 (add-to-list 'facemenu-unlisted-faces 'makefile-space-face)) 306 (add-to-list 'facemenu-unlisted-faces 'makefile-space))
289(defvar makefile-space-face 'makefile-space-face 307(defvar makefile-space 'makefile-space
290 "Face to use for highlighting leading spaces in Font-Lock mode.") 308 "Face to use for highlighting leading spaces in Font-Lock mode.")
291 309
292;; These lists were inspired by the old solution. But they are silly, because 310;; These lists were inspired by the old solution. But they are silly, because
@@ -331,14 +349,14 @@ not be enclosed in { } or ( )."
331 (,makefile-macroassign-regex 349 (,makefile-macroassign-regex
332 (1 font-lock-variable-name-face) 350 (1 font-lock-variable-name-face)
333 ;; This is for after != 351 ;; This is for after !=
334 (2 'makefile-shell-face prepend t) 352 (2 'makefile-shell prepend t)
335 ;; This is for after normal assignment 353 ;; This is for after normal assignment
336 (3 'font-lock-string-face prepend t)) 354 (3 'font-lock-string-face prepend t))
337 355
338 ;; Rule actions. 356 ;; Rule actions.
339 (makefile-match-action 357 (makefile-match-action
340 (1 font-lock-type-face) 358 (1 font-lock-type-face)
341 (2 'makefile-shell-face prepend) 359 (2 'makefile-shell prepend)
342 ;; Only makepp has builtin commands. 360 ;; Only makepp has builtin commands.
343 (3 font-lock-builtin-face prepend t)) 361 (3 font-lock-builtin-face prepend t))
344 362
@@ -350,7 +368,7 @@ not be enclosed in { } or ( )."
350 ("[^$]\\$\\([@%<?^+*_]\\|[a-zA-Z0-9]\\>\\)" 368 ("[^$]\\$\\([@%<?^+*_]\\|[a-zA-Z0-9]\\>\\)"
351 1 font-lock-constant-face prepend) 369 1 font-lock-constant-face prepend)
352 ("[^$]\\(\\$[@%*]\\)" 370 ("[^$]\\(\\$[@%*]\\)"
353 1 'makefile-targets-face prepend) 371 1 'makefile-targets append)
354 372
355 ;; Fontify conditionals and includes. 373 ;; Fontify conditionals and includes.
356 (,(concat "^\\(?: [ \t]*\\)?" 374 (,(concat "^\\(?: [ \t]*\\)?"
@@ -365,22 +383,22 @@ not be enclosed in { } or ( )."
365 ,@(if space 383 ,@(if space
366 '(;; Highlight lines that contain just whitespace. 384 '(;; Highlight lines that contain just whitespace.
367 ;; They can cause trouble, especially if they start with a tab. 385 ;; They can cause trouble, especially if they start with a tab.
368 ("^[ \t]+$" . makefile-space-face) 386 ("^[ \t]+$" . makefile-space)
369 387
370 ;; Highlight shell comments that Make treats as commands, 388 ;; Highlight shell comments that Make treats as commands,
371 ;; since these can fool people. 389 ;; since these can fool people.
372 ("^\t+#" 0 makefile-space-face t) 390 ("^\t+#" 0 makefile-space t)
373 391
374 ;; Highlight spaces that precede tabs. 392 ;; Highlight spaces that precede tabs.
375 ;; They can make a tab fail to be effective. 393 ;; They can make a tab fail to be effective.
376 ("^\\( +\\)\t" 1 makefile-space-face))) 394 ("^\\( +\\)\t" 1 makefile-space)))
377 395
378 ,@font-lock-keywords 396 ,@font-lock-keywords
379 397
380 ;; Do dependencies. 398 ;; Do dependencies.
381 (makefile-match-dependency 399 (makefile-match-dependency
382 (1 'makefile-targets-face prepend) 400 (1 'makefile-targets prepend)
383 (3 'makefile-shell-face prepend t)))) 401 (3 'makefile-shell prepend t))))
384 402
385(defconst makefile-font-lock-keywords 403(defconst makefile-font-lock-keywords
386 (makefile-make-font-lock-keywords 404 (makefile-make-font-lock-keywords
@@ -402,7 +420,7 @@ not be enclosed in { } or ( )."
402 "^\\(?: [ \t]*\\)?if\\(n\\)\\(?:def\\|eq\\)\\>" 420 "^\\(?: [ \t]*\\)?if\\(n\\)\\(?:def\\|eq\\)\\>"
403 421
404 '("[^$]\\(\\$[({][@%*][DF][})]\\)" 422 '("[^$]\\(\\$[({][@%*][DF][})]\\)"
405 1 'makefile-targets-face prepend) 423 1 'makefile-targets append)
406 424
407 ;; $(function ...) ${function ...} 425 ;; $(function ...) ${function ...}
408 '("[^$]\\$[({]\\([-a-zA-Z0-9_.]+\\s \\)" 426 '("[^$]\\$[({]\\([-a-zA-Z0-9_.]+\\s \\)"
@@ -411,7 +429,7 @@ not be enclosed in { } or ( )."
411 ;; $(shell ...) ${shell ...} 429 ;; $(shell ...) ${shell ...}
412 '("[^$]\\$\\([({]\\)shell[ \t]+" 430 '("[^$]\\$\\([({]\\)shell[ \t]+"
413 makefile-match-function-end nil nil 431 makefile-match-function-end nil nil
414 (1 'makefile-shell-face prepend t)))) 432 (1 'makefile-shell prepend t))))
415 433
416(defconst makefile-makepp-font-lock-keywords 434(defconst makefile-makepp-font-lock-keywords
417 (makefile-make-font-lock-keywords 435 (makefile-make-font-lock-keywords
@@ -421,7 +439,7 @@ not be enclosed in { } or ( )."
421 "^\\(?: [ \t]*\\)?\\(?:and[ \t]+\\|else[ \t]+\\|or[ \t]+\\)?if\\(n\\)\\(?:def\\|eq\\|sys\\)\\>" 439 "^\\(?: [ \t]*\\)?\\(?:and[ \t]+\\|else[ \t]+\\|or[ \t]+\\)?if\\(n\\)\\(?:def\\|eq\\|sys\\)\\>"
422 440
423 '("[^$]\\(\\$[({]\\(?:output\\|stem\\|target\\)s?\\_>.*?[})]\\)" 441 '("[^$]\\(\\$[({]\\(?:output\\|stem\\|target\\)s?\\_>.*?[})]\\)"
424 1 'makefile-targets-face prepend) 442 1 'makefile-targets append)
425 443
426 ;; Colon modifier keywords. 444 ;; Colon modifier keywords.
427 '("\\(:\\s *\\)\\(build_c\\(?:ache\\|heck\\)\\|env\\(?:ironment\\)?\\|foreach\\|signature\\|scanner\\|quickscan\\|smartscan\\)\\>\\([^:\n]*\\)" 445 '("\\(:\\s *\\)\\(build_c\\(?:ache\\|heck\\)\\|env\\(?:ironment\\)?\\|foreach\\|signature\\|scanner\\|quickscan\\|smartscan\\)\\>\\([^:\n]*\\)"
@@ -436,32 +454,32 @@ not be enclosed in { } or ( )."
436 ;; $(shell ...) $((shell ...)) ${shell ...} ${{shell ...}} 454 ;; $(shell ...) $((shell ...)) ${shell ...} ${{shell ...}}
437 '("[^$]\\$\\(((?\\|{{?\\)shell\\(?:[-_]\\(?:global[-_]\\)?once\\)?[ \t]+" 455 '("[^$]\\$\\(((?\\|{{?\\)shell\\(?:[-_]\\(?:global[-_]\\)?once\\)?[ \t]+"
438 makefile-match-function-end nil nil 456 makefile-match-function-end nil nil
439 (1 'makefile-shell-face prepend t)) 457 (1 'makefile-shell prepend t))
440 458
441 ;; $(perl ...) $((perl ...)) ${perl ...} ${{perl ...}} 459 ;; $(perl ...) $((perl ...)) ${perl ...} ${{perl ...}}
442 '("[^$]\\$\\(((?\\|{{?\\)makeperl[ \t]+" 460 '("[^$]\\$\\(((?\\|{{?\\)makeperl[ \t]+"
443 makefile-match-function-end nil nil 461 makefile-match-function-end nil nil
444 (1 'makefile-makepp-perl-face prepend t)) 462 (1 'makefile-makepp-perl prepend t))
445 '("[^$]\\$\\(((?\\|{{?\\)perl[ \t]+" 463 '("[^$]\\$\\(((?\\|{{?\\)perl[ \t]+"
446 makefile-match-function-end nil nil 464 makefile-match-function-end nil nil
447 (1 'makefile-makepp-perl-face t t)) 465 (1 'makefile-makepp-perl t t))
448 466
449 ;; Can we unify these with (if (match-end 1) 'prepend t)? 467 ;; Can we unify these with (if (match-end 1) 'prepend t)?
450 '("ifmakeperl\\s +\\(.*\\)" 1 'makefile-makepp-perl-face prepend) 468 '("ifmakeperl\\s +\\(.*\\)" 1 'makefile-makepp-perl prepend)
451 '("ifperl\\s +\\(.*\\)" 1 'makefile-makepp-perl-face t) 469 '("ifperl\\s +\\(.*\\)" 1 'makefile-makepp-perl t)
452 470
453 ;; Perl block single- or multiline, as statement or rule action. 471 ;; Perl block single- or multiline, as statement or rule action.
454 ;; Don't know why the initial newline in 2nd variant of group 2 doesn't get skipped. 472 ;; Don't know why the initial newline in 2nd variant of group 2 doesn't get skipped.
455 '("\\<make\\(?:perl\\|sub\\s +\\S +\\)\\s *\n?\\s *{\\(?:{\\s *\n?\\(\\(?:.*\n\\)+?\\)\\s *}\\|\\s *\\(\\(?:.*?\\|\n?\\(?:.*\n\\)+?\\)\\)\\)}" 473 '("\\<make\\(?:perl\\|sub\\s +\\S +\\)\\s *\n?\\s *{\\(?:{\\s *\n?\\(\\(?:.*\n\\)+?\\)\\s *}\\|\\s *\\(\\(?:.*?\\|\n?\\(?:.*\n\\)+?\\)\\)\\)}"
456 (1 'makefile-makepp-perl-face prepend t) 474 (1 'makefile-makepp-perl prepend t)
457 (2 'makefile-makepp-perl-face prepend t)) 475 (2 'makefile-makepp-perl prepend t))
458 '("\\<\\(?:perl\\|sub\\s +\\S +\\)\\s *\n?\\s *{\\(?:{\\s *\n?\\(\\(?:.*\n\\)+?\\)\\s *}\\|\\s *\\(\\(?:.*?\\|\n?\\(?:.*\n\\)+?\\)\\)\\)}" 476 '("\\<\\(?:perl\\|sub\\s +\\S +\\)\\s *\n?\\s *{\\(?:{\\s *\n?\\(\\(?:.*\n\\)+?\\)\\s *}\\|\\s *\\(\\(?:.*?\\|\n?\\(?:.*\n\\)+?\\)\\)\\)}"
459 (1 'makefile-makepp-perl-face t t) 477 (1 'makefile-makepp-perl t t)
460 (2 'makefile-makepp-perl-face t t)) 478 (2 'makefile-makepp-perl t t))
461 479
462 ;; Statement style perl block. 480 ;; Statement style perl block.
463 '("perl[-_]begin\\s *\\(?:\\s #.*\\)?\n\\(\\(?:.*\n\\)+?\\)\\s *perl[-_]end\\>" 481 '("perl[-_]begin\\s *\\(?:\\s #.*\\)?\n\\(\\(?:.*\n\\)+?\\)\\s *perl[-_]end\\>"
464 1 'makefile-makepp-perl-face t))) 482 1 'makefile-makepp-perl t)))
465 483
466(defconst makefile-bsdmake-font-lock-keywords 484(defconst makefile-bsdmake-font-lock-keywords
467 (makefile-make-font-lock-keywords 485 (makefile-make-font-lock-keywords
@@ -849,10 +867,8 @@ Makefile mode can be configured by modifying the following variables:
849;;;###autoload 867;;;###autoload
850(define-derived-mode makefile-makepp-mode makefile-mode "Makeppfile" 868(define-derived-mode makefile-makepp-mode makefile-mode "Makeppfile"
851 "An adapted `makefile-mode' that knows about makepp." 869 "An adapted `makefile-mode' that knows about makepp."
852 (set (make-local-variable 'makefile-rule-action-regex) 870 (set (make-local-variable 'makefile-rule-action-regex)
853 ;; Don't care about initial tab, but I don't know how to font-lock correctly without. 871 makefile-makepp-rule-action-regex)
854 "^\t[ \t]*\\(\\(?:\\(?:noecho\\|ignore[-_]error\\|[-@]+\\)[ \t]*\\)*\\)\\(\\(&\\S +\\)?\\(?:.*\\\\\n\\)*.*\\)")
855
856 (setq font-lock-defaults 872 (setq font-lock-defaults
857 `(makefile-makepp-font-lock-keywords ,@(cdr font-lock-defaults)) 873 `(makefile-makepp-font-lock-keywords ,@(cdr font-lock-defaults))
858 imenu-generic-expression 874 imenu-generic-expression
@@ -863,11 +879,10 @@ Makefile mode can be configured by modifying the following variables:
863(define-derived-mode makefile-bsdmake-mode makefile-mode "BSDmakefile" 879(define-derived-mode makefile-bsdmake-mode makefile-mode "BSDmakefile"
864 "An adapted `makefile-mode' that knows about BSD make." 880 "An adapted `makefile-mode' that knows about BSD make."
865 (set (make-local-variable 'makefile-dependency-regex) 881 (set (make-local-variable 'makefile-dependency-regex)
866 ;; Identical to default, except allows `!' instead of `:'. 882 makefile-bsdmake-dependency-regex)
867 "^ *\\(\\(?: *\\$\\(?:[({]\\(?:\\$\\(?:[({]\\(?:\\$\\(?:[^({]\\|.[^\n$#})]+?[})]\\)\\|[^\n$#)}]\\)+?[})]\\|[^({]\\)\\|[^\n$#)}]\\)+?[})]\\|[^({]\\)\\| *[^ \n$#:=]+\\)+?\\)[ \t]*\\([:!]\\)\\(?:[ \t]*$\\|[^=\n]\\(?:[^#\n]*?;[ \t]*\\(.+\\)\\)?\\)")
868 (set (make-local-variable 'makefile-dependency-skip) "^:!") 883 (set (make-local-variable 'makefile-dependency-skip) "^:!")
869 (set (make-local-variable 'makefile-rule-action-regex) 884 (set (make-local-variable 'makefile-rule-action-regex)
870 "^\t[ \t]*\\([-+@]*\\)[ \t]*\\(\\(?:.*\\\\\n\\)*.*\\)") 885 makefile-bsdmake-rule-action-regex)
871 (setq font-lock-defaults 886 (setq font-lock-defaults
872 `(makefile-bsdmake-font-lock-keywords ,@(cdr font-lock-defaults)))) 887 `(makefile-bsdmake-font-lock-keywords ,@(cdr font-lock-defaults))))
873 888
@@ -897,6 +912,8 @@ Makefile mode can be configured by modifying the following variables:
897 (backward-char)) 912 (backward-char))
898 (get-text-property (point) 'face) 913 (get-text-property (point) 'face)
899 (beginning-of-line) 914 (beginning-of-line)
915 (if (> (point) (+ (point-min) 2))
916 (eq (char-before (1- (point))) ?\\))
900 (if (looking-at makefile-dependency-regex) 917 (if (looking-at makefile-dependency-regex)
901 (throw 'found t)))) 918 (throw 'found t))))
902 (goto-char pt) 919 (goto-char pt)
@@ -1686,9 +1703,24 @@ matched in a rule action."
1686 (forward-char) 1703 (forward-char)
1687 (or (eq (char-after) ?=) 1704 (or (eq (char-after) ?=)
1688 (get-text-property (1- (point)) 'face) 1705 (get-text-property (1- (point)) 'face)
1706 (if (> (line-beginning-position) (+ (point-min) 2))
1707 (eq (char-before (line-end-position 0)) ?\\))
1689 (when (save-excursion 1708 (when (save-excursion
1690 (beginning-of-line) 1709 (beginning-of-line)
1691 (looking-at makefile-dependency-regex)) 1710 (looking-at makefile-dependency-regex))
1711 (save-excursion
1712 (let ((deps-end (match-end 1))
1713 (match-data (match-data)))
1714 (goto-char deps-end)
1715 (skip-chars-backward " \t")
1716 (setq deps-end (point))
1717 (beginning-of-line)
1718 (skip-chars-forward " \t")
1719 ;; Alter the bounds recorded for subexp 1,
1720 ;; which is what is supposed to match the targets.
1721 (setcar (nthcdr 2 match-data) (point))
1722 (setcar (nthcdr 3 match-data) deps-end)
1723 (store-match-data match-data)))
1692 (end-of-line) 1724 (end-of-line)
1693 (throw 'found (point))))) 1725 (throw 'found (point)))))
1694 (goto-char pt)) 1726 (goto-char pt))