>From 2141d988d376cfd6a572a86c77346815c45cc686 Mon Sep 17 00:00:00 2001 From: Spencer Baugh Date: Thu, 30 Mar 2023 14:34:29 -0400 Subject: [PATCH] Use project-name to calculate prefixed buffer name * lisp/progmodes/project.el (project-prefixed-buffer-name): (project-shell): (project-eshell): Use project-name to calculate prefixed buffer name (project-compilation-buffer-name-function): Update doc. --- lisp/progmodes/project.el | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 11228226592..6d058edf878 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -1165,8 +1165,9 @@ project-shell if one already exists." (interactive) (require 'comint) - (let* ((default-directory (project-root (project-current t))) - (default-project-shell-name (project-prefixed-buffer-name "shell")) + (let* ((pr (project-current t)) + (default-directory (project-root pr)) + (default-project-shell-name (project-prefixed-buffer-name pr "shell")) (shell-buffer (get-buffer default-project-shell-name))) (if (and shell-buffer (not current-prefix-arg)) (if (comint-check-proc shell-buffer) @@ -1183,8 +1184,9 @@ project-eshell if one already exists." (interactive) (defvar eshell-buffer-name) - (let* ((default-directory (project-root (project-current t))) - (eshell-buffer-name (project-prefixed-buffer-name "eshell")) + (let* ((pr (project-current t)) + (default-directory (project-root pr)) + (eshell-buffer-name (project-prefixed-buffer-name pr "eshell")) (eshell-buffer (get-buffer eshell-buffer-name))) (if (and eshell-buffer (not current-prefix-arg)) (pop-to-buffer eshell-buffer (bound-and-true-p display-comint-buffer-action)) @@ -1246,10 +1248,9 @@ project-query-replace-regexp (defvar compilation-read-command) (declare-function compilation-read-command "compile") -(defun project-prefixed-buffer-name (mode) +(defun project-prefixed-buffer-name (pr mode) (concat "*" - (file-name-nondirectory - (directory-file-name default-directory)) + (project-name pr) "-" (downcase mode) "*")) @@ -1261,7 +1262,7 @@ project-compilation-buffer-name-function :version "28.1" :group 'project :type '(choice (const :tag "Default" nil) - (const :tag "Prefixed with root directory name" + (const :tag "Prefixed with project name" project-prefixed-buffer-name) (function :tag "Custom function"))) -- 2.30.2