bug-gnu-emacs
[Top][All Lists]
Advanced

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

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


From: Dmitry Gutov
Subject: bug#63469: 29.0.90; project.el doesn't add menu-bar entries
Date: Wed, 24 May 2023 04:00:20 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0

On 23/05/2023 09:46, Juri Linkov wrote:
+(define-minor-mode project-mode
+  "Toggle display of project menu in the project-aware buffers."
+  (if project-mode
+      (setq-local project-name (concat
+                               " "
+                               (propertize
+                                (project-name (project-current))
+                                'mouse-face 'mode-line-highlight
+                                'local-map project-mode-line-map)))))

At the very least, this will need some better name, because project
features don't need any mode to be turned on to be used.

project-menu-mode?

'project-mode' will be more like 'vc-mode' that actually is not a minor mode.
I don't know why it was named 'vc-mode'.

vc-mode is not a mode at all: you can't choose to enable or disable it.

Next, I'm not quite sure about the caching of project-name. There is no
scenario when it will be invalidated, right?

I can't imagine such scenario.

Any scenario where the user assigns of changes the name, e.g. by changing the value of project-vc-name.

Try simply calling (project-name (project-current t)) every time, see how
the performance is. Or, more thoroughly, copy the if-let logic from
project-prefixed-buffer-name.

Ok, will try.

BTW, there is another problem: by default 'project-name' is defined as
(file-name-nondirectory (directory-file-name (project-root project))).
But then project name often is the same for different projects
because the directory name is the same for the same repository.
For example, in a subtree:

   emacs-master/emacs/...
   emacs-29/emacs/...
   emacs-28/emacs/...

All project names are the same 'emacs'.  How would it be possible to
customize project names?  Trying to get a parent dir might be too
unreliable.  So probably the only way is to define the name manually.
Maybe in .dir-locals.el.  Actually this works:

   ((nil . ((project-vc-name . "emacs-29"))))

Not sure why non-VC projects can't be named the same way.

They can -- using whatever way the respective backend provides.

Also noticed that project-vc-name is not marked as safe,
so always asks a confirmation.






reply via email to

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