emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master f3deaa117ac: Context menu for project (bug#69566)


From: Juri Linkov
Subject: master f3deaa117ac: Context menu for project (bug#69566)
Date: Thu, 14 Mar 2024 13:30:21 -0400 (EDT)

branch: master
commit f3deaa117acfc975be3edbe8461b18fc29b4adf0
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>

    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'.
---
 lisp/menu-bar.el          | 5 ++++-
 lisp/mouse.el             | 7 +++++++
 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"))
     (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)"
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."
                   (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)
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."
   :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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]