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.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 69566 in the body.
You can then email your comments to 69566 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#69566
; Package
emacs
.
(Tue, 05 Mar 2024 17:00:03 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Juri Linkov <juri <at> linkov.net>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Tue, 05 Mar 2024 17:00:03 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Tags: patch
diff --git a/lisp/mouse.el b/lisp/mouse.el
index d1b06c2040d..d5c33828846 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)
@@ -527,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] (bound-and-true-p project-menu-entry))
+ menu)
+
(defun context-menu-vc (menu _click)
"Populate MENU with Version Control commands."
(define-key-after menu [separator-vc] menu-bar-separator)
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#69566
; Package
emacs
.
(Fri, 08 Mar 2024 22:59:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 69566 <at> debbugs.gnu.org (full text, mbox):
On 05/03/2024 18:54, Juri Linkov wrote:
> + (define-key-after menu [project-menu] (bound-and-true-p project-menu-entry))
This variable will probably always be bound (and likely non-nil), given
than mouse.el is never distributed separately or used with older
versions of Emacs.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#69566
; Package
emacs
.
(Fri, 08 Mar 2024 23:02:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 69566 <at> debbugs.gnu.org (full text, mbox):
On 09/03/2024 00:57, Dmitry Gutov wrote:
> On 05/03/2024 18:54, Juri Linkov wrote:
>> + (define-key-after menu [project-menu] (bound-and-true-p
>> project-menu-entry))
>
> This variable will probably always be bound (and likely non-nil), given
> than mouse.el is never distributed separately or used with older
> versions of Emacs.
Ah, I guess you might be handling the case when project is not loaded
yet. Perhaps we should autoload something, so that its commands are in
the context menu anyway?
You could even copy the variable's definition to mouse.el, if that's easier.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#69566
; Package
emacs
.
(Sun, 10 Mar 2024 17:34:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 69566 <at> debbugs.gnu.org (full text, mbox):
>>> + (define-key-after menu [project-menu] (bound-and-true-p
>>> project-menu-entry))
>> This variable will probably always be bound (and likely non-nil), given
>> than mouse.el is never distributed separately or used with older versions
>> of Emacs.
>
> Ah, I guess you might be handling the case when project is not loaded
> yet. Perhaps we should autoload something, so that its commands are in the
> context menu anyway?
>
> You could even copy the variable's definition to mouse.el, if that's easier.
Copying it to mouse.el or menu-bar.el makes sense since it will remove
another 'bound-and-true-p' from 'menu-bar-project-menu':
(defvar project-menu-entry
`(menu-item "Project" ,(bound-and-true-p menu-bar-project-menu)))
Both mouse.el and menu-bar.el are preloaded.
But the problem is that by its name prefix 'project-'
it belongs to project.el. Or maybe rename it to
'menu-bar-project-entry'?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#69566
; Package
emacs
.
(Sun, 10 Mar 2024 17:54:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 69566 <at> debbugs.gnu.org (full text, mbox):
On 10/03/2024 19:28, Juri Linkov wrote:
> 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.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#69566
; Package
emacs
.
(Tue, 12 Mar 2024 17:37:02 GMT)
Full text and
rfc822 format available.
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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#69566
; Package
emacs
.
(Wed, 13 Mar 2024 16:38:01 GMT)
Full text and
rfc822 format available.
Message #23 received at 69566 <at> debbugs.gnu.org (full text, mbox):
On 12/03/2024 19:18, Juri Linkov wrote:
>>> 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':
Looking good, thanks!
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#69566
; Package
emacs
.
(Thu, 14 Mar 2024 17:32:01 GMT)
Full text and
rfc822 format available.
Message #26 received at 69566 <at> debbugs.gnu.org (full text, mbox):
close 69566 30.0.50
thanks
>>>> 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':
>
> Looking good, thanks!
So now pushed.
bug marked as fixed in version 30.0.50, send any further explanations to
69566 <at> debbugs.gnu.org and Juri Linkov <juri <at> linkov.net>
Request was from
Juri Linkov <juri <at> linkov.net>
to
control <at> debbugs.gnu.org
.
(Thu, 14 Mar 2024 17:32:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 12 Apr 2024 11:24:29 GMT)
Full text and
rfc822 format available.
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.