aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/make-mode.el
diff options
context:
space:
mode:
authorMiles Bader2006-06-07 18:05:10 +0000
committerMiles Bader2006-06-07 18:05:10 +0000
commitb883cdb2fefa8ea9c3b0d82eba7a9ee792f871bb (patch)
treede3804210a8cd955e0d3b9abc15679480930bc82 /lisp/progmodes/make-mode.el
parent885b7d0991bd4b4b8f4bd1d3cd21c18a697bbce2 (diff)
parent26c9afc3239e18b03537faaea33e3e82e28099e6 (diff)
downloademacs-b883cdb2fefa8ea9c3b0d82eba7a9ee792f871bb.tar.gz
emacs-b883cdb2fefa8ea9c3b0d82eba7a9ee792f871bb.zip
Merge from emacs--devo--0
Patches applied: * emacs--devo--0 (patch 285-296) - Update from CVS - Merge from gnus--rel--5.10 - Update from CVS: admin/FOR-RELEASE: Update refcard section. * gnus--rel--5.10 (patch 102-104) - Update from CVS Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-64
Diffstat (limited to 'lisp/progmodes/make-mode.el')
-rw-r--r--lisp/progmodes/make-mode.el128
1 files changed, 60 insertions, 68 deletions
diff --git a/lisp/progmodes/make-mode.el b/lisp/progmodes/make-mode.el
index 3bbfeaac683..d22aedb6058 100644
--- a/lisp/progmodes/make-mode.el
+++ b/lisp/progmodes/make-mode.el
@@ -246,6 +246,7 @@ You will be offered to complete on one of those in the minibuffer whenever
246you enter a \".\" at the beginning of a line in `makefile-mode'." 246you enter a \".\" at the beginning of a line in `makefile-mode'."
247 :type '(repeat (list string)) 247 :type '(repeat (list string))
248 :group 'makefile) 248 :group 'makefile)
249(put 'makefile-special-targets-list 'risky-local-variable t)
249 250
250(defcustom makefile-runtime-macros-list 251(defcustom makefile-runtime-macros-list
251 '(("@") ("&") (">") ("<") ("*") ("^") ("+") ("?") ("%") ("$")) 252 '(("@") ("&") (">") ("<") ("*") ("^") ("+") ("?") ("%") ("$"))
@@ -290,6 +291,9 @@ not be enclosed in { } or ( )."
290;; that if you change this regexp you might have to fix the imenu index in 291;; that if you change this regexp you might have to fix the imenu index in
291;; makefile-imenu-generic-expression. 292;; makefile-imenu-generic-expression.
292(defconst makefile-macroassign-regex 293(defconst makefile-macroassign-regex
294 ;; We used to match not just the varname but also the whole value
295 ;; (spanning potentially several lines).
296 ;; "^ *\\([^ \n\t][^:#= \t\n]*\\)[ \t]*\\(?:!=[ \t]*\\(\\(?:.+\\\\\n\\)*.+\\)\\|[*:+]?[:?]?=[ \t]*\\(\\(?:.*\\\\\n\\)*.*\\)\\)"
293 "^ *\\([^ \n\t][^:#= \t\n]*\\)[ \t]*\\(?:!=\\|[*:+]?[:?]?=\\)" 297 "^ *\\([^ \n\t][^:#= \t\n]*\\)[ \t]*\\(?:!=\\|[*:+]?[:?]?=\\)"
294 "Regex used to find macro assignment lines in a makefile.") 298 "Regex used to find macro assignment lines in a makefile.")
295 299
@@ -544,7 +548,8 @@ This should identify a `make' command that can handle the `-q' option."
544 :type 'string 548 :type 'string
545 :group 'makefile) 549 :group 'makefile)
546 550
547(defcustom makefile-query-one-target-method 'makefile-query-by-make-minus-q 551(defcustom makefile-query-one-target-method-function
552 'makefile-query-by-make-minus-q
548 "*Function to call to determine whether a make target is up to date. 553 "*Function to call to determine whether a make target is up to date.
549The function must satisfy this calling convention: 554The function must satisfy this calling convention:
550 555
@@ -560,6 +565,8 @@ The function must satisfy this calling convention:
560 makefile, any nonzero integer value otherwise." 565 makefile, any nonzero integer value otherwise."
561 :type 'function 566 :type 'function
562 :group 'makefile) 567 :group 'makefile)
568(defvaralias 'makefile-query-one-target-method
569 'makefile-query-one-target-method-function)
563 570
564(defcustom makefile-up-to-date-buffer-name "*Makefile Up-to-date overview*" 571(defcustom makefile-up-to-date-buffer-name "*Makefile Up-to-date overview*"
565 "*Name of the Up-to-date overview buffer." 572 "*Name of the Up-to-date overview buffer."
@@ -619,39 +626,38 @@ The function must satisfy this calling convention:
619 map) 626 map)
620 "The keymap that is used in Makefile mode.") 627 "The keymap that is used in Makefile mode.")
621 628
622(defvar makefile-browser-map nil 629
630(defvar makefile-browser-map
631 (let ((map (make-sparse-keymap)))
632 (define-key map "n" 'makefile-browser-next-line)
633 (define-key map "\C-n" 'makefile-browser-next-line)
634 (define-key map "p" 'makefile-browser-previous-line)
635 (define-key map "\C-p" 'makefile-browser-previous-line)
636 (define-key map " " 'makefile-browser-toggle)
637 (define-key map "i" 'makefile-browser-insert-selection)
638 (define-key map "I" 'makefile-browser-insert-selection-and-quit)
639 (define-key map "\C-c\C-m" 'makefile-browser-insert-continuation)
640 (define-key map "q" 'makefile-browser-quit)
641 ;; disable horizontal movement
642 (define-key map "\C-b" 'undefined)
643 (define-key map "\C-f" 'undefined)
644 map)
623 "The keymap that is used in the macro- and target browser.") 645 "The keymap that is used in the macro- and target browser.")
624(if makefile-browser-map 646
625 () 647
626 (setq makefile-browser-map (make-sparse-keymap)) 648(defvar makefile-mode-syntax-table
627 (define-key makefile-browser-map "n" 'makefile-browser-next-line) 649 (let ((st (make-syntax-table)))
628 (define-key makefile-browser-map "\C-n" 'makefile-browser-next-line) 650 (modify-syntax-entry ?\( "() " st)
629 (define-key makefile-browser-map "p" 'makefile-browser-previous-line) 651 (modify-syntax-entry ?\) ")( " st)
630 (define-key makefile-browser-map "\C-p" 'makefile-browser-previous-line) 652 (modify-syntax-entry ?\[ "(] " st)
631 (define-key makefile-browser-map " " 'makefile-browser-toggle) 653 (modify-syntax-entry ?\] ")[ " st)
632 (define-key makefile-browser-map "i" 'makefile-browser-insert-selection) 654 (modify-syntax-entry ?\{ "(} " st)
633 (define-key makefile-browser-map "I" 'makefile-browser-insert-selection-and-quit) 655 (modify-syntax-entry ?\} "){ " st)
634 (define-key makefile-browser-map "\C-c\C-m" 'makefile-browser-insert-continuation) 656 (modify-syntax-entry ?\' "\" " st)
635 (define-key makefile-browser-map "q" 'makefile-browser-quit) 657 (modify-syntax-entry ?\` "\" " st)
636 ;; disable horizontal movement 658 (modify-syntax-entry ?# "< " st)
637 (define-key makefile-browser-map "\C-b" 'undefined) 659 (modify-syntax-entry ?\n "> " st)
638 (define-key makefile-browser-map "\C-f" 'undefined)) 660 st))
639
640
641(defvar makefile-mode-syntax-table nil)
642(if makefile-mode-syntax-table
643 ()
644 (setq makefile-mode-syntax-table (make-syntax-table))
645 (modify-syntax-entry ?\( "() " makefile-mode-syntax-table)
646 (modify-syntax-entry ?\) ")( " makefile-mode-syntax-table)
647 (modify-syntax-entry ?\[ "(] " makefile-mode-syntax-table)
648 (modify-syntax-entry ?\] ")[ " makefile-mode-syntax-table)
649 (modify-syntax-entry ?\{ "(} " makefile-mode-syntax-table)
650 (modify-syntax-entry ?\} "){ " makefile-mode-syntax-table)
651 (modify-syntax-entry ?\' "\" " makefile-mode-syntax-table)
652 (modify-syntax-entry ?\` "\" " makefile-mode-syntax-table)
653 (modify-syntax-entry ?# "< " makefile-mode-syntax-table)
654 (modify-syntax-entry ?\n "> " makefile-mode-syntax-table))
655 661
656(defvar makefile-imake-mode-syntax-table (copy-syntax-table 662(defvar makefile-imake-mode-syntax-table (copy-syntax-table
657 makefile-mode-syntax-table)) 663 makefile-mode-syntax-table))
@@ -670,9 +676,11 @@ The function must satisfy this calling convention:
670 676
671(defvar makefile-target-table nil 677(defvar makefile-target-table nil
672 "Table of all target names known for this buffer.") 678 "Table of all target names known for this buffer.")
679(put 'makefile-target-table 'risky-local-variable t)
673 680
674(defvar makefile-macro-table nil 681(defvar makefile-macro-table nil
675 "Table of all macro names known for this buffer.") 682 "Table of all macro names known for this buffer.")
683(put 'makefile-macro-table 'risky-local-variable t)
676 684
677(defvar makefile-browser-client 685(defvar makefile-browser-client
678 "A buffer in Makefile mode that is currently using the browser.") 686 "A buffer in Makefile mode that is currently using the browser.")
@@ -724,11 +732,10 @@ The function must satisfy this calling convention:
724 732
725If you are editing a file for a different make, try one of the 733If you are editing a file for a different make, try one of the
726variants `makefile-automake-mode', `makefile-gmake-mode', 734variants `makefile-automake-mode', `makefile-gmake-mode',
727`makefile-makepp-mode', `makefile-bsdmake-mode' or, 735`makefile-makepp-mode', `makefile-bsdmake-mode' or,
728`makefile-imake-mode'All but the 736`makefile-imake-mode'. All but the last should be correctly
729last should be correctly chosen based on the file name, except if 737chosen based on the file name, except if it is *.mk. This
730it is *.mk. This function ends by invoking the function(s) 738function ends by invoking the function(s) `makefile-mode-hook'.
731`makefile-mode-hook'.
732 739
733It is strongly recommended to use `font-lock-mode', because that 740It is strongly recommended to use `font-lock-mode', because that
734provides additional parsing information. This is used for 741provides additional parsing information. This is used for
@@ -1298,29 +1305,8 @@ definition and conveniently use this command."
1298 (beginning-of-line) 1305 (beginning-of-line)
1299 (cond 1306 (cond
1300 ((looking-at "^#+") 1307 ((looking-at "^#+")
1301 ;; Found a comment. Set the fill prefix, and find the paragraph 1308 ;; Found a comment. Return nil to let normal filling take place.
1302 ;; boundaries by searching for lines that look like comment-only 1309 nil)
1303 ;; lines.
1304 (let ((fill-prefix (match-string-no-properties 0))
1305 (fill-paragraph-function nil))
1306 (save-excursion
1307 (save-restriction
1308 (narrow-to-region
1309 ;; Search backwards.
1310 (save-excursion
1311 (while (and (zerop (forward-line -1))
1312 (looking-at "^#")))
1313 ;; We may have gone too far. Go forward again.
1314 (or (looking-at "^#")
1315 (forward-line 1))
1316 (point))
1317 ;; Search forwards.
1318 (save-excursion
1319 (while (looking-at "^#")
1320 (forward-line))
1321 (point)))
1322 (fill-paragraph nil)
1323 t))))
1324 1310
1325 ;; Must look for backslashed-region before looking for variable 1311 ;; Must look for backslashed-region before looking for variable
1326 ;; assignment. 1312 ;; assignment.
@@ -1349,7 +1335,9 @@ definition and conveniently use this command."
1349 (makefile-backslash-region (point-min) (point-max) nil) 1335 (makefile-backslash-region (point-min) (point-max) nil)
1350 (goto-char (point-max)) 1336 (goto-char (point-max))
1351 (if (< (skip-chars-backward "\n") 0) 1337 (if (< (skip-chars-backward "\n") 0)
1352 (delete-region (point) (point-max)))))) 1338 (delete-region (point) (point-max)))))
1339 ;; Return non-nil to indicate it's been filled.
1340 t)
1353 1341
1354 ((looking-at makefile-macroassign-regex) 1342 ((looking-at makefile-macroassign-regex)
1355 ;; Have a macro assign. Fill just this line, and then backslash 1343 ;; Have a macro assign. Fill just this line, and then backslash
@@ -1358,10 +1346,13 @@ definition and conveniently use this command."
1358 (narrow-to-region (point) (line-beginning-position 2)) 1346 (narrow-to-region (point) (line-beginning-position 2))
1359 (let ((fill-paragraph-function nil)) 1347 (let ((fill-paragraph-function nil))
1360 (fill-paragraph nil)) 1348 (fill-paragraph nil))
1361 (makefile-backslash-region (point-min) (point-max) nil))))) 1349 (makefile-backslash-region (point-min) (point-max) nil))
1350 ;; Return non-nil to indicate it's been filled.
1351 t)
1362 1352
1363 ;; Always return non-nil so we don't fill anything else. 1353 (t
1364 t) 1354 ;; Return non-nil so we don't fill anything else.
1355 t))))
1365 1356
1366 1357
1367 1358
@@ -1616,7 +1607,8 @@ with the generated name!"
1616 1607
1617(defun makefile-query-targets (filename target-table prereq-list) 1608(defun makefile-query-targets (filename target-table prereq-list)
1618 "Fill the up-to-date overview buffer. 1609 "Fill the up-to-date overview buffer.
1619Checks each target in TARGET-TABLE using `makefile-query-one-target-method' 1610Checks each target in TARGET-TABLE using
1611`makefile-query-one-target-method-function'
1620and generates the overview, one line per target name." 1612and generates the overview, one line per target name."
1621 (insert 1613 (insert
1622 (mapconcat 1614 (mapconcat
@@ -1625,7 +1617,7 @@ and generates the overview, one line per target name."
1625 (no-prereqs (not (member target-name prereq-list))) 1617 (no-prereqs (not (member target-name prereq-list)))
1626 (needs-rebuild (or no-prereqs 1618 (needs-rebuild (or no-prereqs
1627 (funcall 1619 (funcall
1628 makefile-query-one-target-method 1620 makefile-query-one-target-method-function
1629 target-name 1621 target-name
1630 filename)))) 1622 filename))))
1631 (format "\t%s%s" 1623 (format "\t%s%s"
@@ -1876,5 +1868,5 @@ If it isn't in one, return nil."
1876 1868
1877(provide 'make-mode) 1869(provide 'make-mode)
1878 1870
1879;;; arch-tag: bd23545a-de91-44fb-b1b2-feafbb2635a0 1871;; arch-tag: bd23545a-de91-44fb-b1b2-feafbb2635a0
1880;;; make-mode.el ends here 1872;;; make-mode.el ends here