comparison lisp/progmodes/compile.el @ 65783:a2cbf1cc9c6d

(compilation-buffer-name): New arg MODE-COMMAND. (compilation-start): Pass new arg to compilation-buffer-name. (compile-goto-error): Use next-error-internal.
author Richard M. Stallman <rms@gnu.org>
date Sun, 02 Oct 2005 03:33:18 +0000
parents 77732e123c4e
children cbc600deccb5
comparison
equal deleted inserted replaced
65782:d88ec92a0f15 65783:a2cbf1cc9c6d
897 :type 'boolean 897 :type 'boolean
898 :version "20.3" 898 :version "20.3"
899 :group 'compilation) 899 :group 'compilation)
900 900
901 901
902 (defun compilation-buffer-name (mode-name name-function) 902 (defun compilation-buffer-name (mode-name mode-command name-function)
903 "Return the name of a compilation buffer to use. 903 "Return the name of a compilation buffer to use.
904 If NAME-FUNCTION is non-nil, call it with one argument MODE-NAME 904 If NAME-FUNCTION is non-nil, call it with one argument MODE-NAME
905 to determine the buffer name. 905 to determine the buffer name.
906 Likewise if `compilation-buffer-name-function' is non-nil. 906 Likewise if `compilation-buffer-name-function' is non-nil.
907 If current buffer is in Compilation mode for the same mode name 907 If current buffer is the mode MODE-COMMAND,
908 return the name of the current buffer, so that it gets reused. 908 return the name of the current buffer, so that it gets reused.
909 Otherwise, construct a buffer name from MODE-NAME." 909 Otherwise, construct a buffer name from MODE-NAME."
910 (cond (name-function 910 (cond (name-function
911 (funcall name-function mode-name)) 911 (funcall name-function mode-name))
912 (compilation-buffer-name-function 912 (compilation-buffer-name-function
913 (funcall compilation-buffer-name-function mode-name)) 913 (funcall compilation-buffer-name-function mode-name))
914 ((eq major-mode (nth 1 compilation-arguments)) 914 ((and (eq mode-command major-mode)
915 (eq major-mode (nth 1 compilation-arguments)))
915 (buffer-name)) 916 (buffer-name))
916 (t 917 (t
917 (concat "*" (downcase mode-name) "*")))) 918 (concat "*" (downcase mode-name) "*"))))
918 919
919 ;; This is a rough emulation of the old hack, until the transition to new 920 ;; This is a rough emulation of the old hack, until the transition to new
958 (thisdir default-directory) 959 (thisdir default-directory)
959 outwin outbuf) 960 outwin outbuf)
960 (with-current-buffer 961 (with-current-buffer
961 (setq outbuf 962 (setq outbuf
962 (get-buffer-create 963 (get-buffer-create
963 (compilation-buffer-name name-of-mode name-function))) 964 (compilation-buffer-name name-of-mode mode name-function)))
964 (let ((comp-proc (get-buffer-process (current-buffer)))) 965 (let ((comp-proc (get-buffer-process (current-buffer))))
965 (if comp-proc 966 (if comp-proc
966 (if (or (not (eq (process-status comp-proc) 'run)) 967 (if (or (not (eq (process-status comp-proc) 'run))
967 (yes-or-no-p 968 (yes-or-no-p
968 (format "A %s process is running; kill it? " 969 (format "A %s process is running; kill it? "
1550 (error "Not in a compilation buffer")) 1551 (error "Not in a compilation buffer"))
1551 (if (get-text-property (point) 'directory) 1552 (if (get-text-property (point) 'directory)
1552 (dired-other-window (car (get-text-property (point) 'directory))) 1553 (dired-other-window (car (get-text-property (point) 'directory)))
1553 (push-mark) 1554 (push-mark)
1554 (setq compilation-current-error (point)) 1555 (setq compilation-current-error (point))
1555 (next-error 0))) 1556 (next-error-internal))))
1556 1557
1557 ;; Return a compilation buffer. 1558 ;; Return a compilation buffer.
1558 ;; If the current buffer is a compilation buffer, return it. 1559 ;; If the current buffer is a compilation buffer, return it.
1559 ;; Otherwise, look for a compilation buffer and signal an error 1560 ;; Otherwise, look for a compilation buffer and signal an error
1560 ;; if there are none. 1561 ;; if there are none.