+2000-03-22 Stefan Monnier <monnier@cs.yale.edu>
+
+ * progmodes/make-mode.el (makefile-warn-suspicious-lines): clean
+ up the code and the regexp and make sure the cursor is temporarily
+ moved to the suspicious line while querying the user.
+
2000-03-22 Jason Rumney <jasonr@gnu.org>
* w32-fns.el (w32-charset-info-alist): Initialize.
;;; ------------------------------------------------------------
(defun makefile-warn-suspicious-lines ()
- (let ((dont-save nil))
- (if (eq major-mode 'makefile-mode)
- (let ((suspicious
- (save-excursion
- (goto-char (point-min))
- (re-search-forward
- "\\(^[\t]+$\\)\\|\\(^[ ]+[\t]\\)" (point-max) t))))
- (if suspicious
- (let ((line-nr (count-lines (point-min) suspicious)))
- (setq dont-save
- (not (y-or-n-p
- (format "Suspicious line %d. Save anyway "
- line-nr))))))))
- dont-save))
+ ;; Returning non-nil cancels the save operation
+ (if (eq major-mode 'makefile-mode)
+ (save-excursion
+ (goto-char (point-min))
+ (if (re-search-forward "^\\(\t+$\\| +\t\\)" nil t)
+ (not (y-or-n-p
+ (format "Suspicious line %d. Save anyway "
+ (count-lines (point-min) (point)))))))))
\f