From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Spencer Baugh Newsgroups: gmane.emacs.bugs Subject: bug#63469: 29.0.90; project.el doesn't add menu-bar entries Date: Thu, 29 Jun 2023 15:22:51 -0400 Message-ID: References: <86zg4kt6iu.fsf@mail.linkov.net> <83bkgytabv.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34002"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: juri@linkov.net, 63469@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jun 29 21:24:29 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qExFj-0008Z5-Oa for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 29 Jun 2023 21:24:27 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qExFM-0007Pp-Hk; Thu, 29 Jun 2023 15:24:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qExFL-0007Pc-72 for bug-gnu-emacs@gnu.org; Thu, 29 Jun 2023 15:24:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qExFK-0003hA-Ul for bug-gnu-emacs@gnu.org; Thu, 29 Jun 2023 15:24:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qExFK-00048L-5w for bug-gnu-emacs@gnu.org; Thu, 29 Jun 2023 15:24:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Spencer Baugh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 29 Jun 2023 19:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63469 X-GNU-PR-Package: emacs Original-Received: via spool by 63469-submit@debbugs.gnu.org id=B63469.168806658215823 (code B ref 63469); Thu, 29 Jun 2023 19:24:02 +0000 Original-Received: (at 63469) by debbugs.gnu.org; 29 Jun 2023 19:23:02 +0000 Original-Received: from localhost ([127.0.0.1]:54043 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qExEL-00046l-OD for submit@debbugs.gnu.org; Thu, 29 Jun 2023 15:23:02 -0400 Original-Received: from mxout5.mail.janestreet.com ([64.215.233.18]:45739) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qExEG-00046N-G5 for 63469@debbugs.gnu.org; Thu, 29 Jun 2023 15:23:00 -0400 In-Reply-To: <83bkgytabv.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 29 Jun 2023 21:03:32 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:264291 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> Cc: 63469@debbugs.gnu.org >> From: Spencer Baugh >> Date: Thu, 29 Jun 2023 11:30:06 -0400 >> >> > So maybe your patch could be pushed to master now with both parts: >> > where project menu items are scattered throughout all menus, >> > and also where they are in one submenu that will be used later >> > on the mode-line and in the context menus of project buffers. >> >> OK, here is such a patch: > > Thanks. Some of the menu items are too long, please consider making > them shorter, even if that obfuscates them a bit (you can always > clarify in the help-echo string). OK, fixed both your and Juri's comments in the following patch. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Add-project-command-entries-to-the-menu-bar.patch >From 35e6a2eb2b914f2294e798aa999972e5fb05baa2 Mon Sep 17 00:00:00 2001 From: Spencer Baugh Date: Mon, 15 May 2023 14:01:32 -0400 Subject: [PATCH] Add project command entries to the menu-bar This will make it easier for new users to learn these increasingly important and useful commands. (Bug#63469) * 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-project-menu): Add. (menu-bar-tools-menu): Add "Project" submenu, and also project-compile entry and change text for compile entry. --- lisp/menu-bar.el | 66 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 63 insertions(+), 3 deletions(-) diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index d020cf6e90a..6772928add5 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 Project Directory" 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,8 +1760,12 @@ 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 In Project" project-shell + :help "Run a subshell interactively, in the current project's root directory")) + (bindings--define-key menu [interactive-shell] - '(menu-item "Run Shell Interactively" shell + '(menu-item "Run Shell" shell :help "Run a subshell interactively")) (bindings--define-key menu [async-shell-command] @@ -1765,6 +1783,31 @@ menu-bar-shell-commands-menu menu)) +(defvar menu-bar-project-menu + (let ((menu (make-sparse-keymap "Project"))) + (bindings--define-key menu [project-execute-extended-command] '(menu-item "Execute Extended Command..." project-execute-extended-command :help "Execute an extended command in project root")) + (bindings--define-key menu [project-query-replace-regexp] '(menu-item "Query Replace Regexp..." project-query-replace-regexp :help "Interactively replace a regexp in files of the current project")) + (bindings--define-key menu [project-or-external-find-regexp] '(menu-item "Find Regexp Including External Roots..." project-or-external-find-regexp :help "Search for a regexp in files of the current project or external files")) + (bindings--define-key menu [project-find-regexp] '(menu-item "Find Regexp..." project-find-regexp :help "Search for a regexp in files of the current project")) + (bindings--define-key menu [separator-project-search] menu-bar-separator) + (bindings--define-key menu [project-kill-buffers] '(menu-item "Kill Buffers..." project-kill-buffers :help "Kill the buffers belonging to the current project")) + (bindings--define-key menu [project-list-buffers] '(menu-item "List Buffers..." project-list-buffers :help "Pop up a window listing all Emacs buffers in the current project")) + (bindings--define-key menu [project-switch-to-buffer] '(menu-item "Switch To Buffer..." project-switch-to-buffer :help "Prompt for a buffer in the current project, and switch to it")) + (bindings--define-key menu [separator-project-buffers] menu-bar-separator) + (bindings--define-key menu [project-async-shell-command] '(menu-item "Async Shell Command..." project-async-shell-command :help "Invoke a shell command in project root asynchronously in background")) + (bindings--define-key menu [project-shell-command] '(menu-item "Shell Command..." project-shell-command :help "Invoke a shell command in project root and catch its output")) + (bindings--define-key menu [project-eshell] '(menu-item "Run Eshell" project-eshell :help "Run eshell for the current project")) + (bindings--define-key menu [project-shell] '(menu-item "Run Shell" project-shell :help "Run a subshell interactively, in the current project's root directory")) + (bindings--define-key menu [project-compile] '(menu-item "Compile..." project-compile :help "Invoke compiler or Make for current project, view errors")) + (bindings--define-key menu [separator-project-programs] menu-bar-separator) + (bindings--define-key menu [project-switch-project] '(menu-item "Switch Project..." project-switch-project :help "Switch to another project and then run a command")) + (bindings--define-key menu [project-vc-dir] '(menu-item "VC Dir..." project-vc-dir :help "Show the VC status of the project repository")) + (bindings--define-key menu [project-dired] '(menu-item "Open Project Root" project-dired :help "Read the root directory of the current project, to operate on its files")) + (bindings--define-key menu [project-find-dir] '(menu-item "Open Directory..." project-find-dir :help "Open an existing directory in the current project")) + (bindings--define-key menu [project-or-external-find-file] '(menu-item "Open File Including External Roots..." project-or-external-find-file :help "Open an existing file in the current project or its external roots")) + (bindings--define-key menu [project-open-file] '(menu-item "Open File..." project-find-file :help "Open an existing file in the current project")) + menu)) + (defun menu-bar-read-mail () "Read mail using `read-mail-command'." (interactive) @@ -1851,6 +1894,9 @@ menu-bar-tools-menu '(menu-item "Language Server Support (Eglot)" eglot :help "Start language server suitable for this buffer's major-mode")) + (bindings--define-key menu [project] + `(menu-item "Project" ,menu-bar-project-menu)) + (bindings--define-key menu [ede] '(menu-item "Project Support (EDE)" global-ede-mode @@ -1860,9 +1906,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")) + :help "Invoke compiler or Make in current buffer's directory, view errors")) (bindings--define-key menu [shell-commands] `(menu-item "Shell Commands" @@ -2347,7 +2397,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.39.3 --=-=-=--