all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Dmitry Gutov <dmitry@gutov.dev>
Cc: 69566@debbugs.gnu.org
Subject: bug#69566: Context menu for project
Date: Tue, 12 Mar 2024 19:18:11 +0200	[thread overview]
Message-ID: <86y1anpedg.fsf@mail.linkov.net> (raw)
In-Reply-To: <1473f7be-6004-48e1-96c2-74b76618a7c2@gutov.dev> (Dmitry Gutov's message of "Sun, 10 Mar 2024 19:52:55 +0200")

[-- Attachment #1: Type: text/plain, Size: 220 bytes --]

>> 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':


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: menu-bar-project-item.patch --]
[-- Type: text/x-diff, Size: 2520 bytes --]

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

  reply	other threads:[~2024-03-12 17:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-05 16:54 bug#69566: Context menu for project Juri Linkov
2024-03-08 22:57 ` Dmitry Gutov
2024-03-08 23:00   ` Dmitry Gutov
2024-03-10 17:28     ` Juri Linkov
2024-03-10 17:52       ` Dmitry Gutov
2024-03-12 17:18         ` Juri Linkov [this message]
2024-03-13 16:36           ` Dmitry Gutov
2024-03-14 17:29             ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86y1anpedg.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=69566@debbugs.gnu.org \
    --cc=dmitry@gutov.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.