all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Theodor Thornhill <theo@thornhill.no>
To: Eli Zaretskii <eliz@gnu.org>
Cc: juri@linkov.net, dgutov@yandex.ru, 41858@debbugs.gnu.org
Subject: bug#41858: 28.0.50; [PATCH]: Make project-shell use universal argument
Date: Thu, 18 Jun 2020 18:00:42 +0000	[thread overview]
Message-ID: <87tuz8meys.fsf@thornhill.no> (raw)
In-Reply-To: <83v9jozeng.fsf@gnu.org>

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

Hello!

"Eli Zaretskii" <eliz@gnu.org> writes:

> Please always mention the bug number, if there is any, in the commit
> log message.
Ok!

> Also, please format the log message according to our conventions, as
> described in CONTRIBUTE.

Read, and new attempt further down.

> This doesn't say enough about what the command does.  How about
>
>   Start an inferior shell in the current project's root directory.

Yeah, that is clearer. I've added it in the attached patch.

Second attempt of a commit message:

-------------------------------------------------------------------
Change default behaviour of 'project-shell'

* lisp/progmodes/project.el (project-shell): If a shell
already is open, pop to that buffer. Otherwise, or if
universal argument is used, open a subsequent shell buffer
and jump to it. Also sets shell buffer name with a prefix of
project root name. (Bug#41858)
-------------------------------------------------------------------



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

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index e24d81c1b4..ca650bdd52 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -714,11 +714,20 @@ project-vc-dir
 
 ;;;###autoload
 (defun project-shell ()
-  "Open Shell in the current project."
+  "Start an inferior shell in the current project's root directory.
+With \\[universal-argument] prefix, create subsequent shell buffers
+with uniquified names."
   (interactive)
-  (let ((default-directory (project-root (project-current t))))
-    ;; Use ‘create-file-buffer’ to uniquify shell buffer names.
-    (shell (create-file-buffer "*shell*"))))
+  (let* ((default-directory (project-root (project-current t)))
+         (default-project-shell-name
+           (concat "*" (file-name-nondirectory
+                        (directory-file-name
+                         (file-name-directory default-directory)))
+                   "-shell*"))
+         (shell-buffer (get-buffer default-project-shell-name)))
+    (if (and shell-buffer (not current-prefix-arg))
+        (pop-to-buffer shell-buffer)
+      (shell (generate-new-buffer-name default-project-shell-name)))))
 
 ;;;###autoload
 (defun project-eshell ()

  reply	other threads:[~2020-06-18 18:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-14 18:29 bug#41858: 28.0.50; [PATCH]: Make project-shell use universal argument Theodor Thornhill
2020-06-14 18:46 ` Dmitry Gutov
2020-06-14 18:51 ` bug#41858: Add the patch as a .patch Theodor Thornhill
2020-06-14 22:46 ` bug#41858: 28.0.50; [PATCH]: Make project-shell use universal argument Juri Linkov
2020-06-15  6:50   ` Theodor Thornhill
2020-06-15 23:01     ` Juri Linkov
2020-06-18  9:57       ` Theodor Thornhill
2020-06-18 13:28         ` Eli Zaretskii
2020-06-18 18:00           ` Theodor Thornhill [this message]
2020-06-20  1:03             ` Dmitry Gutov
2020-06-15 13:05   ` Dmitry Gutov
2020-06-15 14:53     ` Theodor Thornhill

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=87tuz8meys.fsf@thornhill.no \
    --to=theo@thornhill.no \
    --cc=41858@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    --cc=eliz@gnu.org \
    --cc=juri@linkov.net \
    /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.