** Project
+*** New user option 'project-mode-line'.
+When non-nil, display the name of the current project on
+the mode line. Clicking mouse-1 pops up the project menu.
+
*** New user option 'project-file-history-behavior'.
Customizing it to 'relativize' makes commands like 'project-find-file'
and 'project-find-dir' display previous history entries relative to
(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.
+This feature requires the presence of the following item in
+`mode-line-format': `(project-mode-line project-mode-line-format)'."
+ :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