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

* Re: [PATCH] Add buffer name option for project-compile
  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
  1 sibling, 1 reply; 6+ messages in thread
From: Philip Kaludercic @ 2021-04-12  8:13 UTC (permalink / raw)
  To: Ivan Sokolov; +Cc: emacs-devel

Ivan Sokolov <ivan-p-sokolov@ya.ru> writes:

> +(defun project--compilation-buffer-name (mode)
> +  (concat "*"
> +          (file-name-nondirectory
> +           (directory-file-name default-directory))

Should this be the default directory or the project root?

> +          "-"
> +          (downcase mode)
> +          "*"))

-- 
	Philip K.



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

* Re: [PATCH] Add buffer name option for project-compile
  2021-04-12  8:13 ` Philip Kaludercic
@ 2021-04-12 10:34   ` Ivan Sokolov
  0 siblings, 0 replies; 6+ messages in thread
From: Ivan Sokolov @ 2021-04-12 10:34 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: emacs-devel



On April 12, 2021 8:13:44 AM UTC, Philip Kaludercic <philipk@posteo.net> wrote:
>Ivan Sokolov <ivan-p-sokolov@ya.ru> writes:
>
>> +(defun project--compilation-buffer-name (mode)
>> +  (concat "*"
>> +          (file-name-nondirectory
>> +           (directory-file-name default-directory))
>
>Should this be the default directory or the project root?

project-compile sets the default directory to the project root

>> +          "-"
>> +          (downcase mode)
>> +          "*"))



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

* Re: [PATCH] Add buffer name option for project-compile
  2021-04-11 23:19 [PATCH] Add buffer name option for project-compile Ivan Sokolov
  2021-04-12  8:13 ` Philip Kaludercic
@ 2021-04-23  0:17 ` Dmitry Gutov
  2021-04-23  3:09   ` Ivan Sokolov
  1 sibling, 1 reply; 6+ messages in thread
From: Dmitry Gutov @ 2021-04-23  0:17 UTC (permalink / raw)
  To: Ivan Sokolov, emacs-devel

Hi Ivan,

On 12.04.2021 02:19, Ivan Sokolov wrote:
> 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.

Thanks for the patch, I've pushed it with some tweaks in commit 1c3a86e7fc.

Note that with it you have reached the allowed amount of contribution 
without copyright assignment. Please let us know if you'd like to get 
that process started now, to remote limitations on future patches.



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

* Re:[PATCH] Add buffer name option for project-compile
  2021-04-23  0:17 ` Dmitry Gutov
@ 2021-04-23  3:09   ` Ivan Sokolov
  2021-04-23  6:14     ` [PATCH] " Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Ivan Sokolov @ 2021-04-23  3:09 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: emacs-devel

> Note that with it you have reached the allowed amount of contribution
> without copyright assignment. Please let us know if you'd like to get
> that process started now, to remote limitations on future patches.

Yes, I would like to.



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

* Re: [PATCH] Add buffer name option for project-compile
  2021-04-23  3:09   ` Ivan Sokolov
@ 2021-04-23  6:14     ` Eli Zaretskii
  0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2021-04-23  6:14 UTC (permalink / raw)
  To: Ivan Sokolov; +Cc: emacs-devel, dgutov

> From: Ivan Sokolov <ivan-p-sokolov@ya.ru>
> Envelope-From: ivan-p-sokolov@yandex.ru
> Date: Fri, 23 Apr 2021 06:09:04 +0300
> Cc: emacs-devel@gnu.org
> 
> > Note that with it you have reached the allowed amount of contribution
> > without copyright assignment. Please let us know if you'd like to get
> > that process started now, to remote limitations on future patches.
> 
> Yes, I would like to.

Thanks, form sent off-list.



^ permalink raw reply	[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).