GNU bug report logs - #63469
29.0.90; project.el doesn't add menu-bar entries

Previous Next

Package: emacs;

Reported by: Spencer Baugh <sbaugh <at> janestreet.com>

Date: Fri, 12 May 2023 17:49:02 UTC

Severity: normal

Found in version 29.0.90

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Juri Linkov <juri <at> linkov.net>
To: Dmitry Gutov <dmitry <at> gutov.dev>
Cc: Spencer Baugh <sbaugh <at> janestreet.com>, Eli Zaretskii <eliz <at> gnu.org>, 63469 <at> debbugs.gnu.org
Subject: bug#63469: 29.0.90; project.el doesn't add menu-bar entries
Date: Fri, 19 May 2023 09:56:31 +0300
>> Is it possible to enable some formal minor mode in project-visited
>> buffers?
>
> Calculating whether a known project is associated with the buffer, we'd
> need to find it.
>
> Doing that can take non-negligible amount of time, e.g. in remote buffers,
> so we only do that on-demand, not in find-file-hook.

This mode is intended for anyone who wants to show the menu
only in project-supported buffers.  To do this, they need to
enable `global-project-mode':

```patch
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 7c51778d5d4..e6dc7aea9ca 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -1883,5 +1883,30 @@ project-switch-project
     (let ((project-current-directory-override dir))
       (call-interactively command))))
 
+(easy-menu-define project-mode-menu project-prefix-map
+  "Menu for `project-mode' buffers."
+  '("Project"
+    ["List buffers" project-list-buffers
+     :help "List project buffers"]
+    ;; ...
+    ))
+
+;;;###autoload
+(define-minor-mode project-mode
+  "Toggle display of project menu in the project-aware buffers."
+  :lighter " Pro"
+  :keymap (define-keymap "<menu-bar>" project-mode-menu))
+
+(defun project-mode--turn-on ()
+  "Turn on `project-mode' in all pertinent buffers."
+  (when (project-current)
+    (project-mode 1)))
+
+;;;###autoload
+(define-globalized-minor-mode global-project-mode
+  project-mode project-mode--turn-on
+  :group 'project
+  :version "30.1")
+
 (provide 'project)
 ;;; project.el ends here
```




This bug report was last modified 2 years and 43 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.