1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-30 04:10:54 -08:00

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'.
This commit is contained in:
Juri Linkov 2024-03-14 19:29:16 +02:00
parent eae2c73edb
commit f3deaa117a
3 changed files with 13 additions and 5 deletions

View file

@ -1838,6 +1838,9 @@ mail status in mode line"))
(bindings--define-key menu [project-open-file] '(menu-item "Open File..." project-find-file :help "Open an existing file that belongs to current project"))
menu))
(defvar menu-bar-project-item
`(menu-item "Project" ,menu-bar-project-menu))
(defun menu-bar-read-mail ()
"Read mail using `read-mail-command'."
(interactive)
@ -1925,7 +1928,7 @@ mail status in mode line"))
:help "Start language server suitable for this buffer's major-mode"))
(bindings--define-key menu [project]
`(menu-item "Project" ,menu-bar-project-menu))
menu-bar-project-item)
(bindings--define-key menu [ede]
'(menu-item "Project Support (EDE)"

View file

@ -393,6 +393,7 @@ and should return the same menu with changes such as added new menu items."
(function-item context-menu-local)
(function-item context-menu-minor)
(function-item context-menu-buffers)
(function-item context-menu-project)
(function-item context-menu-vc)
(function-item context-menu-ffap)
(function-item hi-lock-context-menu)
@ -533,6 +534,12 @@ Some context functions add menu items below the separator."
(mouse-buffer-menu-keymap))
menu)
(defun context-menu-project (menu _click)
"Populate MENU with project commands."
(define-key-after menu [separator-project] menu-bar-separator)
(define-key-after menu [project-menu] menu-bar-project-item)
menu)
(defun context-menu-vc (menu _click)
"Populate MENU with Version Control commands."
(define-key-after menu [separator-vc] menu-bar-separator)

View file

@ -2140,12 +2140,10 @@ is part of the default mode line beginning with Emacs 30."
:group 'project
:version "30.1")
(defvar project-menu-entry
`(menu-item "Project" ,(bound-and-true-p menu-bar-project-menu)))
(defvar project-mode-line-map
(let ((map (make-sparse-keymap)))
(define-key map [mode-line down-mouse-1] project-menu-entry)
(define-key map [mode-line down-mouse-1]
(bound-and-true-p menu-bar-project-item))
map))
(defvar project-mode-line-face nil