changeset 17866:7d458582345c

(compilation-parse-errors): Fix paren error. (compilation-arguments): New local variable. (compile-internal): Set the variable compilation-arguments. (compilation-revert-buffer): New function. (compilation-mode): Set revert-buffer-function.
author Richard M. Stallman <rms@gnu.org>
date Mon, 19 May 1997 01:04:04 +0000
parents bbcdcb97c227
children 4b87104dcbc7
files lisp/progmodes/compile.el
diffstat 1 files changed, 20 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/progmodes/compile.el	Mon May 19 01:03:02 1997 +0000
+++ b/lisp/progmodes/compile.el	Mon May 19 01:04:04 1997 +0000
@@ -133,6 +133,9 @@
 (defvar compilation-error-message "No more errors"
   "Message to print when no more matches are found.")
 
+(defvar compilation-arguments nil
+  "Arguments that were given to `compile-internal'.")
+
 (defvar compilation-num-errors-found)
 
 (defvar compilation-error-regexp-alist
@@ -627,6 +630,12 @@
 	     file-regexp-alist)
 	(set (make-local-variable 'compilation-nomessage-regexp-alist)
 	     nomessage-regexp-alist)
+	(set (make-local-variable 'compilation-arguments)
+	     (list command error-message
+		   name-of-mode parser
+		   error-regexp-alist name-function
+		   enter-regexp-alist leave-regexp-alist
+		   file-regexp-alist nomessage-regexp-alist))
 	(setq default-directory thisdir
 	      compilation-directory-stack (list default-directory))
 	(set-window-start outwin (point-min))
@@ -774,8 +783,14 @@
   (compilation-setup)
   (set (make-local-variable 'font-lock-defaults)
        '(compilation-mode-font-lock-keywords t))
+  (set (make-local-variable 'revert-buffer-function)
+       'compilation-revert-buffer)
   (run-hooks 'compilation-mode-hook))
 
+(defun compilation-revert-buffer (ignore-auto noconfirm)
+  (if (or noconfirm (yes-or-no-p (format "Restart compilation? ")))
+      (apply 'compile-internal compilation-arguments)))
+
 ;; Prepare the buffer for the compilation parsing commands to work.
 (defun compilation-setup ()
   ;; Make the buffer's mode line show process state.
@@ -1710,11 +1725,11 @@
 			 (setq compilation-directory-stack
 			       (cons filename compilation-directory-stack)
 			       default-directory filename)))
-		  (and (eq type 'leave
-			   stack
-			   (setq compilation-directory-stack (cdr stack))
-			   (setq stack (car compilation-directory-stack))
-			   (setq default-directory stack)))
+		  (and (eq type 'leave)
+		       stack
+		       (setq compilation-directory-stack (cdr stack))
+		       (setq stack (car compilation-directory-stack))
+		       (setq default-directory stack))
 		  (goto-char end-of-match) ; Prepare to look at next message.
 		  (and limit-search (>= end-of-match limit-search)
 		       ;; The user wanted a specific error, and we're past it.