GNU bug report logs -
#66317
Project mode-line
Previous Next
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
Message #35 received at 66317 <at> debbugs.gnu.org (full text, mbox):
Juri Linkov <juri <at> linkov.net> writes:
> Ok, here is the implementation with an optional variable:
Thanks, I've tried this patch on top of Emacs master and it seems to
work well. One small suggestion is to consider giving the project name
in the mode line a dedicated face, so people/themes could customize its
appearance. (By default, it could just inherit from `default`.)
> diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
> index 2e6ae89a443..74b2347b715 100644
> --- a/lisp/progmodes/project.el
> +++ b/lisp/progmodes/project.el
> @@ -2010,5 +2103,36 @@ project-uniquify-dirname-transform
> (file-relative-name dirname root))))
> dirname))
>
> +;;; Project mode-line
> +
> +;;;###autoload
> +(defcustom project-mode-line nil
> + "Show the current project name with the menu on the mode line."
> + :type 'boolean
> + :group 'project
> + :version "30.1")
> +
> +(defvar project-menu-entry
> + `(menu-item "Project" ,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)
> + map))
> +
> +(defvar project-mode-line-format '(:eval (project-mode-line-format)))
> +(put 'project-mode-line-format 'risky-local-variable t)
> +
> +(defun project-mode-line-format ()
> + "Compose the project mode-line."
> + (when-let ((project (project-current)))
> + (concat
> + " "
> + (propertize
> + (project-name project)
> + 'mouse-face 'mode-line-highlight
> + 'help-echo "mouse-1: Project menu"
> + 'local-map project-mode-line-map))))
> +
> (provide 'project)
> ;;; project.el ends here
> diff --git a/lisp/bindings.el b/lisp/bindings.el
> index 207adb3a2a4..70e4087e131 100644
> --- a/lisp/bindings.el
> +++ b/lisp/bindings.el
> @@ -682,6 +682,7 @@ mode-line-end-spaces
> 'mode-line-buffer-identification
> " "
> 'mode-line-position
> + '(project-mode-line project-mode-line-format)
> '(vc-mode vc-mode)
> " "
> 'mode-line-modes
This bug report was last modified 1 year and 200 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.