diff options
author | Lars Ingebrigtsen <larsi@gnus.org> | 2020-12-12 21:59:08 +0100 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2020-12-12 21:59:08 +0100 |
commit | 4bf98aecffe57648d15db90718134b00ac87ec3b (patch) | |
tree | 31c372fe90986366c8587e59a34b8c2d2ff3f82f /lisp/progmodes/make-mode.el | |
parent | 180e309d8b15b66b588438d157ed1290ab2de7df (diff) | |
download | emacs-4bf98aecffe57648d15db90718134b00ac87ec3b.tar.gz emacs-4bf98aecffe57648d15db90718134b00ac87ec3b.tar.bz2 emacs-4bf98aecffe57648d15db90718134b00ac87ec3b.zip |
Fix BSD .include etc syntax in Makefiles
* lisp/progmodes/make-mode.el (makefile-bsdmake-statements): Fix
the BSD conditional syntax (bug#24000).
(makefile-make-font-lock-keywords): Allow calling without keywords.
(makefile-bsdmake-font-lock-keywords): Add the conditional syntax.
Makefile inclusion, conditional structures and for loops reminiscent of
the C programming language are provided in make. All such structures are
identified by a line beginning with a single dot (`.') character.
Whitespace characters may follow this dot, e.g.,
.include <file>
and
. include <file>
are identical constructs
Diffstat (limited to 'lisp/progmodes/make-mode.el')
-rw-r--r-- | lisp/progmodes/make-mode.el | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/lisp/progmodes/make-mode.el b/lisp/progmodes/make-mode.el index 3e49f84dbce..8b6a7fc1b48 100644 --- a/lisp/progmodes/make-mode.el +++ b/lisp/progmodes/make-mode.el @@ -343,8 +343,9 @@ not be enclosed in { } or ( )." "List of keywords understood by gmake.") (defconst makefile-bsdmake-statements - '(".elif" ".elifdef" ".elifmake" ".elifndef" ".elifnmake" ".else" ".endfor" - ".endif" ".for" ".if" ".ifdef" ".ifmake" ".ifndef" ".ifnmake" ".undef") + '("elif" "elifdef" "elifmake" "elifndef" "elifnmake" "else" "endfor" + "endif" "for" "if" "ifdef" "ifmake" "ifndef" "ifnmake" "poison" + "undef" "include") "List of keywords understood by BSD make.") (defun makefile-make-font-lock-keywords (var keywords space @@ -376,8 +377,9 @@ not be enclosed in { } or ( )." ("[^$]\\(\\$[@%*]\\)" 1 'makefile-targets append) - ;; Fontify conditionals and includes. - (,(concat "^\\(?: [ \t]*\\)?" + ,@(if keywords + ;; Fontify conditionals and includes. + `((,(concat "^\\(?: [ \t]*\\)?" (replace-regexp-in-string " " "[ \t]+" (if (eq (car keywords) t) @@ -385,7 +387,7 @@ not be enclosed in { } or ( )." (regexp-opt (cdr keywords) t)) (regexp-opt keywords t))) "\\>[ \t]*\\([^: \t\n#]*\\)") - (1 font-lock-keyword-face) (2 font-lock-variable-name-face)) + (1 font-lock-keyword-face) (2 font-lock-variable-name-face)))) ,@(if negation `((,negation (1 font-lock-negation-char-face prepend) @@ -493,13 +495,17 @@ not be enclosed in { } or ( )." 1 'makefile-makepp-perl t))) (defconst makefile-bsdmake-font-lock-keywords - (makefile-make-font-lock-keywords - ;; A lot more could be done for variables here: - makefile-var-use-regex - makefile-bsdmake-statements - t - "^\\(?: [ \t]*\\)?\\.\\(?:el\\)?if\\(n?\\)\\(?:def\\|make\\)?\\>[ \t]*\\(!?\\)" - '("^[ \t]*\\.for[ \t].+[ \t]\\(in\\)\\>" 1 font-lock-keyword-face))) + (append + (makefile-make-font-lock-keywords + ;; A lot more could be done for variables here: + makefile-var-use-regex + nil + t + "^\\(?: [ \t]*\\)?\\.\\(?:el\\)?if\\(n?\\)\\(?:def\\|make\\)?\\>[ \t]*\\(!?\\)" + '("^[ \t]*\\.for[ \t].+[ \t]\\(in\\)\\>" 1 font-lock-keyword-face)) + `((,(concat "^\\. *" (regexp-opt makefile-bsdmake-statements) "\\>") 0 + font-lock-keyword-face)))) + (defconst makefile-imake-font-lock-keywords (append |