GNU bug report logs -
#69566
Context menu for project
Previous Next
Reported by: Juri Linkov <juri <at> linkov.net>
Date: Tue, 5 Mar 2024 17:00:03 UTC
Severity: normal
Tags: patch
Fixed in version 30.0.50
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
Full log
Message #20 received at 69566 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
>> But the problem is that by its name prefix 'project-'
>> it belongs to project.el. Or maybe rename it to
>> 'menu-bar-project-entry'?
>
> Yes, I guess something like that.
Ok, here is with 'menu-bar-project-item':
[menu-bar-project-item.patch (text/x-diff, inline)]
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 @@ menu-bar-project-menu
(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 @@ menu-bar-tools-menu
: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)"
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 @@ context-menu-functions
(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 @@ context-menu-buffers
(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)
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 9622b1b6768..e2559617c20 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -2140,12 +2143,10 @@ project-mode-line
: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
This bug report was last modified 1 year and 70 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.