From 602dc0daa02e8e71cc9d33c405882f84f0316959 Mon Sep 17 00:00:00 2001 From: Daniel Pfeiffer Date: Tue, 14 Jun 2005 22:33:56 +0000 Subject: [PATCH] (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. --- lisp/progmodes/make-mode.el | 65 ++++++++++++++++++++----------------- 1 file 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 @@ :group 'tools :prefix "makefile-") -(defface makefile-space-face +(defface makefile-space '((((class color)) (:background "hotpink")) (t (:reverse-video t))) "Face to use for highlighting leading spaces in Font-Lock mode." :group 'faces :group 'makefile) -(defface makefile-targets-face +(defface makefile-targets ;; This needs to go along both with foreground and background colors (i.e. shell) - '((t (:underline t))) + '((t (:inherit font-lock-function-name-face))) "Face to use for additionally highlighting rule targets in Font-Lock mode." :group 'faces :group 'makefile :version "22.1") -(defface makefile-shell-face - '((((class color) (min-colors 88) (background light)) (:background "seashell1")) - (((class color) (min-colors 88) (background dark)) (:background "seashell4"))) +(defface makefile-shell + () + ;;'((((class color) (min-colors 88) (background light)) (:background "seashell1")) + ;; (((class color) (min-colors 88) (background dark)) (:background "seashell4"))) "Face to use for additionally highlighting Shell commands in Font-Lock mode." :group 'faces :group 'makefile :version "22.1") -(defface makefile-makepp-perl-face +(defface makefile-makepp-perl '((((class color) (background light)) (:background "LightBlue1")) ; Camel Book (((class color) (background dark)) (:background "DarkBlue")) (t (:reverse-video t))) @@ -302,8 +303,8 @@ not be enclosed in { } or ( )." "Regex for filenames that will NOT be included in the target list.") (if (fboundp 'facemenu-unlisted-faces) - (add-to-list 'facemenu-unlisted-faces 'makefile-space-face)) -(defvar makefile-space-face 'makefile-space-face + (add-to-list 'facemenu-unlisted-faces 'makefile-space)) +(defvar makefile-space 'makefile-space "Face to use for highlighting leading spaces in Font-Lock mode.") ;; These lists were inspired by the old solution. But they are silly, because @@ -348,14 +349,14 @@ not be enclosed in { } or ( )." (,makefile-macroassign-regex (1 font-lock-variable-name-face) ;; This is for after != - (2 'makefile-shell-face prepend t) + (2 'makefile-shell prepend t) ;; This is for after normal assignment (3 'font-lock-string-face prepend t)) ;; Rule actions. (makefile-match-action (1 font-lock-type-face) - (2 'makefile-shell-face prepend) + (2 'makefile-shell prepend) ;; Only makepp has builtin commands. (3 font-lock-builtin-face prepend t)) @@ -367,7 +368,7 @@ not be enclosed in { } or ( )." ("[^$]\\$\\([@%\\)" 1 font-lock-constant-face prepend) ("[^$]\\(\\$[@%*]\\)" - 1 'makefile-targets-face prepend) + 1 'makefile-targets append) ;; Fontify conditionals and includes. (,(concat "^\\(?: [ \t]*\\)?" @@ -382,22 +383,22 @@ not be enclosed in { } or ( )." ,@(if space '(;; Highlight lines that contain just whitespace. ;; They can cause trouble, especially if they start with a tab. - ("^[ \t]+$" . makefile-space-face) + ("^[ \t]+$" . makefile-space) ;; Highlight shell comments that Make treats as commands, ;; since these can fool people. - ("^\t+#" 0 makefile-space-face t) + ("^\t+#" 0 makefile-space t) ;; Highlight spaces that precede tabs. ;; They can make a tab fail to be effective. - ("^\\( +\\)\t" 1 makefile-space-face))) + ("^\\( +\\)\t" 1 makefile-space))) ,@font-lock-keywords ;; Do dependencies. (makefile-match-dependency - (1 'makefile-targets-face prepend) - (3 'makefile-shell-face prepend t)))) + (1 'makefile-targets prepend) + (3 'makefile-shell prepend t)))) (defconst makefile-font-lock-keywords (makefile-make-font-lock-keywords @@ -419,7 +420,7 @@ not be enclosed in { } or ( )." "^\\(?: [ \t]*\\)?if\\(n\\)\\(?:def\\|eq\\)\\>" '("[^$]\\(\\$[({][@%*][DF][})]\\)" - 1 'makefile-targets-face prepend) + 1 'makefile-targets append) ;; $(function ...) ${function ...} '("[^$]\\$[({]\\([-a-zA-Z0-9_.]+\\s \\)" @@ -428,7 +429,7 @@ not be enclosed in { } or ( )." ;; $(shell ...) ${shell ...} '("[^$]\\$\\([({]\\)shell[ \t]+" makefile-match-function-end nil nil - (1 'makefile-shell-face prepend t)))) + (1 'makefile-shell prepend t)))) (defconst makefile-makepp-font-lock-keywords (makefile-make-font-lock-keywords @@ -438,7 +439,7 @@ not be enclosed in { } or ( )." "^\\(?: [ \t]*\\)?\\(?:and[ \t]+\\|else[ \t]+\\|or[ \t]+\\)?if\\(n\\)\\(?:def\\|eq\\|sys\\)\\>" '("[^$]\\(\\$[({]\\(?:output\\|stem\\|target\\)s?\\_>.*?[})]\\)" - 1 'makefile-targets-face prepend) + 1 'makefile-targets append) ;; Colon modifier keywords. '("\\(:\\s *\\)\\(build_c\\(?:ache\\|heck\\)\\|env\\(?:ironment\\)?\\|foreach\\|signature\\|scanner\\|quickscan\\|smartscan\\)\\>\\([^:\n]*\\)" @@ -453,32 +454,32 @@ not be enclosed in { } or ( )." ;; $(shell ...) $((shell ...)) ${shell ...} ${{shell ...}} '("[^$]\\$\\(((?\\|{{?\\)shell\\(?:[-_]\\(?:global[-_]\\)?once\\)?[ \t]+" makefile-match-function-end nil nil - (1 'makefile-shell-face prepend t)) + (1 'makefile-shell prepend t)) ;; $(perl ...) $((perl ...)) ${perl ...} ${{perl ...}} '("[^$]\\$\\(((?\\|{{?\\)makeperl[ \t]+" makefile-match-function-end nil nil - (1 'makefile-makepp-perl-face prepend t)) + (1 'makefile-makepp-perl prepend t)) '("[^$]\\$\\(((?\\|{{?\\)perl[ \t]+" makefile-match-function-end nil nil - (1 'makefile-makepp-perl-face t t)) + (1 'makefile-makepp-perl t t)) ;; Can we unify these with (if (match-end 1) 'prepend t)? - '("ifmakeperl\\s +\\(.*\\)" 1 'makefile-makepp-perl-face prepend) - '("ifperl\\s +\\(.*\\)" 1 'makefile-makepp-perl-face t) + '("ifmakeperl\\s +\\(.*\\)" 1 'makefile-makepp-perl prepend) + '("ifperl\\s +\\(.*\\)" 1 'makefile-makepp-perl t) ;; Perl block single- or multiline, as statement or rule action. ;; Don't know why the initial newline in 2nd variant of group 2 doesn't get skipped. '("\\" - 1 'makefile-makepp-perl-face t))) + 1 'makefile-makepp-perl t))) (defconst makefile-bsdmake-font-lock-keywords (makefile-make-font-lock-keywords @@ -911,6 +912,8 @@ Makefile mode can be configured by modifying the following variables: (backward-char)) (get-text-property (point) 'face) (beginning-of-line) + (if (> (point) (+ (point-min) 2)) + (eq (char-before (1- (point))) ?\\)) (if (looking-at makefile-dependency-regex) (throw 'found t)))) (goto-char pt) @@ -1700,6 +1703,8 @@ matched in a rule action." (forward-char) (or (eq (char-after) ?=) (get-text-property (1- (point)) 'face) + (if (> (line-beginning-position) (+ (point-min) 2)) + (eq (char-before (line-end-position 0)) ?\\)) (when (save-excursion (beginning-of-line) (looking-at makefile-dependency-regex)) -- 2.39.2