Mercurial > emacs
comparison lisp/progmodes/compile.el @ 39602:8c4c4c89b007
(compilation-buffer-name): New function.
(compile-internal): Use it to determine the name of the
compilation buffer.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Fri, 05 Oct 2001 12:43:13 +0000 |
parents | 56800ba6a856 |
children | 81c88c75006b |
comparison
equal
deleted
inserted
replaced
39601:fc4fb819666e | 39602:8c4c4c89b007 |
---|---|
741 visible rather than the begining." | 741 visible rather than the begining." |
742 :type 'boolean | 742 :type 'boolean |
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 |
749 enter-regexp-alist leave-regexp-alist | 769 enter-regexp-alist leave-regexp-alist |
750 file-regexp-alist nomessage-regexp-alist) | 770 file-regexp-alist nomessage-regexp-alist) |
770 (let (outbuf) | 790 (let (outbuf) |
771 (save-excursion | 791 (save-excursion |
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 |
783 (if (or (not (eq (process-status comp-proc) 'run)) | 800 (if (or (not (eq (process-status comp-proc) 'run)) |
784 (yes-or-no-p | 801 (yes-or-no-p |