changeset 48018:1117d26eaae0

(makefile-cleanup-continuations): Default for variable is nil. (makefile-warn-continuations): New function. (makefile-mode): Put it on write-file-functions.
author Richard M. Stallman <rms@gnu.org>
date Sat, 26 Oct 2002 22:49:12 +0000
parents 566c23297078
children ed648a134b7e
files lisp/progmodes/make-mode.el
diffstat 1 files changed, 13 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/progmodes/make-mode.el	Sat Oct 26 22:43:02 2002 +0000
+++ b/lisp/progmodes/make-mode.el	Sat Oct 26 22:49:12 2002 +0000
@@ -192,7 +192,7 @@
   :type 'boolean
   :group 'makefile)
 
-(defcustom makefile-cleanup-continuations t
+(defcustom makefile-cleanup-continuations nil
   "*If non-nil, automatically clean up continuation lines when saving.
 A line is cleaned up by removing all whitespace following a trailing
 backslash.  This is done silently.
@@ -568,6 +568,8 @@
   (add-hook 'write-file-functions
 	    'makefile-warn-suspicious-lines nil t)
   (add-hook 'write-file-functions
+	    'makefile-warn-continuations nil t)
+  (add-hook 'write-file-functions
 	    'makefile-cleanup-continuations nil t)
   (make-local-variable 'makefile-target-table)
   (make-local-variable 'makefile-macro-table)
@@ -1384,9 +1386,17 @@
 	(goto-char (point-min))
 	(if (re-search-forward "^\\(\t+$\\| +\t\\)" nil t)
 	    (not (y-or-n-p
-		  (format "Suspicious line %d. Save anyway "
+		  (format "Suspicious line %d. Save anyway? "
 			  (count-lines (point-min) (point)))))))))
-	  
+
+(defun makefile-warn-continuations ()
+  (if (eq major-mode 'makefile-mode)
+      (save-excursion
+	(goto-char (point-min))
+	(if (re-search-forward "\\\\[ \t]+$")
+	    (not (y-or-n-p
+		  (format "Suspicious continuation in line %d. Save anyway? "
+			  (count-lines (point-min) (point)))))))))
 
 
 ;;; ------------------------------------------------------------