GNU bug report logs - #68765
30.0.50; Adding window-tool-bar package.

Previous Next

Package: emacs;

Reported by: Jared Finder <jared <at> finder.org>

Date: Sat, 27 Jan 2024 23:38:01 UTC

Severity: wishlist

Found in version 30.0.50

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: Eli Zaretskii <eliz <at> gnu.org>
To: Jared Finder <jared <at> finder.org>, Juri Linkov <juri <at> linkov.net>, Philip Kaludercic <philipk <at> posteo.net>, Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 68765 <at> debbugs.gnu.org
Subject: bug#68765: 30.0.50; Adding window-tool-bar package.
Date: Sat, 10 Feb 2024 10:19:37 +0200
> Date: Sat, 27 Jan 2024 15:36:56 -0800
> From:  Jared Finder via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> This is a follow-up from bug#68334 where there was interest in adding 
> support into Emacs core for tool bars in windows. 
> (https://debbugs.gnu.org/cgi/bugreport.cgi?bug=68334#52)  I have 
> attached three changes I authored to accomplish this, two small changes 
> to tool-bar and tab-line, and then a code drop of my window-tool-bar.el 
> package.  I have not yet put in documentation in NEWS or the manual 
> about window-tool-bar and was hoping to get a code review done first.

Thanks, please find some review comments below.

> Subject: [PATCH 1/3] Enable multiple modes to appear in tab line
> 
> This adds space for window-tool-bar-mode, which will be added in an
> upcoming commit.
> 
> * lisp/tab-line.el (tab-line-format-template): Add separator space.
> (tab-line-display-order): New user variable to control display order.
> (tab-line--runtime-display-order, tab-line--cookie): New internal
> variables.
> (tab-line-set-display): New function for modes to call to enable only
> their content.
> (tab-line-mode): Call `tab-line-set-display'.

Juri, would you please review this part of the changeset?

> Subject: [PATCH 2/3] Add user option to only display default tool bar
> 
> This works well with `window-tool-bar-mode', to be added in upcoming
> commit.  Then the default tool bar is displayed frame-wide and
> mode-specific tool bars are displayed in the window that mode is
> active in.
> 
> * lisp/tool-bar.el (tool-bar-always-show-default): New user option.
> (tool-bar--cache-key, tool-bar-make-keymap-1): Return default tool bar
> when option is set.
> ---
>  lisp/tool-bar.el | 17 +++++++++++++++--
>  1 file changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/lisp/tool-bar.el b/lisp/tool-bar.el
> index 96b61c7b229..685e4dfbb86 100644
> --- a/lisp/tool-bar.el
> +++ b/lisp/tool-bar.el
> @@ -100,7 +100,9 @@ secondary-tool-bar-map
>  (defconst tool-bar-keymap-cache (make-hash-table :test #'equal))
>  
>  (defsubst tool-bar--cache-key ()
> -  (cons (frame-terminal) (sxhash-eq tool-bar-map)))
> +  (cons (frame-terminal)
> +        (sxhash-eq (if tool-bar-always-show-default (default-value 'tool-bar-map)
> +                     tool-bar-map))))
>  
>  (defsubst tool-bar--secondary-cache-key ()
>    (cons (frame-terminal) (sxhash-eq secondary-tool-bar-map)))
> @@ -191,7 +193,9 @@ tool-bar-make-keymap-1
>  				      bind))
>  		  (plist-put plist :image image)))
>  	      bind))
> -	  (or map tool-bar-map)))
> +	  (or map
> +              (if tool-bar-always-show-default (default-value 'tool-bar-map)
> +                tool-bar-map))))
>  
>  ;;;###autoload
>  (defun tool-bar-add-item (icon def key &rest props)
> @@ -377,6 +381,15 @@ tool-bar-setup
>  	     (modify-all-frames-parameters
>  	      (list (cons 'tool-bar-position val))))))
>  
> +(defcustom tool-bar-always-show-default nil
> +  "If non-nil, do not show mode-specific tool bars.

Double negation alert!

> I think it would be good to have window-tool-bar.el also be a package so 
> that I can keep supporting Emacs 29 as well.  I am happy to have this 
> put on GNU ELPA and would appreciate help in getting that completed.
> [...]
> From 24ed752ec0bfdded24cba4892426c2c9710126cf Mon Sep 17 00:00:00 2001
> From: Jared Finder <jared <at> finder.org>
> Date: Fri, 26 Jan 2024 15:44:12 -0800
> 
> ---
>  lisp/window-tool-bar.el | 488 ++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 488 insertions(+)
>  create mode 100644 lisp/window-tool-bar.el

Philip and Stefan, would you please review this additional package,
which AFAIU is being proposed as a cofre package for ELPA?

> +This works well when using `global-window-tool-bar-mode' to
> +display the mode-specific tool bars attached to each window."

I don't think I understand what you mean by "mode-specific tool bars".
The doc string doesn't explain that, so it is not clear enough, IMO.

> +(defun window-tool-bar-show-memory-use ()
> +  "Pop up a window showing the memory use metrics."

I'm not sure I understand why this package needs to be interested in
memory usage.  It sounds like a separate feature.




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

Previous Next


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