aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorDaniel Pfeiffer2005-06-14 22:33:56 +0000
committerDaniel Pfeiffer2005-06-14 22:33:56 +0000
commit602dc0daa02e8e71cc9d33c405882f84f0316959 (patch)
tree2c0d8a0fdfa619c9790e045f13f03337623eec49 /lisp
parentb636352442bdc181b27718f62929a0e4508c673d (diff)
downloademacs-602dc0daa02e8e71cc9d33c405882f84f0316959.tar.gz
emacs-602dc0daa02e8e71cc9d33c405882f84f0316959.zip
(makefile-space, makefile-makepp-perl): Eliminate "-face" suffix.
(makefile-targets): Inherit from font-lock-function-name-face and eliminate "-face" suffix. (makefile-shell): Remove attributes and eliminate "-face" suffix. (makefile-*-font-lock-keywords): Append makefile-targets in rule actions, instead of prepending, to make it less visible. (makefile-previous-dependency, makefile-match-dependency): Don't match a target on a continuation line.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/progmodes/make-mode.el65
1 files changed, 35 insertions, 30 deletions
diff --git a/lisp/progmodes/make-mode.el b/lisp/progmodes/make-mode.el
index d2d2dc6263a..d9c38349b49 100644
--- a/lisp/progmodes/make-mode.el
+++ b/lisp/progmodes/make-mode.el
@@ -99,30 +99,31 @@
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 :version "22.1")
116 116
117(defface makefile-shell-face 117(defface makefile-shell
118 '((((class color) (min-colors 88) (background light)) (:background "seashell1")) 118 ()
119 (((class color) (min-colors 88) (background dark)) (:background "seashell4"))) 119 ;;'((((class color) (min-colors 88) (background light)) (:background "seashell1"))
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
123 :version "22.1") 124 :version "22.1")
124 125
125(defface makefile-makepp-perl-face 126(defface makefile-makepp-perl
126 '((((class color) (background light)) (:background "LightBlue1")) ; Camel Book 127 '((((class color) (background light)) (:background "LightBlue1")) ; Camel Book
127 (((class color) (background dark)) (:background "DarkBlue")) 128 (((class color) (background dark)) (:background "DarkBlue"))
128 (t (:reverse-video t))) 129 (t (:reverse-video t)))
@@ -302,8 +303,8 @@ not be enclosed in { } or ( )."
302 "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.")
303 304
304(if (fboundp 'facemenu-unlisted-faces) 305(if (fboundp 'facemenu-unlisted-faces)
305 (add-to-list 'facemenu-unlisted-faces 'makefile-space-face)) 306 (add-to-list 'facemenu-unlisted-faces 'makefile-space))
306(defvar makefile-space-face 'makefile-space-face 307(defvar makefile-space 'makefile-space
307 "Face to use for highlighting leading spaces in Font-Lock mode.") 308 "Face to use for highlighting leading spaces in Font-Lock mode.")
308 309
309;; 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
@@ -348,14 +349,14 @@ not be enclosed in { } or ( )."
348 (,makefile-macroassign-regex 349 (,makefile-macroassign-regex
349 (1 font-lock-variable-name-face) 350 (1 font-lock-variable-name-face)
350 ;; This is for after != 351 ;; This is for after !=
351 (2 'makefile-shell-face prepend t) 352 (2 'makefile-shell prepend t)
352 ;; This is for after normal assignment 353 ;; This is for after normal assignment
353 (3 'font-lock-string-face prepend t)) 354 (3 'font-lock-string-face prepend t))
354 355
355 ;; Rule actions. 356 ;; Rule actions.
356 (makefile-match-action 357 (makefile-match-action
357 (1 font-lock-type-face) 358 (1 font-lock-type-face)
358 (2 'makefile-shell-face prepend) 359 (2 'makefile-shell prepend)
359 ;; Only makepp has builtin commands. 360 ;; Only makepp has builtin commands.
360 (3 font-lock-builtin-face prepend t)) 361 (3 font-lock-builtin-face prepend t))
361 362
@@ -367,7 +368,7 @@ not be enclosed in { } or ( )."
367 ("[^$]\\$\\([@%<?^+*_]\\|[a-zA-Z0-9]\\>\\)" 368 ("[^$]\\$\\([@%<?^+*_]\\|[a-zA-Z0-9]\\>\\)"
368 1 font-lock-constant-face prepend) 369 1 font-lock-constant-face prepend)
369 ("[^$]\\(\\$[@%*]\\)" 370 ("[^$]\\(\\$[@%*]\\)"
370 1 'makefile-targets-face prepend) 371 1 'makefile-targets append)
371 372
372 ;; Fontify conditionals and includes. 373 ;; Fontify conditionals and includes.
373 (,(concat "^\\(?: [ \t]*\\)?" 374 (,(concat "^\\(?: [ \t]*\\)?"
@@ -382,22 +383,22 @@ not be enclosed in { } or ( )."
382 ,@(if space 383 ,@(if space
383 '(;; Highlight lines that contain just whitespace. 384 '(;; Highlight lines that contain just whitespace.
384 ;; They can cause trouble, especially if they start with a tab. 385 ;; They can cause trouble, especially if they start with a tab.
385 ("^[ \t]+$" . makefile-space-face) 386 ("^[ \t]+$" . makefile-space)
386 387
387 ;; Highlight shell comments that Make treats as commands, 388 ;; Highlight shell comments that Make treats as commands,
388 ;; since these can fool people. 389 ;; since these can fool people.
389 ("^\t+#" 0 makefile-space-face t) 390 ("^\t+#" 0 makefile-space t)
390 391
391 ;; Highlight spaces that precede tabs. 392 ;; Highlight spaces that precede tabs.
392 ;; They can make a tab fail to be effective. 393 ;; They can make a tab fail to be effective.
393 ("^\\( +\\)\t" 1 makefile-space-face))) 394 ("^\\( +\\)\t" 1 makefile-space)))
394 395
395 ,@font-lock-keywords 396 ,@font-lock-keywords
396 397
397 ;; Do dependencies. 398 ;; Do dependencies.
398 (makefile-match-dependency 399 (makefile-match-dependency
399 (1 'makefile-targets-face prepend) 400 (1 'makefile-targets prepend)
400 (3 'makefile-shell-face prepend t)))) 401 (3 'makefile-shell prepend t))))
401 402
402(defconst makefile-font-lock-keywords 403(defconst makefile-font-lock-keywords
403 (makefile-make-font-lock-keywords 404 (makefile-make-font-lock-keywords
@@ -419,7 +420,7 @@ not be enclosed in { } or ( )."
419 "^\\(?: [ \t]*\\)?if\\(n\\)\\(?:def\\|eq\\)\\>" 420 "^\\(?: [ \t]*\\)?if\\(n\\)\\(?:def\\|eq\\)\\>"
420 421
421 '("[^$]\\(\\$[({][@%*][DF][})]\\)" 422 '("[^$]\\(\\$[({][@%*][DF][})]\\)"
422 1 'makefile-targets-face prepend) 423 1 'makefile-targets append)
423 424
424 ;; $(function ...) ${function ...} 425 ;; $(function ...) ${function ...}
425 '("[^$]\\$[({]\\([-a-zA-Z0-9_.]+\\s \\)" 426 '("[^$]\\$[({]\\([-a-zA-Z0-9_.]+\\s \\)"
@@ -428,7 +429,7 @@ not be enclosed in { } or ( )."
428 ;; $(shell ...) ${shell ...} 429 ;; $(shell ...) ${shell ...}
429 '("[^$]\\$\\([({]\\)shell[ \t]+" 430 '("[^$]\\$\\([({]\\)shell[ \t]+"
430 makefile-match-function-end nil nil 431 makefile-match-function-end nil nil
431 (1 'makefile-shell-face prepend t)))) 432 (1 'makefile-shell prepend t))))
432 433
433(defconst makefile-makepp-font-lock-keywords 434(defconst makefile-makepp-font-lock-keywords
434 (makefile-make-font-lock-keywords 435 (makefile-make-font-lock-keywords
@@ -438,7 +439,7 @@ not be enclosed in { } or ( )."
438 "^\\(?: [ \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\\)\\>"
439 440
440 '("[^$]\\(\\$[({]\\(?:output\\|stem\\|target\\)s?\\_>.*?[})]\\)" 441 '("[^$]\\(\\$[({]\\(?:output\\|stem\\|target\\)s?\\_>.*?[})]\\)"
441 1 'makefile-targets-face prepend) 442 1 'makefile-targets append)
442 443
443 ;; Colon modifier keywords. 444 ;; Colon modifier keywords.
444 '("\\(:\\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]*\\)"
@@ -453,32 +454,32 @@ not be enclosed in { } or ( )."
453 ;; $(shell ...) $((shell ...)) ${shell ...} ${{shell ...}} 454 ;; $(shell ...) $((shell ...)) ${shell ...} ${{shell ...}}
454 '("[^$]\\$\\(((?\\|{{?\\)shell\\(?:[-_]\\(?:global[-_]\\)?once\\)?[ \t]+" 455 '("[^$]\\$\\(((?\\|{{?\\)shell\\(?:[-_]\\(?:global[-_]\\)?once\\)?[ \t]+"
455 makefile-match-function-end nil nil 456 makefile-match-function-end nil nil
456 (1 'makefile-shell-face prepend t)) 457 (1 'makefile-shell prepend t))
457 458
458 ;; $(perl ...) $((perl ...)) ${perl ...} ${{perl ...}} 459 ;; $(perl ...) $((perl ...)) ${perl ...} ${{perl ...}}
459 '("[^$]\\$\\(((?\\|{{?\\)makeperl[ \t]+" 460 '("[^$]\\$\\(((?\\|{{?\\)makeperl[ \t]+"
460 makefile-match-function-end nil nil 461 makefile-match-function-end nil nil
461 (1 'makefile-makepp-perl-face prepend t)) 462 (1 'makefile-makepp-perl prepend t))
462 '("[^$]\\$\\(((?\\|{{?\\)perl[ \t]+" 463 '("[^$]\\$\\(((?\\|{{?\\)perl[ \t]+"
463 makefile-match-function-end nil nil 464 makefile-match-function-end nil nil
464 (1 'makefile-makepp-perl-face t t)) 465 (1 'makefile-makepp-perl t t))
465 466
466 ;; Can we unify these with (if (match-end 1) 'prepend t)? 467 ;; Can we unify these with (if (match-end 1) 'prepend t)?
467 '("ifmakeperl\\s +\\(.*\\)" 1 'makefile-makepp-perl-face prepend) 468 '("ifmakeperl\\s +\\(.*\\)" 1 'makefile-makepp-perl prepend)
468 '("ifperl\\s +\\(.*\\)" 1 'makefile-makepp-perl-face t) 469 '("ifperl\\s +\\(.*\\)" 1 'makefile-makepp-perl t)
469 470
470 ;; Perl block single- or multiline, as statement or rule action. 471 ;; Perl block single- or multiline, as statement or rule action.
471 ;; 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.
472 '("\\<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\\)+?\\)\\)\\)}"
473 (1 'makefile-makepp-perl-face prepend t) 474 (1 'makefile-makepp-perl prepend t)
474 (2 'makefile-makepp-perl-face prepend t)) 475 (2 'makefile-makepp-perl prepend t))
475 '("\\<\\(?: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\\)+?\\)\\)\\)}"
476 (1 'makefile-makepp-perl-face t t) 477 (1 'makefile-makepp-perl t t)
477 (2 'makefile-makepp-perl-face t t)) 478 (2 'makefile-makepp-perl t t))
478 479
479 ;; Statement style perl block. 480 ;; Statement style perl block.
480 '("perl[-_]begin\\s *\\(?:\\s #.*\\)?\n\\(\\(?:.*\n\\)+?\\)\\s *perl[-_]end\\>" 481 '("perl[-_]begin\\s *\\(?:\\s #.*\\)?\n\\(\\(?:.*\n\\)+?\\)\\s *perl[-_]end\\>"
481 1 'makefile-makepp-perl-face t))) 482 1 'makefile-makepp-perl t)))
482 483
483(defconst makefile-bsdmake-font-lock-keywords 484(defconst makefile-bsdmake-font-lock-keywords
484 (makefile-make-font-lock-keywords 485 (makefile-make-font-lock-keywords
@@ -911,6 +912,8 @@ Makefile mode can be configured by modifying the following variables:
911 (backward-char)) 912 (backward-char))
912 (get-text-property (point) 'face) 913 (get-text-property (point) 'face)
913 (beginning-of-line) 914 (beginning-of-line)
915 (if (> (point) (+ (point-min) 2))
916 (eq (char-before (1- (point))) ?\\))
914 (if (looking-at makefile-dependency-regex) 917 (if (looking-at makefile-dependency-regex)
915 (throw 'found t)))) 918 (throw 'found t))))
916 (goto-char pt) 919 (goto-char pt)
@@ -1700,6 +1703,8 @@ matched in a rule action."
1700 (forward-char) 1703 (forward-char)
1701 (or (eq (char-after) ?=) 1704 (or (eq (char-after) ?=)
1702 (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)) ?\\))
1703 (when (save-excursion 1708 (when (save-excursion
1704 (beginning-of-line) 1709 (beginning-of-line)
1705 (looking-at makefile-dependency-regex)) 1710 (looking-at makefile-dependency-regex))