GNU bug report logs - #66317
Project mode-line

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> linkov.net>

Date: Tue, 3 Oct 2023 06:33:01 UTC

Severity: wishlist

Fixed in version 30.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Eshel Yaron <me <at> eshelyaron.com>, Juri Linkov <juri <at> linkov.net>
Cc: 66317 <at> debbugs.gnu.org
Subject: bug#66317: Project mode-line
Date: Tue, 3 Oct 2023 19:24:52 +0300
On 03/10/2023 11:07, Eshel Yaron via Bug reports for GNU Emacs, the 
Swiss army knife of text editors wrote:
> Hi,
> 
> Juri Linkov<juri <at> linkov.net>  writes:
> 
>> Here is the implementation of the mode-line project indicator prepended
>> before the vc indicator with the project menu discussed in bug#63469:
>>
>> diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
>> index 2e6ae89a443..8798feb2c56 100644
>> --- a/lisp/progmodes/project.el
>> +++ b/lisp/progmodes/project.el
>> @@ -2010,5 +2102,20 @@ project-uniquify-dirname-transform
>>             (file-relative-name dirname root))))
>>       dirname))
>>
>> +;;; Project mode-line
>> +
>> +(let ((form '(:eval (when-let (project (project-current))
>> +                      (concat " "
>> +                              (propertize
>> +                               (project-name project)
>> +                               'mouse-face 'mode-line-highlight
>> +                               'local-map
>> +                               (make-mode-line-mouse-map
>> +                                'down-mouse-1
>> +                             `(menu-item "Project"
>> +                                            ,menu-bar-project-menu))))))))
>> +  (when-let (pos (seq-position mode-line-format '(vc-mode vc-mode)))
>> +    (cl-pushnew form (nthcdr pos mode-line-format))))
>> +
>>   (provide 'project)
>>   ;;; project.el ends here
> This looks nice (I actually have something similar in my
> `mode-line-format` already), but I think that modifying
> `mode-line-format` when project.el is loaded is a bit problematic.
> Perhaps a better alternative would be to define a variable that holds
> this mode-line construct, along with an autoloaded function that people
> can call from their init files to actually add this construct to
> `mode-line-format`.  WDYT?

I also think this would be a more conservative choice (keeping the 
runtime cost of using project.el to zero by default).

- A public defvar with the mode-line spec for the project element (which 
could be used by alternative mode-lines as well).
- Either a public function, or a defcustom (nil by default) where the 
setter does the same thing. The latter seems a bit user-friendlier.




This bug report was last modified 1 year and 199 days ago.

Previous Next


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