[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 1c3a86e: Introduce project-compilation-buffer-name-function
From: |
Dmitry Gutov |
Subject: |
master 1c3a86e: Introduce project-compilation-buffer-name-function |
Date: |
Thu, 22 Apr 2021 20:15:00 -0400 (EDT) |
branch: master
commit 1c3a86e7fc220963a1691462dbfa25b37799e287
Author: Ivan Sokolov <ivan-p-sokolov@ya.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>
Introduce project-compilation-buffer-name-function
* lisp/progmodes/project.el (project-compilation-buffer-name-function):
New option.
(project-compile): Use it.
(project-prefixed-buffer-name): New function.
Copyright-paperwork-exempt: yes
---
lisp/progmodes/project.el | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 1023b75..35ce5eb 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -994,12 +994,33 @@ loop using the command \\[fileloop-continue]."
(defvar compilation-read-command)
(declare-function compilation-read-command "compile")
+(defun project-prefixed-buffer-name (mode)
+ (concat "*"
+ (file-name-nondirectory
+ (directory-file-name default-directory))
+ "-"
+ (downcase mode)
+ "*"))
+
+(defcustom project-compilation-buffer-name-function nil
+ "Function to compute the name of a project compilation buffer.
+If non-nil, it overrides `compilation-buffer-name-function' for
+`project-compile'."
+ :group 'project
+ :type '(choice (const :tag "Default" nil)
+ (const :tag "Prefixed with root directory name"
+ project-prefixed-buffer-name)
+ (function :tag "Custom function")))
+
;;;###autoload
(defun project-compile ()
"Run `compile' in the project root."
(declare (interactive-only compile))
(interactive)
- (let ((default-directory (project-root (project-current t))))
+ (let ((default-directory (project-root (project-current t)))
+ (compilation-buffer-name-function
+ (or project-compilation-buffer-name-function
+ compilation-buffer-name-function)))
(call-interactively #'compile)))
(defun project--read-project-buffer ()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 1c3a86e: Introduce project-compilation-buffer-name-function,
Dmitry Gutov <=