aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/make-mode.el
diff options
context:
space:
mode:
authorRichard M. Stallman <[email protected]>2005-06-06 12:50:01 +0000
committerRichard M. Stallman <[email protected]>2005-06-06 12:50:01 +0000
commitdce16363d3c65f0e2e5b8cd70e6b929687e69021 (patch)
tree62968f3a1f187fe22a6a2014134a2bc87be4fff0 /lisp/progmodes/make-mode.el
parentccba8bb6e250c785266eacae4bbe103c9360a331 (diff)
(makefile-dependency-regex): Handle whitespace
just like other allowed characters. (makefile-match-dependency): Exclude leading and training whitespace from the range of regexp subexp 1. (makefile-macroassign-regex): Don't try to match the body, just the name of the macro being defined.
Diffstat (limited to 'lisp/progmodes/make-mode.el')
-rw-r--r--lisp/progmodes/make-mode.el17
1 files changed, 15 insertions, 2 deletions
diff --git a/lisp/progmodes/make-mode.el b/lisp/progmodes/make-mode.el
index 7356583fb9..35fcc37a29 100644
--- a/lisp/progmodes/make-mode.el
+++ b/lisp/progmodes/make-mode.el
@@ -262,7 +262,7 @@ not be enclosed in { } or ( )."
;; index in makefile-imenu-generic-expression.
(defvar makefile-dependency-regex
;; Allow for two nested levels $(v1:$(v2:$(v3:a=b)=c)=d)
- "^ *\\(\\(?: *\\$\\(?:[({]\\(?:\\$\\(?:[({]\\(?:\\$\\(?:[^({]\\|.[^\n$#})]+?[})]\\)\\|[^\n$#)}]\\)+?[})]\\|[^({]\\)\\|[^\n$#)}]\\)+?[})]\\|[^({]\\)\\| *[^ \n$#:=]+\\)+?\\)[ \t]*\\(:\\)\\(?:[ \t]*$\\|[^=\n]\\(?:[^#\n]*?;[ \t]*\\(.+\\)\\)?\\)"
+ "^\\(\\(?:\\$\\(?:[({]\\(?:\\$\\(?:[({]\\(?:\\$\\(?:[^({]\\|.[^\n$#})]+?[})]\\)\\|[^\n$#)}]\\)+?[})]\\|[^({]\\)\\|[^\n$#)}]\\)+?[})]\\|[^({]\\)\\|[^\n$#:=]\\)+?\\)\\(:\\)\\(?:[ \t]*$\\|[^=\n]\\(?:[^#\n]*?;[ \t]*\\(bb.+\\)\\)?\\)"
"Regex used to find dependency lines in a makefile.")
(defconst makefile-bsdmake-dependency-regex
@@ -291,7 +291,7 @@ not be enclosed in { } or ( )."
;; that if you change this regexp you might have to fix the imenu index in
;; makefile-imenu-generic-expression.
(defconst makefile-macroassign-regex
- "^ *\\([^ \n\t][^:#= \t\n]*\\)[ \t]*\\(?:!=[ \t]*\\(\\(?:.+\\\\\n\\)*.+\\)\\|[*:+]?[:?]?=[ \t]*\\(\\(?:.*\\\\\n\\)*.*\\)\\)"
+ "^ *\\([^ \n\t][^:#= \t\n]*\\)[ \t]*\\(?:!=\\|[*:+]?[:?]?=\\)"
"Regex used to find macro assignment lines in a makefile.")
(defconst makefile-var-use-regex
@@ -1704,6 +1704,19 @@ matched in a rule action."
(when (save-excursion
(beginning-of-line)
(looking-at makefile-dependency-regex))
+ (save-excursion
+ (let ((deps-end (match-end 1))
+ (match-data (match-data)))
+ (goto-char deps-end)
+ (skip-chars-backward " \t")
+ (setq deps-end (point))
+ (beginning-of-line)
+ (skip-chars-forward " \t")
+ ;; Alter the bounds recorded for subexp 1,
+ ;; which is what is supposed to match the targets.
+ (setcar (nthcdr 2 match-data) (point))
+ (setcar (nthcdr 3 match-data) deps-end)
+ (store-match-data match-data)))
(end-of-line)
(throw 'found (point)))))
(goto-char pt))