GNU bug report logs - #63469
29.0.90; project.el doesn't add menu-bar entries

Previous Next

Package: emacs;

Reported by: Spencer Baugh <sbaugh <at> janestreet.com>

Date: Fri, 12 May 2023 17:49:02 UTC

Severity: normal

Found in version 29.0.90

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #29 received at 63469 <at> debbugs.gnu.org (full text, mbox):

From: Spencer Baugh <sbaugh <at> janestreet.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 63469 <at> debbugs.gnu.org
Subject: Re: bug#63469: 29.0.90; project.el doesn't add menu-bar entries
Date: Mon, 15 May 2023 14:46:19 -0400
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:
>> From: Spencer Baugh <sbaugh <at> janestreet.com>
>> Date: Mon, 15 May 2023 14:11:08 -0400
>> 
>> The attached patch resolves this.  There's also a slight tweak to the
>> text of the menu entry for "Compile" to make it clearer that "compile"
>> runs in CWD, where as "project-compile" runs on the current project.
>> Otherwise I think it would be slightly confusing.
>
> Thanks.
>
>>  (defvar menu-bar-shell-commands-menu
>>    (let ((menu (make-sparse-keymap "Shell Commands")))
>> +    (bindings--define-key menu [project-interactive-shell]
>> +      '(menu-item "Run Shell Interactively In Project" project-shell
>> +                  :help "Run a subshell interactively, in the current project"))
>
> What does it mean to "run a shell in the current project"?  A shell
> doesn't run in a project.  Maybe you meant in the project's root
> directory?

Yes, changed to "In Project Root".

>> +    (bindings--define-key menu [project-compile]
>> +      '(menu-item "Compile Project..." project-compile
>> +                  :help "Invoke compiler or Make for current project, view compilation errors"))
>
> This tool-tip text is too long.  Maybe drop the "compilation" part.

Dropped.

>> +      '(menu-item "Compile Current Directory..." compile
>> +                  :help "Invoke compiler or Make in current directory, view compilation errors"))
>
> What is a "current directory" when you are talking about Emacs?

I usually think of the default-directory of the current buffer as the
"current directory".  But maybe that's not the terminology we want to
use?  How about "Compile Buffer" with help text "[...] in directory of
current buffer [...]"?

>> +	(list 'select-buffer-in-project
>> +	      'menu-item
>> +	      "Select Buffer In Project..."
>> +	      'project-switch-to-buffer
>> +	      :help "Prompt for a buffer name in the current project, and select that buffer in the current window")
>
> This tool-tip text is _way_ too long.

Shrunk.

[0001-Add-project-command-entries-to-the-menu-bar.patch (text/x-patch, inline)]
From ac0e09e9a33fc6235d1638df4f1e5ede7d9dbd32 Mon Sep 17 00:00:00 2001
From: Spencer Baugh <sbaugh <at> janestreet.com>
Date: Mon, 15 May 2023 14:01:32 -0400
Subject: [PATCH] Add project command entries to the menu-bar

* lisp/menu-bar.el (menu-bar-file-menu): Add project-dired and
project-find-file entries.
(menu-bar-search-menu): Add project-find-regexp entry.
(menu-bar-replace-menu): Add project-query-replace regexp entry.
(menu-bar-shell-commands-menu): Add project-shell entry.
(menu-bar-buffers-menu-command-entries): Add project-switch-to-buffer
and project-list-buffer entries.
(menu-bar-tools-menu): Add project-compile entry and change text for
compile entry.
---
 lisp/menu-bar.el | 38 +++++++++++++++++++++++++++++++++++---
 1 file changed, 35 insertions(+), 3 deletions(-)

diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el
index d020cf6e90a..1f66ea85ecd 100644
--- a/lisp/menu-bar.el
+++ b/lisp/menu-bar.el
@@ -219,10 +219,18 @@ menu-bar-file-menu
       '(menu-item "Insert File..." insert-file
                   :enable (menu-bar-non-minibuffer-window-p)
                   :help "Insert another file into current buffer"))
