diff options
| author | Juri Linkov | 2024-03-14 19:29:16 +0200 |
|---|---|---|
| committer | Juri Linkov | 2024-03-14 19:29:16 +0200 |
| commit | f3deaa117acfc975be3edbe8461b18fc29b4adf0 (patch) | |
| tree | 6a80525a50eecd96eb219151370d02a5ea3fd5f8 | |
| parent | eae2c73edb3f09a06a31a38edd28e9751626e761 (diff) | |
| download | emacs-f3deaa117acfc975be3edbe8461b18fc29b4adf0.tar.gz emacs-f3deaa117acfc975be3edbe8461b18fc29b4adf0.zip | |
Context menu for project (bug#69566)
* lisp/menu-bar.el (menu-bar-project-item): New variable from
'project-menu-entry'.
(menu-bar-tools-menu): Use 'menu-bar-project-item'.
* lisp/mouse.el (context-menu-functions): Add
'context-menu-project' to choice.
(context-menu-project): New function.
* lisp/progmodes/project.el (project-menu-entry): Remove variable.
(project-mode-line-map): Use 'menu-bar-project-item' instead of
'project-menu-entry'.
| -rw-r--r-- | lisp/menu-bar.el | 5 | ||||
| -rw-r--r-- | lisp/mouse.el | 7 | ||||
| -rw-r--r-- | lisp/progmodes/project.el | 6 |
3 files changed, 13 insertions, 5 deletions
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index 5b290899ff5..320fabb54cf 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el | |||
| @@ -1838,6 +1838,9 @@ mail status in mode line")) | |||
| 1838 | (bindings--define-key menu [project-open-file] '(menu-item "Open File..." project-find-file :help "Open an existing file that belongs to current project")) | 1838 | (bindings--define-key menu [project-open-file] '(menu-item "Open File..." project-find-file :help "Open an existing file that belongs to current project")) |
| 1839 | menu)) | 1839 | menu)) |
| 1840 | 1840 | ||
| 1841 | (defvar menu-bar-project-item | ||
| 1842 | `(menu-item "Project" ,menu-bar-project-menu)) | ||
| 1843 | |||
| 1841 | (defun menu-bar-read-mail () | 1844 | (defun menu-bar-read-mail () |
| 1842 | "Read mail using `read-mail-command'." | 1845 | "Read mail using `read-mail-command'." |
| 1843 | (interactive) | 1846 | (interactive) |
| @@ -1925,7 +1928,7 @@ mail status in mode line")) | |||
| 1925 | :help "Start language server suitable for this buffer's major-mode")) | 1928 | :help "Start language server suitable for this buffer's major-mode")) |
| 1926 | 1929 | ||
| 1927 | (bindings--define-key menu [project] | 1930 | (bindings--define-key menu [project] |
| 1928 | `(menu-item "Project" ,menu-bar-project-menu)) | 1931 | menu-bar-project-item) |
| 1929 | 1932 | ||
| 1930 | (bindings--define-key menu [ede] | 1933 | (bindings--define-key menu [ede] |
| 1931 | '(menu-item "Project Support (EDE)" | 1934 | '(menu-item "Project Support (EDE)" |
diff --git a/lisp/mouse.el b/lisp/mouse.el index 26835437c08..cef88dede8a 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el | |||
| @@ -393,6 +393,7 @@ and should return the same menu with changes such as added new menu items." | |||
| 393 | (function-item context-menu-local) | 393 | (function-item context-menu-local) |
| 394 | (function-item context-menu-minor) | 394 | (function-item context-menu-minor) |
| 395 | (function-item context-menu-buffers) | 395 | (function-item context-menu-buffers) |
| 396 | (function-item context-menu-project) | ||
| 396 | (function-item context-menu-vc) | 397 | (function-item context-menu-vc) |
| 397 | (function-item context-menu-ffap) | 398 | (function-item context-menu-ffap) |
| 398 | (function-item hi-lock-context-menu) | 399 | (function-item hi-lock-context-menu) |
| @@ -533,6 +534,12 @@ Some context functions add menu items below the separator." | |||
| 533 | (mouse-buffer-menu-keymap)) | 534 | (mouse-buffer-menu-keymap)) |
| 534 | menu) | 535 | menu) |
| 535 | 536 | ||
| 537 | (defun context-menu-project (menu _click) | ||
| 538 | "Populate MENU with project commands." | ||
| 539 | (define-key-after menu [separator-project] menu-bar-separator) | ||
| 540 | (define-key-after menu [project-menu] menu-bar-project-item) | ||
| 541 | menu) | ||
| 542 | |||
| 536 | (defun context-menu-vc (menu _click) | 543 | (defun context-menu-vc (menu _click) |
| 537 | "Populate MENU with Version Control commands." | 544 | "Populate MENU with Version Control commands." |
| 538 | (define-key-after menu [separator-vc] menu-bar-separator) | 545 | (define-key-after menu [separator-vc] menu-bar-separator) |
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 9622b1b6768..4284ea6edc6 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el | |||
| @@ -2140,12 +2140,10 @@ is part of the default mode line beginning with Emacs 30." | |||
| 2140 | :group 'project | 2140 | :group 'project |
| 2141 | :version "30.1") | 2141 | :version "30.1") |
| 2142 | 2142 | ||
| 2143 | (defvar project-menu-entry | ||
| 2144 | `(menu-item "Project" ,(bound-and-true-p menu-bar-project-menu))) | ||
| 2145 | |||
| 2146 | (defvar project-mode-line-map | 2143 | (defvar project-mode-line-map |
| 2147 | (let ((map (make-sparse-keymap))) | 2144 | (let ((map (make-sparse-keymap))) |
| 2148 | (define-key map [mode-line down-mouse-1] project-menu-entry) | 2145 | (define-key map [mode-line down-mouse-1] |
| 2146 | (bound-and-true-p menu-bar-project-item)) | ||
| 2149 | map)) | 2147 | map)) |
| 2150 | 2148 | ||
| 2151 | (defvar project-mode-line-face nil | 2149 | (defvar project-mode-line-face nil |