diff options
| author | Daniel Pfeiffer | 2011-12-12 16:23:42 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2011-12-12 16:23:42 -0500 |
| commit | 87393f2618610b11f406db76f41677475bec41cc (patch) | |
| tree | 07c43e74848dbc753e1bb22e8735bc226df97dcf | |
| parent | 8d3c0ff211e830c3df9c36537dcbe5187a272d07 (diff) | |
| download | emacs-87393f2618610b11f406db76f41677475bec41cc.tar.gz emacs-87393f2618610b11f406db76f41677475bec41cc.zip | |
* lisp/progmodes/make-mode.el: Bring it up to date with makepp V2.0.
(makefile-make-font-lock-keywords): Extend meaning of `keywords'.
(makefile-gmake-statements, makefile-makepp-statements):
Use it and add new makepp keywords.
(makefile-makepp-font-lock-keywords): Add new patterns.
(makefile-match-function-end): Match new [...] and [[...]].
| -rw-r--r-- | lisp/ChangeLog | 9 | ||||
| -rw-r--r-- | lisp/progmodes/make-mode.el | 58 |
2 files changed, 45 insertions, 22 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 00723a1eb93..80eb82a521d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2011-12-12 Daniel Pfeiffer <occitan@t-online.de> | ||
| 2 | |||
| 3 | * progmodes/make-mode.el: Bring it up to date with makepp V2.0. | ||
| 4 | (makefile-make-font-lock-keywords): Extend meaning of `keywords'. | ||
| 5 | (makefile-gmake-statements, makefile-makepp-statements): | ||
| 6 | Use it and add new makepp keywords. | ||
| 7 | (makefile-makepp-font-lock-keywords): Add new patterns. | ||
| 8 | (makefile-match-function-end): Match new [...] and [[...]]. | ||
| 9 | |||
| 1 | 2011-12-11 Juanma Barranquero <lekktu@gmail.com> | 10 | 2011-12-11 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 11 | ||
| 3 | * ses.el (ses-call-printer-return, ses-cell-property-get) | 12 | * ses.el (ses-call-printer-return, ses-cell-property-get) |
diff --git a/lisp/progmodes/make-mode.el b/lisp/progmodes/make-mode.el index c1a87a9d033..024744957c6 100644 --- a/lisp/progmodes/make-mode.el +++ b/lisp/progmodes/make-mode.el | |||
| @@ -315,25 +315,32 @@ not be enclosed in { } or ( )." | |||
| 315 | "List of keywords understood by automake.") | 315 | "List of keywords understood by automake.") |
| 316 | 316 | ||
| 317 | (defconst makefile-gmake-statements | 317 | (defconst makefile-gmake-statements |
| 318 | `("-sinclude" "sinclude" "vpath" ; makefile-makepp-statements takes rest | 318 | `("-sinclude" "sinclude" ; makefile-makepp-statements takes rest |
| 319 | "ifdef" "ifndef" "ifeq" "ifneq" "-include" "define" "endef" "export" | 319 | "ifdef" "ifndef" "ifeq" "ifneq" "-include" "define" "endef" "export" |
| 320 | "override define" "override" "unexport" | 320 | "override define" "override" "unexport" "vpath" |
| 321 | ,@(cdr makefile-automake-statements)) | 321 | ,@(cdr makefile-automake-statements)) |
| 322 | "List of keywords understood by gmake.") | 322 | "List of keywords understood by gmake.") |
| 323 | 323 | ||
| 324 | ;; These are even more silly, because you can have more spaces in between. | ||
| 325 | (defconst makefile-makepp-statements | 324 | (defconst makefile-makepp-statements |
| 326 | `("and ifdef" "and ifndef" "and ifeq" "and ifneq" "and ifperl" | 325 | `(t ; - alternately means _ |
| 327 | "and ifmakeperl" "and ifsys" "and ifnsys" "build_cache" "build_check" | 326 | ;; todo: take if* out of these lists, and let the negation regexp do it all |
| 327 | "ifperl" "ifmakeperl" "ifsys" "ifnsys" "iftrue" "ifntrue" | ||
| 328 | "and ifdef" "and ifndef" "and ifeq" "and ifneq" "and ifperl" | ||
| 329 | "and ifmakeperl" "and ifsys" "and ifnsys" "and iftrue" "and ifntrue" | ||
| 328 | "else ifdef" "else ifndef" "else ifeq" "else ifneq" "else ifperl" | 330 | "else ifdef" "else ifndef" "else ifeq" "else ifneq" "else ifperl" |
| 329 | "else ifmakeperl" "else ifsys" "else ifnsys" "enddef" "global" | 331 | "else ifmakeperl" "else ifsys" "else ifnsys" "else iftrue" "else ifntrue" |
| 330 | "load_makefile" "ifperl" "ifmakeperl" "ifsys" "ifnsys" "_include" | 332 | "or ifdef" "or ifndef" "or ifeq" "or ifneq" "or ifperl" |
| 331 | "makeperl" "makesub" "no_implicit_load" "perl" "perl-begin" "perl_begin" | 333 | "or ifmakeperl" "or ifsys" "or ifnsys" "or iftrue" "or ifntrue" |
| 332 | "perl-end" "perl_end" "prebuild" "or ifdef" "or ifndef" "or ifeq" | 334 | |
| 333 | "or ifneq" "or ifperl" "or ifmakeperl" "or ifsys" "or ifnsys" | 335 | "autoload" "build-cache" "build-check" "enddef" "export define" |
| 334 | "override export" "override global" "register_command_parser" | 336 | "global" "global build-cache" "global build-check" "global define" |
| 335 | "register_scanner" "repository" "runtime" "signature" "sub" | 337 | "global signature" "global override signature" "load-makefile" |
| 336 | ,@(nthcdr 3 makefile-gmake-statements)) | 338 | "make" "makeperl" "makesub" "no-implicit-load" "perl" "perl-begin" |
| 339 | "perl-end" "prebuild" "override export" "override global" "register-parser" | ||
| 340 | "register-command-parser" "register-input-suffix" | ||
| 341 | "register-scanner" "repository" "runtime" "signature" "sub" | ||
| 342 | |||
| 343 | ,@(nthcdr 2 makefile-gmake-statements)) | ||
| 337 | "List of keywords understood by gmake.") | 344 | "List of keywords understood by gmake.") |
| 338 | 345 | ||
| 339 | (defconst makefile-bsdmake-statements | 346 | (defconst makefile-bsdmake-statements |
| @@ -372,7 +379,12 @@ not be enclosed in { } or ( )." | |||
| 372 | 379 | ||
| 373 | ;; Fontify conditionals and includes. | 380 | ;; Fontify conditionals and includes. |
| 374 | (,(concat "^\\(?: [ \t]*\\)?" | 381 | (,(concat "^\\(?: [ \t]*\\)?" |
| 375 | (regexp-opt keywords t) | 382 | (replace-regexp-in-string |
| 383 | " " "[ \t]+" | ||
| 384 | (if (eq (car keywords) t) | ||
| 385 | (replace-regexp-in-string "-" "[_-]" | ||
| 386 | (regexp-opt (cdr keywords) t)) | ||
| 387 | (regexp-opt keywords t))) | ||
| 376 | "\\>[ \t]*\\([^: \t\n#]*\\)") | 388 | "\\>[ \t]*\\([^: \t\n#]*\\)") |
| 377 | (1 font-lock-keyword-face) (2 font-lock-variable-name-face)) | 389 | (1 font-lock-keyword-face) (2 font-lock-variable-name-face)) |
| 378 | 390 | ||
| @@ -436,7 +448,7 @@ not be enclosed in { } or ( )." | |||
| 436 | makefile-var-use-regex | 448 | makefile-var-use-regex |
| 437 | makefile-makepp-statements | 449 | makefile-makepp-statements |
| 438 | nil | 450 | nil |
| 439 | "^\\(?: [ \t]*\\)?\\(?:and[ \t]+\\|else[ \t]+\\|or[ \t]+\\)?if\\(n\\)\\(?:def\\|eq\\|sys\\)\\>" | 451 | "^\\(?: [ \t]*\\)?\\(?:and[ \t]+\\|else[ \t]+\\|or[ \t]+\\)?if\\(n\\)\\(?:def\\|eq\\|sys\\|true\\)\\>" |
| 440 | 452 | ||
| 441 | '("[^$]\\(\\$[({]\\(?:output\\|stem\\|target\\)s?\\_>.*?[})]\\)" | 453 | '("[^$]\\(\\$[({]\\(?:output\\|stem\\|target\\)s?\\_>.*?[})]\\)" |
| 442 | 1 'makefile-targets append) | 454 | 1 'makefile-targets append) |
| @@ -447,17 +459,17 @@ not be enclosed in { } or ( )." | |||
| 447 | (2 font-lock-keyword-face t) | 459 | (2 font-lock-keyword-face t) |
| 448 | (3 font-lock-variable-name-face t)) | 460 | (3 font-lock-variable-name-face t)) |
| 449 | 461 | ||
| 450 | ;; $(function ...) $((function ...)) ${function ...} ${{function ...}} | 462 | ;; $(function ...) $((function ...)) ${...} ${{...}} $[...] $[[...]] |
| 451 | '("[^$]\\$\\(?:((?\\|{{?\\)\\([-a-zA-Z0-9_.]+\\s \\)" | 463 | '("[^$]\\$\\(?:((?\\|{{?\\|\\[\\[?\\)\\([-a-zA-Z0-9_.]+\\s \\)" |
| 452 | 1 font-lock-function-name-face prepend) | 464 | 1 font-lock-function-name-face prepend) |
| 453 | 465 | ||
| 454 | ;; $(shell ...) $((shell ...)) ${shell ...} ${{shell ...}} | 466 | ;; $(shell ...) $((shell ...)) ${...} ${{...}} $[...] $[[...]] |
| 455 | '("[^$]\\$\\(((?\\|{{?\\)shell\\(?:[-_]\\(?:global[-_]\\)?once\\)?[ \t]+" | 467 | '("[^$]\\$\\(((?\\|{{?\\|\\[\\[?\\)shell\\(?:[-_]\\(?:global[-_]\\)?once\\)?[ \t]+" |
| 456 | makefile-match-function-end nil nil | 468 | makefile-match-function-end nil nil |
| 457 | (1 'makefile-shell prepend t)) | 469 | (1 'makefile-shell prepend t)) |
| 458 | 470 | ||
| 459 | ;; $(perl ...) $((perl ...)) ${perl ...} ${{perl ...}} | 471 | ;; $(perl ...) $((perl ...)) ${...} ${{...}} $[...] $[[...]] |
| 460 | '("[^$]\\$\\(((?\\|{{?\\)makeperl[ \t]+" | 472 | '("[^$]\\$\\(((?\\|{{?\\|\\[\\[?\\)makeperl[ \t]+" |
| 461 | makefile-match-function-end nil nil | 473 | makefile-match-function-end nil nil |
| 462 | (1 'makefile-makepp-perl prepend t)) | 474 | (1 'makefile-makepp-perl prepend t)) |
| 463 | '("[^$]\\$\\(((?\\|{{?\\)perl[ \t]+" | 475 | '("[^$]\\$\\(((?\\|{{?\\)perl[ \t]+" |
| @@ -1688,8 +1700,10 @@ The anchor must have matched the opening parens in the first group." | |||
| 1688 | ;; FIXME forward-sexp or somesuch would be better? | 1700 | ;; FIXME forward-sexp or somesuch would be better? |
| 1689 | (if (setq s (cond ((string= s "(") ")") | 1701 | (if (setq s (cond ((string= s "(") ")") |
| 1690 | ((string= s "{") "}") | 1702 | ((string= s "{") "}") |
| 1703 | ((string= s "[") "]") | ||
| 1691 | ((string= s "((") "))") | 1704 | ((string= s "((") "))") |
| 1692 | ((string= s "{{") "}}"))) | 1705 | ((string= s "{{") "}}") |
| 1706 | ((string= s "[[") "]]"))) | ||
| 1693 | (re-search-forward (concat "\\(.*\\)[ \t]*" s) (line-end-position) t)))) | 1707 | (re-search-forward (concat "\\(.*\\)[ \t]*" s) (line-end-position) t)))) |
| 1694 | 1708 | ||
| 1695 | (defun makefile-match-dependency (bound) | 1709 | (defun makefile-match-dependency (bound) |