+    (bindings--define-key menu [project-dired]
+      '(menu-item "Open Root Directory Of Project..." project-dired
+                  :enable (menu-bar-non-minibuffer-window-p)
+                  :help "Read the root directory of the current project, to operate on its files"))
     (bindings--define-key menu [dired]
       '(menu-item "Open Directory..." dired
                   :enable (menu-bar-non-minibuffer-window-p)
                   :help "Read a directory, to operate on its files"))
+    (bindings--define-key menu [project-open-file]
+      '(menu-item "Open File In Project..." project-find-file
+                  :enable (menu-bar-non-minibuffer-window-p)
+                  :help "Read an existing file in the current project into an Emacs buffer"))
     (bindings--define-key menu [open-file]
       '(menu-item "Open File..." menu-find-file-existing
                   :enable (menu-bar-non-minibuffer-window-p)
@@ -347,6 +355,9 @@ menu-bar-search-menu
     (bindings--define-key menu [tags-srch]
       '(menu-item "Search Tagged Files..." tags-search
                   :help "Search for a regexp in all tagged files"))
+    (bindings--define-key menu [project-search]
+      '(menu-item "Search in Project Files..." project-find-regexp
+        :help "Search for a regexp in files of the current project"))
     (bindings--define-key menu [separator-tag-search] menu-bar-separator)
 
     (bindings--define-key menu [repeat-search-back]
@@ -398,6 +409,9 @@ menu-bar-replace-menu
     (bindings--define-key menu [tags-repl]
       '(menu-item "Replace in Tagged Files..." tags-query-replace
         :help "Interactively replace a regexp in all tagged files"))
+    (bindings--define-key menu [project-replace]
+      '(menu-item "Replace in Project Files..." project-query-replace-regexp
+        :help "Interactively replace a regexp in files of the current project"))
     (bindings--define-key menu [separator-replace-tags]
       menu-bar-separator)
 
@@ -1746,6 +1760,10 @@ menu-bar-encryption-decryption-menu
 
 (defvar menu-bar-shell-commands-menu
   (let ((menu (make-sparse-keymap "Shell Commands")))
+    (bindings--define-key menu [project-interactive-shell]
+      '(menu-item "Run Shell Interactively In Project Root" project-shell
+                  :help "Run a subshell interactively, in the current project"))
+
     (bindings--define-key menu [interactive-shell]
       '(menu-item "Run Shell Interactively" shell
                   :help "Run a subshell interactively"))
@@ -1860,9 +1878,13 @@ menu-bar-tools-menu
     (bindings--define-key menu [gdb]
       '(menu-item "Debugger (GDB)..." gdb
                   :help "Debug a program from within Emacs with GDB"))
+    (bindings--define-key menu [project-compile]
+      '(menu-item "Compile Project..." project-compile
+                  :help "Invoke compiler or Make for current project, view errors"))
+
     (bindings--define-key menu [compile]
-      '(menu-item "Compile..." compile
-                  :help "Invoke compiler or Make, view compilation errors"))
+      '(menu-item "Compile Buffer..." compile
+                  :help "Invoke compiler or Make in directory of this buffer, view errors"))
 
     (bindings--define-key menu [shell-commands]
       `(menu-item "Shell Commands"
@@ -2347,7 +2369,17 @@ menu-bar-buffers-menu-command-entries
 	      'menu-item
 	      "List All Buffers"
 	      'list-buffers
-	      :help "Pop up a window listing all Emacs buffers"))
+	      :help "Pop up a window listing all Emacs buffers")
+	(list 'select-buffer-in-project
+	      'menu-item
+	      "Select Buffer In Project..."
+	      'project-switch-to-buffer
+	      :help "Prompt for a buffer in the current project, and switch to it")
+	(list 'list-buffers-in-project
+	      'menu-item
+	      "List Buffers In Project..."
+	      'project-list-buffers
+	      :help "Pop up a window listing all Emacs buffers in the current project"))
   "Entries to be included at the end of the \"Buffers\" menu.")
 
 (defvar menu-bar-select-buffer-function 'switch-to-buffer
-- 
2.30.2


This bug report was last modified 2 years and 43 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.