unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] Add buffer name option for project-compile
@ 2021-04-11 23:19 Ivan Sokolov
  2021-04-12  8:13 ` Philip Kaludercic
  2021-04-23  0:17 ` Dmitry Gutov
  0 siblings, 2 replies; 6+ messages in thread
From: Ivan Sokolov @ 2021-04-11 23:19 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 217 bytes --]

I suggest adding a separate buffer name variable for project-compile command.
This will allow users to have compile buffers for each project. Although it is already possible it requires a complex buffer name function.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: project-compilation-buffer-name.patch --]
[-- Type: text/x-diff; name="project-compilation-buffer-name.patch", Size: 1345 bytes --]

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index b6a886f731..f5efeb2a84 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -980,12 +980,31 @@ project-query-replace-regexp
 (defvar compilation-read-command)
 (declare-function compilation-read-command "compile")
 
+(defun project--compilation-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 compilation buffer.
+If present it overrides `compilation-buffer-name-function' for
+`project-compile'."
+  :group 'project
+  :type '(choice (const :tag "None" nil)
+                 (function project-compilation-buffer-name)))
+
 ;;;###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 ()

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-04-23  6:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-11 23:19 [PATCH] Add buffer name option for project-compile Ivan Sokolov
2021-04-12  8:13 ` Philip Kaludercic
2021-04-12 10:34   ` Ivan Sokolov
2021-04-23  0:17 ` Dmitry Gutov
2021-04-23  3:09   ` Ivan Sokolov
2021-04-23  6:14     ` [PATCH] " Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).