diff options
| author | Gerd Moellmann | 2001-10-05 12:43:13 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2001-10-05 12:43:13 +0000 |
| commit | 7bdb67b2b38fec58469658b93bcf6f6ecaf69ea3 (patch) | |
| tree | 7aa195822ef038d0bc8944ff8c80b8e9479dc27e | |
| parent | 5b78d3856cf6532728f1aa85b40466ccf3d1501e (diff) | |
| download | emacs-7bdb67b2b38fec58469658b93bcf6f6ecaf69ea3.tar.gz emacs-7bdb67b2b38fec58469658b93bcf6f6ecaf69ea3.zip | |
(compilation-buffer-name): New function.
(compile-internal): Use it to determine the name of the
compilation buffer.
| -rw-r--r-- | lisp/progmodes/compile.el | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 27fbe66fe86..b972adea767 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el | |||
| @@ -743,6 +743,26 @@ visible rather than the begining." | |||
| 743 | :version "20.3" | 743 | :version "20.3" |
| 744 | :group 'compilation) | 744 | :group 'compilation) |
| 745 | 745 | ||
| 746 | |||
| 747 | (defun compilation-buffer-name (mode-name name-function) | ||
| 748 | "Return the name of a compilation buffer to use. | ||
| 749 | If NAME-FUNCTION is non-nil, call it with one argument MODE-NAME | ||
| 750 | to determine the buffer name. | ||
| 751 | Likewise if `compilation-buffer-name-function' is non-nil. | ||
| 752 | If current buffer is in Compilation mode for the same mode name | ||
| 753 | return the name of the current buffer, so that it gets reused. | ||
| 754 | Otherwise, construct a buffer name from MODE-NAME." | ||
| 755 | (cond (name-function | ||
| 756 | (funcall name-function mode-name)) | ||
| 757 | (compilation-buffer-name-function | ||
| 758 | (funcall compilation-buffer-name-function mode-name)) | ||
| 759 | ((and (eq major-mode 'compilation-mode) | ||
| 760 | (equal mode-name (nth 2 compilation-arguments))) | ||
| 761 | (buffer-name)) | ||
| 762 | (t | ||
| 763 | (concat "*" (downcase mode-name) "*")))) | ||
| 764 | |||
| 765 | |||
| 746 | (defun compile-internal (command error-message | 766 | (defun compile-internal (command error-message |
| 747 | &optional name-of-mode parser | 767 | &optional name-of-mode parser |
| 748 | error-regexp-alist name-function | 768 | error-regexp-alist name-function |
| @@ -772,11 +792,8 @@ Returns the compilation buffer created." | |||
| 772 | (or name-of-mode | 792 | (or name-of-mode |
| 773 | (setq name-of-mode "Compilation")) | 793 | (setq name-of-mode "Compilation")) |
| 774 | (setq outbuf | 794 | (setq outbuf |
| 775 | (get-buffer-create | 795 | (get-buffer-create (compilation-buffer-name name-of-mode |
| 776 | (funcall (or name-function compilation-buffer-name-function | 796 | name-function))) |
| 777 | (function (lambda (mode) | ||
| 778 | (concat "*" (downcase mode) "*")))) | ||
| 779 | name-of-mode))) | ||
| 780 | (set-buffer outbuf) | 797 | (set-buffer outbuf) |
| 781 | (let ((comp-proc (get-buffer-process (current-buffer)))) | 798 | (let ((comp-proc (get-buffer-process (current-buffer)))) |
| 782 | (if comp-proc | 799 | (if comp-proc |