diff options
| author | Spencer Baugh | 2023-05-15 14:01:32 -0400 |
|---|---|---|
| committer | Eli Zaretskii | 2023-07-01 12:33:24 +0300 |
| commit | ab8d0f7b7688d103be71072ea16a4d153806ef50 (patch) | |
| tree | cca99a42c4063c68addc1047632e756fe50209b4 | |
| parent | fc6099bf04696b01eaa21c9948a8d8d91345a66c (diff) | |
| download | emacs-ab8d0f7b7688d103be71072ea16a4d153806ef50.tar.gz emacs-ab8d0f7b7688d103be71072ea16a4d153806ef50.zip | |
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.
| -rw-r--r-- | lisp/menu-bar.el | 66 |
1 files changed, 63 insertions, 3 deletions
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index f6b87d1078d..ac41a11379a 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el | |||
| @@ -219,10 +219,18 @@ | |||
| 219 | '(menu-item "Insert File..." insert-file | 219 | '(menu-item "Insert File..." insert-file |
| 220 | :enable (menu-bar-non-minibuffer-window-p) | 220 | :enable (menu-bar-non-minibuffer-window-p) |
| 221 | :help "Insert another file into current buffer")) | 221 | :help "Insert another file into current buffer")) |
| 222 | (bindings--define-key menu [project-dired] | ||
| 223 | '(menu-item "Open Project Directory" project-dired | ||
| 224 | :enable (menu-bar-non-minibuffer-window-p) | ||
| 225 | :help "Read the root directory of the current project, to operate on its files")) | ||
| 222 | (bindings--define-key menu [dired] | 226 | (bindings--define-key menu [dired] |
| 223 | '(menu-item "Open Directory..." dired | 227 | '(menu-item "Open Directory..." dired |
| 224 | :enable (menu-bar-non-minibuffer-window-p) | 228 | :enable (menu-bar-non-minibuffer-window-p) |
| 225 | :help "Read a directory, to operate on its files")) | 229 | :help "Read a directory, to operate on its files")) |
| 230 | (bindings--define-key menu [project-open-file] | ||
| 231 | '(menu-item "Open File In Project..." project-find-file | ||
| 232 | :enable (menu-bar-non-minibuffer-window-p) | ||
| 233 | :help "Read an existing file in the current project into an Emacs buffer")) | ||
| 226 | (bindings--define-key menu [open-file] | 234 | (bindings--define-key menu [open-file] |
| 227 | '(menu-item "Open File..." menu-find-file-existing | 235 | '(menu-item "Open File..." menu-find-file-existing |
| 228 | :enable (menu-bar-non-minibuffer-window-p) | 236 | :enable (menu-bar-non-minibuffer-window-p) |
| @@ -347,6 +355,9 @@ | |||
| 347 | (bindings--define-key menu [tags-srch] | 355 | (bindings--define-key menu [tags-srch] |
| 348 | '(menu-item "Search Tagged Files..." tags-search | 356 | '(menu-item "Search Tagged Files..." tags-search |
| 349 | :help "Search for a regexp in all tagged files")) | 357 | :help "Search for a regexp in all tagged files")) |
| 358 | (bindings--define-key menu [project-search] | ||
| 359 | '(menu-item "Search in Project Files..." project-find-regexp | ||
| 360 | :help "Search for a regexp in files of the current project")) | ||
| 350 | (bindings--define-key menu [separator-tag-search] menu-bar-separator) | 361 | (bindings--define-key menu [separator-tag-search] menu-bar-separator) |
| 351 | 362 | ||
| 352 | (bindings--define-key menu [repeat-search-back] | 363 | (bindings--define-key menu [repeat-search-back] |
| @@ -398,6 +409,9 @@ | |||
| 398 | (bindings--define-key menu [tags-repl] | 409 | (bindings--define-key menu [tags-repl] |
| 399 | '(menu-item "Replace in Tagged Files..." tags-query-replace | 410 | '(menu-item "Replace in Tagged Files..." tags-query-replace |
| 400 | :help "Interactively replace a regexp in all tagged files")) | 411 | :help "Interactively replace a regexp in all tagged files")) |
| 412 | (bindings--define-key menu [project-replace] | ||
| 413 | '(menu-item "Replace in Project Files..." project-query-replace-regexp | ||
| 414 | :help "Interactively replace a regexp in files of the current project")) | ||
| 401 | (bindings--define-key menu [separator-replace-tags] | 415 | (bindings--define-key menu [separator-replace-tags] |
| 402 | menu-bar-separator) | 416 | menu-bar-separator) |
| 403 | 417 | ||
| @@ -1746,8 +1760,12 @@ mail status in mode line")) | |||
| 1746 | 1760 | ||
| 1747 | (defvar menu-bar-shell-commands-menu | 1761 | (defvar menu-bar-shell-commands-menu |
| 1748 | (let ((menu (make-sparse-keymap "Shell Commands"))) | 1762 | (let ((menu (make-sparse-keymap "Shell Commands"))) |
| 1763 | (bindings--define-key menu [project-interactive-shell] | ||
| 1764 | '(menu-item "Run Shell In Project" project-shell | ||
| 1765 | :help "Run a subshell interactively, in the current project's root directory")) | ||
| 1766 | |||
| 1749 | (bindings--define-key menu [interactive-shell] | 1767 | (bindings--define-key menu [interactive-shell] |
| 1750 | '(menu-item "Run Shell Interactively" shell | 1768 | '(menu-item "Run Shell" shell |
| 1751 | :help "Run a subshell interactively")) | 1769 | :help "Run a subshell interactively")) |
| 1752 | 1770 | ||
| 1753 | (bindings--define-key menu [async-shell-command] | 1771 | (bindings--define-key menu [async-shell-command] |
| @@ -1765,6 +1783,31 @@ mail status in mode line")) | |||
| 1765 | 1783 | ||
| 1766 | menu)) | 1784 | menu)) |
| 1767 | 1785 | ||
| 1786 | (defvar menu-bar-project-menu | ||
| 1787 | (let ((menu (make-sparse-keymap "Project"))) | ||
| 1788 | (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")) | ||
| 1789 | (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")) | ||
| 1790 | (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")) | ||
| 1791 | (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")) | ||
| 1792 | (bindings--define-key menu [separator-project-search] menu-bar-separator) | ||
| 1793 | (bindings--define-key menu [project-kill-buffers] '(menu-item "Kill Buffers..." project-kill-buffers :help "Kill the buffers belonging to the current project")) | ||
| 1794 | (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")) | ||
| 1795 | (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")) | ||
| 1796 | (bindings--define-key menu [separator-project-buffers] menu-bar-separator) | ||
| 1797 | (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")) | ||
| 1798 | (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")) | ||
| 1799 | (bindings--define-key menu [project-eshell] '(menu-item "Run Eshell" project-eshell :help "Run eshell for the current project")) | ||
| 1800 | (bindings--define-key menu [project-shell] '(menu-item "Run Shell" project-shell :help "Run a subshell interactively, in the current project's root directory")) | ||
| 1801 | (bindings--define-key menu [project-compile] '(menu-item "Compile..." project-compile :help "Invoke compiler or Make for current project, view errors")) | ||
| 1802 | (bindings--define-key menu [separator-project-programs] menu-bar-separator) | ||
| 1803 | (bindings--define-key menu [project-switch-project] '(menu-item "Switch Project..." project-switch-project :help "Switch to another project and then run a command")) | ||
| 1804 | (bindings--define-key menu [project-vc-dir] '(menu-item "VC Dir..." project-vc-dir :help "Show the VC status of the project repository")) | ||
| 1805 | (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")) | ||
| 1806 | (bindings--define-key menu [project-find-dir] '(menu-item "Open Directory..." project-find-dir :help "Open an existing directory in the current project")) | ||
| 1807 | (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")) | ||
| 1808 | (bindings--define-key menu [project-open-file] '(menu-item "Open File..." project-find-file :help "Open an existing file in the current project")) | ||
| 1809 | menu)) | ||
| 1810 | |||
| 1768 | (defun menu-bar-read-mail () | 1811 | (defun menu-bar-read-mail () |
| 1769 | "Read mail using `read-mail-command'." | 1812 | "Read mail using `read-mail-command'." |
| 1770 | (interactive) | 1813 | (interactive) |
| @@ -1851,6 +1894,9 @@ mail status in mode line")) | |||
| 1851 | '(menu-item "Language Server Support (Eglot)" eglot | 1894 | '(menu-item "Language Server Support (Eglot)" eglot |
| 1852 | :help "Start language server suitable for this buffer's major-mode")) | 1895 | :help "Start language server suitable for this buffer's major-mode")) |
| 1853 | 1896 | ||
| 1897 | (bindings--define-key menu [project] | ||
| 1898 | `(menu-item "Project" ,menu-bar-project-menu)) | ||
| 1899 | |||
| 1854 | (bindings--define-key menu [ede] | 1900 | (bindings--define-key menu [ede] |
| 1855 | '(menu-item "Project Support (EDE)" | 1901 | '(menu-item "Project Support (EDE)" |
| 1856 | global-ede-mode | 1902 | global-ede-mode |
| @@ -1860,9 +1906,13 @@ mail status in mode line")) | |||
| 1860 | (bindings--define-key menu [gdb] | 1906 | (bindings--define-key menu [gdb] |
| 1861 | '(menu-item "Debugger (GDB)..." gdb | 1907 | '(menu-item "Debugger (GDB)..." gdb |
| 1862 | :help "Debug a program from within Emacs with GDB")) | 1908 | :help "Debug a program from within Emacs with GDB")) |
| 1909 | (bindings--define-key menu [project-compile] | ||
| 1910 | '(menu-item "Compile Project..." project-compile | ||
| 1911 | :help "Invoke compiler or Make for current project, view errors")) | ||
| 1912 | |||
| 1863 | (bindings--define-key menu [compile] | 1913 | (bindings--define-key menu [compile] |
| 1864 | '(menu-item "Compile..." compile | 1914 | '(menu-item "Compile..." compile |
| 1865 | :help "Invoke compiler or Make, view compilation errors")) | 1915 | :help "Invoke compiler or Make in current buffer's directory, view errors")) |
| 1866 | 1916 | ||
| 1867 | (bindings--define-key menu [shell-commands] | 1917 | (bindings--define-key menu [shell-commands] |
| 1868 | `(menu-item "Shell Commands" | 1918 | `(menu-item "Shell Commands" |
| @@ -2347,7 +2397,17 @@ Buffers menu is regenerated." | |||
| 2347 | 'menu-item | 2397 | 'menu-item |
| 2348 | "List All Buffers" | 2398 | "List All Buffers" |
| 2349 | 'list-buffers | 2399 | 'list-buffers |
| 2350 | :help "Pop up a window listing all Emacs buffers")) | 2400 | :help "Pop up a window listing all Emacs buffers") |
| 2401 | (list 'select-buffer-in-project | ||
| 2402 | 'menu-item | ||
| 2403 | "Select Buffer In Project..." | ||
| 2404 | 'project-switch-to-buffer | ||
| 2405 | :help "Prompt for a buffer in the current project, and switch to it") | ||
| 2406 | (list 'list-buffers-in-project | ||
| 2407 | 'menu-item | ||
| 2408 | "List Buffers In Project..." | ||
| 2409 | 'project-list-buffers | ||
| 2410 | :help "Pop up a window listing all Emacs buffers in the current project")) | ||
| 2351 | "Entries to be included at the end of the \"Buffers\" menu.") | 2411 | "Entries to be included at the end of the \"Buffers\" menu.") |
| 2352 | 2412 | ||
| 2353 | (defvar menu-bar-select-buffer-function 'switch-to-buffer | 2413 | (defvar menu-bar-select-buffer-function 'switch-to-buffer |