Mercurial > emacs
changeset 28277:18aaefd4bc8f
(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.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Thu, 23 Mar 2000 02:37:44 +0000 |
parents | ed584c7fa703 |
children | 85db5c5cde20 |
files | lisp/progmodes/make-mode.el |
diffstat | 1 files changed, 8 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/progmodes/make-mode.el Wed Mar 22 23:18:10 2000 +0000 +++ b/lisp/progmodes/make-mode.el Thu Mar 23 02:37:44 2000 +0000 @@ -1344,20 +1344,14 @@ ;;; ------------------------------------------------------------ (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)))))))))