all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ivan Sokolov <ivan-p-sokolov@ya.ru>
To: emacs-devel@gnu.org
Subject: [PATCH] Add buffer name option for project-compile
Date: Mon, 12 Apr 2021 02:19:03 +0300	[thread overview]
Message-ID: <29479451618183143@myt6-2b82e4d1fc0a.qloud-c.yandex.net> (raw)

[-- 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 ()

             reply	other threads:[~2021-04-11 23:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-11 23:19 Ivan Sokolov [this message]
2021-04-12  8:13 ` [PATCH] Add buffer name option for project-compile 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=29479451618183143@myt6-2b82e4d1fc0a.qloud-c.yandex.net \
    --to=ivan-p-sokolov@ya.ru \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.