comparison lisp/modes/make-mode.el @ 70:131b0175ea99 r20-0b30

Import from CVS: tag r20-0b30
author cvs
date Mon, 13 Aug 2007 09:02:59 +0200
parents 859a2309aef8
children 1ce6082ce73f
comparison
equal deleted inserted replaced
69:804d1389bcd6 70:131b0175ea99
158 "If non-nil, automatically clean up continuation lines when saving. 158 "If non-nil, automatically clean up continuation lines when saving.
159 A line is cleaned up by removing all whitespace following a trailing 159 A line is cleaned up by removing all whitespace following a trailing
160 backslash. This is done silently. 160 backslash. This is done silently.
161 IMPORTANT: Please note that enabling this option causes makefile-mode 161 IMPORTANT: Please note that enabling this option causes makefile-mode
162 to MODIFY A FILE WITHOUT YOUR CONFIRMATION when \'it seems necessary\'.") 162 to MODIFY A FILE WITHOUT YOUR CONFIRMATION when \'it seems necessary\'.")
163
164 ;;; those suspicious line warnings are really annoying and
165 ;;; seem to be generated for every makefile I've ever seen.
166 ;;; add a simple mechanism to disable them. -gk
167 (defvar makefile-warn-suspicious-lines-p t
168 "In non-nil, warn about suspicious lines when saving the makefile")
169 163
170 (defvar makefile-browser-hook '()) 164 (defvar makefile-browser-hook '())
171 165
172 ;; 166 ;;
173 ;; Special targets for DMake, Sun's make ... 167 ;; Special targets for DMake, Sun's make ...
623 Anywhere else just self-inserts." 617 Anywhere else just self-inserts."
624 (interactive "p") 618 (interactive "p")
625 (makefile-pickup-macros) 619 (makefile-pickup-macros)
626 (if (bolp) 620 (if (bolp)
627 (call-interactively 'makefile-insert-macro) 621 (call-interactively 'makefile-insert-macro)
628 (self-insert-command arg) 622 (self-insert-command arg)))
629 ;; from here down is new -- if they inserted a macro without using
630 ;; the electric behavior, pick it up anyway -gk
631 (save-excursion
632 (beginning-of-line)
633 (if (looking-at makefile-macroassign-regex)
634 (makefile-add-this-line-macro)))))
635 623
636 (defun makefile-insert-macro (macro-name) 624 (defun makefile-insert-macro (macro-name)
637 "Prepare definition of a new macro." 625 "Prepare definition of a new macro."
638 (interactive "sMacro Name: ") 626 (interactive "sMacro Name: ")
639 (makefile-pickup-macros) 627 (makefile-pickup-macros)
729 "Notice names of all macro definitions in Makefile." 717 "Notice names of all macro definitions in Makefile."
730 (interactive) 718 (interactive)
731 (if (not makefile-need-macro-pickup) 719 (if (not makefile-need-macro-pickup)
732 nil 720 nil
733 (setq makefile-need-macro-pickup nil) 721 (setq makefile-need-macro-pickup nil)
734 ;; changed the nil in the next line to makefile-runtime-macros-list 722 (setq makefile-macro-table nil)
735 ;; so you don't have to confirm on every runtime macro entered... -gk
736 (setq makefile-macro-table makefile-runtime-macros-list)
737 (save-excursion 723 (save-excursion
738 (goto-char (point-min)) 724 (goto-char (point-min))
739 (while (re-search-forward makefile-macroassign-regex (point-max) t) 725 (while (re-search-forward makefile-macroassign-regex (point-max) t)
740 (makefile-add-this-line-macro) 726 (makefile-add-this-line-macro)
741 (forward-line 1))) 727 (forward-line 1)))
944 makefile-browser-unselected-mark) 930 makefile-browser-unselected-mark)
945 "%s%s") 931 "%s%s")
946 target makefile-target-colon)) 932 target makefile-target-colon))
947 933
948 (defun makefile-browser-format-macro-line (macro selected) 934 (defun makefile-browser-format-macro-line (macro selected)
935 (format
949 (concat (make-string makefile-browser-leftmost-column ?\ ) 936 (concat (make-string makefile-browser-leftmost-column ?\ )
950 (if selected 937 (if selected
951 makefile-browser-selected-mark 938 makefile-browser-selected-mark
952 makefile-browser-unselected-mark) 939 makefile-browser-unselected-mark)
953 (makefile-format-macro-ref macro))) 940 (makefile-format-macro-ref macro))))
954 941
955 (defun makefile-browser-fill (targets macros) 942 (defun makefile-browser-fill (targets macros)
956 (let ((inhibit-read-only t)) 943 (let ((inhibit-read-only t))
957 (goto-char (point-min)) 944 (goto-char (point-min))
958 (erase-buffer) 945 (erase-buffer)
1105 (interactive) 1092 (interactive)
1106 (run-hooks 'makefile-browser-hook) 1093 (run-hooks 'makefile-browser-hook)
1107 (setq makefile-browser-client (current-buffer)) 1094 (setq makefile-browser-client (current-buffer))
1108 (makefile-pickup-targets) 1095 (makefile-pickup-targets)
1109 (makefile-pickup-macros) 1096 (makefile-pickup-macros)
1110 (makefile-browse makefile-target-table 1097 (makefile-browse makefile-target-table makefile-macro-table))
1111 ;; take out the runtime macros which were added for completion sake -gk
1112 (set-difference makefile-macro-table makefile-runtime-macros-list)))
1113 1098
1114 1099
1115 1100
1116 ;;; ------------------------------------------------------------ 1101 ;;; ------------------------------------------------------------
1117 ;;; Up-to-date overview buffer 1102 ;;; Up-to-date overview buffer
1233 ;;; Warn of suspicious lines 1218 ;;; Warn of suspicious lines
1234 ;;; ------------------------------------------------------------ 1219 ;;; ------------------------------------------------------------
1235 1220
1236 (defun makefile-warn-suspicious-lines () 1221 (defun makefile-warn-suspicious-lines ()
1237 (let ((dont-save nil)) 1222 (let ((dont-save nil))
1238 (if (and (eq major-mode 'makefile-mode) 1223 (if (eq major-mode 'makefile-mode)
1239 makefile-warn-suspicious-lines-p) ; -gk
1240 (let ((suspicious 1224 (let ((suspicious
1241 (save-excursion 1225 (save-excursion
1242 (goto-char (point-min)) 1226 (goto-char (point-min))
1243 (re-search-forward 1227 (re-search-forward
1244 "\\(^[\t]+$\\)\\|\\(^[ ]+[\t]\\)" (point-max) t)))) 1228 "\\(^[\t]+$\\)\\|\\(^[ ]+[\t]\\)" (point-max) t))))