Commit aa53db6a authored by Andreas Schwab's avatar Andreas Schwab
Browse files

* progmodes/compile.el (compilation-directory-stack): Doc fix.

(compilation-mode): Accept optional parameter and initialize
mode-name from it.
(compile-internal): Pass name-of-mode to compilation-mode.  Don't
set mode-name here.
(compilation-minor-mode): Don't let mode-line-process change.
(compilation-next-error-locus): Use forward-char instead of
move-to-column.
(compilation-parse-errors): Set default-directory from head of
compilation-directory-stack.
parent 5e0082a5
...@@ -450,7 +450,7 @@ You might also use mode hooks to specify it in certain modes, like this: ...@@ -450,7 +450,7 @@ You might also use mode hooks to specify it in certain modes, like this:
(defvar compilation-directory-stack nil (defvar compilation-directory-stack nil
"Stack of previous directories for `compilation-leave-directory-regexp'. "Stack of previous directories for `compilation-leave-directory-regexp'.
The head element is the directory the compilation was started in.") The last element is the directory the compilation was started in.")
(defvar compilation-exit-message-function nil "\ (defvar compilation-exit-message-function nil "\
If non-nil, called when a compilation process dies to return a status message. If non-nil, called when a compilation process dies to return a status message.
...@@ -678,7 +678,7 @@ Returns the compilation buffer created." ...@@ -678,7 +678,7 @@ Returns the compilation buffer created."
(setq outwin (display-buffer outbuf)) (setq outwin (display-buffer outbuf))
(save-excursion (save-excursion
(set-buffer outbuf) (set-buffer outbuf)
(compilation-mode) (compilation-mode name-of-mode)
;; (setq buffer-read-only t) ;;; Non-ergonomic. ;; (setq buffer-read-only t) ;;; Non-ergonomic.
(set (make-local-variable 'compilation-parse-errors-function) parser) (set (make-local-variable 'compilation-parse-errors-function) parser)
(set (make-local-variable 'compilation-error-message) error-message) (set (make-local-variable 'compilation-error-message) error-message)
...@@ -705,7 +705,6 @@ Returns the compilation buffer created." ...@@ -705,7 +705,6 @@ Returns the compilation buffer created."
(setq default-directory thisdir (setq default-directory thisdir
compilation-directory-stack (list default-directory)) compilation-directory-stack (list default-directory))
(set-window-start outwin (point-min)) (set-window-start outwin (point-min))
(setq mode-name name-of-mode)
(or (eq outwin (selected-window)) (or (eq outwin (selected-window))
(set-window-point outwin (point-min))) (set-window-point outwin (point-min)))
(compilation-set-window-height outwin) (compilation-set-window-height outwin)
...@@ -839,7 +838,7 @@ exited abnormally with code %d\n" ...@@ -839,7 +838,7 @@ exited abnormally with code %d\n"
(put 'compilation-mode 'mode-class 'special) (put 'compilation-mode 'mode-class 'special)
;;;###autoload ;;;###autoload
(defun compilation-mode () (defun compilation-mode (&optional name-of-mode)
"Major mode for compilation log buffers. "Major mode for compilation log buffers.
\\<compilation-mode-map>To visit the source for a line-numbered error, \\<compilation-mode-map>To visit the source for a line-numbered error,
move point to the error message line and type \\[compile-goto-error]. move point to the error message line and type \\[compile-goto-error].
...@@ -850,7 +849,7 @@ Runs `compilation-mode-hook' with `run-hooks' (which see)." ...@@ -850,7 +849,7 @@ Runs `compilation-mode-hook' with `run-hooks' (which see)."
(kill-all-local-variables) (kill-all-local-variables)
(use-local-map compilation-mode-map) (use-local-map compilation-mode-map)
(setq major-mode 'compilation-mode (setq major-mode 'compilation-mode
mode-name "Compilation") mode-name (or name-of-mode "Compilation"))
(compilation-setup) (compilation-setup)
(set (make-local-variable 'font-lock-defaults) (set (make-local-variable 'font-lock-defaults)
'(compilation-mode-font-lock-keywords t)) '(compilation-mode-font-lock-keywords t))
...@@ -912,7 +911,7 @@ Turning the mode on runs the normal hook `compilation-minor-mode-hook'." ...@@ -912,7 +911,7 @@ Turning the mode on runs the normal hook `compilation-minor-mode-hook'."
(if (setq compilation-minor-mode (if (null arg) (if (setq compilation-minor-mode (if (null arg)
(null compilation-minor-mode) (null compilation-minor-mode)
(> (prefix-numeric-value arg) 0))) (> (prefix-numeric-value arg) 0)))
(progn (let ((mode-line-process))
(compilation-setup) (compilation-setup)
(run-hooks 'compilation-minor-mode-hook)))) (run-hooks 'compilation-minor-mode-hook))))
...@@ -1441,7 +1440,7 @@ The current buffer should be the desired compilation output buffer." ...@@ -1441,7 +1440,7 @@ The current buffer should be the desired compilation output buffer."
(goto-line last-line) (goto-line last-line)
(if (and column (> column 0)) (if (and column (> column 0))
;; Columns in error msgs are 1-origin. ;; Columns in error msgs are 1-origin.
(move-to-column (1- column)) (forward-char (1- column))
(beginning-of-line)) (beginning-of-line))
(setcdr next-error (point-marker)) (setcdr next-error (point-marker))
;; Make all the other error messages referring ;; Make all the other error messages referring
...@@ -1465,7 +1464,7 @@ The current buffer should be the desired compilation output buffer." ...@@ -1465,7 +1464,7 @@ The current buffer should be the desired compilation output buffer."
lines)) lines))
(forward-line lines)) (forward-line lines))
(if (and column (> column 1)) (if (and column (> column 1))
(move-to-column (1- column)) (forward-char (1- column))
(beginning-of-line)) (beginning-of-line))
(setq last-line this) (setq last-line this)
(setcdr (car errors) (point-marker)))) (setcdr (car errors) (point-marker))))
...@@ -1624,7 +1623,7 @@ See variable `compilation-parse-errors-function' for the interface it uses." ...@@ -1624,7 +1623,7 @@ See variable `compilation-parse-errors-function' for the interface it uses."
(if (null compilation-error-regexp-alist) (if (null compilation-error-regexp-alist)
(error "compilation-error-regexp-alist is empty!")) (error "compilation-error-regexp-alist is empty!"))
(let* ((compilation-regexps nil) ; Variable set by compile-collect-regexps. (let* ((compilation-regexps nil) ; Variable set by compile-collect-regexps.
(default-directory default-directory) (default-directory (car compilation-directory-stack))
(found-desired nil) (found-desired nil)
(compilation-num-errors-found 0) (compilation-num-errors-found 0)
;; Set up now the expanded, abbreviated directory variables ;; Set up now the expanded, abbreviated directory variables
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment