From 68049bfad7e77372e824e91832864cabc1111df0 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 23 Mar 2000 02:39:58 +0000 Subject: [PATCH] (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. --- lisp/ChangeLog | 6 ++++++ lisp/progmodes/make-mode.el | 22 ++++++++-------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 99209b23efe..77b0671a899 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2000-03-22 Stefan Monnier + + * 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 * w32-fns.el (w32-charset-info-alist): Initialize. diff --git a/lisp/progmodes/make-mode.el b/lisp/progmodes/make-mode.el index c4265252b9a..b2d50413fb4 100644 --- a/lisp/progmodes/make-mode.el +++ b/lisp/progmodes/make-mode.el @@ -1344,20 +1344,14 @@ and generates the overview, one line per target name." ;;; ------------------------------------------------------------ (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))))))))) -- 2.39.5