comparison lisp/modes/make-mode.el @ 14:9ee227acff29 r19-15b90

Import from CVS: tag r19-15b90
author cvs
date Mon, 13 Aug 2007 08:48:42 +0200
parents ac2d302a0011
children d95e72db5c07
comparison
equal deleted inserted replaced
13:13c6d0aaafe5 14:9ee227acff29
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")
163 169
164 (defvar makefile-browser-hook '()) 170 (defvar makefile-browser-hook '())
165 171
166 ;; 172 ;;
167 ;; Special targets for DMake, Sun's make ... 173 ;; Special targets for DMake, Sun's make ...
617 Anywhere else just self-inserts." 623 Anywhere else just self-inserts."
618 (interactive "p") 624 (interactive "p")
619 (makefile-pickup-macros) 625 (makefile-pickup-macros)
620 (if (bolp) 626 (if (bolp)
621 (call-interactively 'makefile-insert-macro) 627 (call-interactively 'makefile-insert-macro)
622 (self-insert-command arg))) 628 (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)))))
623 635
624 (defun makefile-insert-macro (macro-name) 636 (defun makefile-insert-macro (macro-name)
625 "Prepare definition of a new macro." 637 "Prepare definition of a new macro."
626 (interactive "sMacro Name: ") 638 (interactive "sMacro Name: ")
627 (makefile-pickup-macros) 639 (makefile-pickup-macros)
717 "Notice names of all macro definitions in Makefile." 729 "Notice names of all macro definitions in Makefile."
718 (interactive) 730 (interactive)
719 (if (not makefile-need-macro-pickup) 731 (if (not makefile-need-macro-pickup)
720 nil 732 nil
721 (setq makefile-need-macro-pickup nil) 733 (setq makefile-need-macro-pickup nil)
722 (setq makefile-macro-table nil) 734 ;; changed the nil in the next line to makefile-runtime-macros-list
735 ;; so you don't have to confirm on every runtime macro entered... -gk
736 (setq makefile-macro-table makefile-runtime-macros-list)
723 (save-excursion 737 (save-excursion
724 (goto-char (point-min)) 738 (goto-char (point-min))
725 (while (re-search-forward makefile-macroassign-regex (point-max) t) 739 (while (re-search-forward makefile-macroassign-regex (point-max) t)
726 (makefile-add-this-line-macro) 740 (makefile-add-this-line-macro)
727 (forward-line 1))) 741 (forward-line 1)))
1218 ;;; Warn of suspicious lines 1232 ;;; Warn of suspicious lines
1219 ;;; ------------------------------------------------------------ 1233 ;;; ------------------------------------------------------------
1220 1234
1221 (defun makefile-warn-suspicious-lines () 1235 (defun makefile-warn-suspicious-lines ()
1222 (let ((dont-save nil)) 1236 (let ((dont-save nil))
1223 (if (eq major-mode 'makefile-mode) 1237 (if (and (eq major-mode 'makefile-mode)
1238 makefile-warn-suspicious-lines-p) ; -gk
1224 (let ((suspicious 1239 (let ((suspicious
1225 (save-excursion 1240 (save-excursion
1226 (goto-char (point-min)) 1241 (goto-char (point-min))
1227 (re-search-forward 1242 (re-search-forward
1228 "\\(^[\t]+$\\)\\|\\(^[ ]+[\t]\\)" (point-max) t)))) 1243 "\\(^[\t]+$\\)\\|\\(^[ ]+[\t]\\)" (point-max) t))))