From: Jared Finder via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 68334@debbugs.gnu.org
Subject: bug#68334: 29.1; tool-bar-make-keymap-1 does not work on terminals
Date: Wed, 10 Jan 2024 14:59:25 -0800 [thread overview]
Message-ID: <8721504db5c2be47352db0230248f036@finder.org> (raw)
In-Reply-To: <83plyaptn8.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 1450 bytes --]
On 2024-01-09 04:40, Eli Zaretskii wrote:
>> Date: Mon, 08 Jan 2024 13:39:25 -0800
>> From: Jared Finder via "Bug reports for GNU Emacs,
>> the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>>
>> I'd like tool-bar-make-keymap-1 to return a sensible keymap on
>> terminals. This is only a small change from current code, patch
>> attached.
>
> I don't see any problems with the change, but please add comments
> there explaining that some parts of the code are supposed to work on
> frames where images cannot be displayed, because it is very easy to
> mistakenly assume this only needs to work on GUI frames.
New patch attached with comment added.
For the other discussions about making per-window tool bars part of
core, I expect a handful of additional patches so I can file a separate
bug report if that makes tracking things easier.
> Btw, what happens if display-images-p returns non-nil, but the session
> doesn't support images of the type used for tool-bar icons?
Then a keybind is generated with no image spec because find-image will
not find any supported image. Such binds are silently ignored by the
current tool bar logic on PGTK and Mac builds. You can see this
behavior today in M-x customize, where the " Toggle hiding all values "
bind is not displayed. I was going to report this as a separate bug
because this behavior seems poor -- I think a text only tool bar button
would be preferred.
-- MJF
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-tool-bar.el-tool-bar-make-keymap-1-Populate-on-.patch --]
[-- Type: text/x-diff; name=0001-lisp-tool-bar.el-tool-bar-make-keymap-1-Populate-on-.patch, Size: 1740 bytes --]
From 7581bfda5dfe3ad5732da6b518b8c77e350b1b9e Mon Sep 17 00:00:00 2001
From: Jared Finder <jared@finder.org>
Date: Mon, 8 Jan 2024 13:20:25 -0800
Subject: [PATCH] * lisp/tool-bar.el (tool-bar-make-keymap-1): Populate on
terminals
---
lisp/tool-bar.el | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/lisp/tool-bar.el b/lisp/tool-bar.el
index 4ca81fb01e0..96b61c7b229 100644
--- a/lisp/tool-bar.el
+++ b/lisp/tool-bar.el
@@ -165,6 +165,8 @@ tool-bar-make-keymap
base-keymap)
base-keymap)))
+;; This function should return binds even if images can not be
+;; displayed so the tool bar can still be displayed on terminals.
(defun tool-bar-make-keymap-1 (&optional map)
"Generate an actual keymap from `tool-bar-map', without caching.
MAP is either a keymap to use as a source for menu items, or nil,
@@ -180,15 +182,14 @@ tool-bar-make-keymap-1
(consp image-exp)
(not (eq (car image-exp) 'image))
(fboundp (car image-exp)))
- (if (not (display-images-p))
- (setq bind nil)
- (let ((image (eval image-exp)))
- (unless (and image (image-mask-p image))
- (setq image (append image '(:mask heuristic))))
- (setq bind (copy-sequence bind)
- plist (nthcdr (if (consp (nth 4 bind)) 5 4)
- bind))
- (plist-put plist :image image))))
+ (let ((image (and (display-images-p)
+ (eval image-exp))))
+ (unless (and image (image-mask-p image))
+ (setq image (append image '(:mask heuristic))))
+ (setq bind (copy-sequence bind)
+ plist (nthcdr (if (consp (nth 4 bind)) 5 4)
+ bind))
+ (plist-put plist :image image)))
bind))
(or map tool-bar-map)))
--
2.39.2
next prev parent reply other threads:[~2024-01-10 22:59 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-08 21:39 bug#68334: 29.1; tool-bar-make-keymap-1 does not work on terminals Jared Finder via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-08 23:04 ` bug#68334: window-tool-bar (bug#68334) Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-09 13:06 ` Eli Zaretskii
2024-01-09 4:57 ` bug#68334: 29.1; tool-bar-make-keymap-1 does not work on terminals Stefan Kangas
2024-01-09 7:58 ` Juri Linkov
2024-01-09 13:13 ` Eli Zaretskii
2024-01-09 18:39 ` Stefan Kangas
2024-01-09 18:57 ` Eli Zaretskii
2024-01-09 19:08 ` Stefan Kangas
2024-01-09 19:28 ` Jared Finder via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-09 19:56 ` Eli Zaretskii
2024-01-10 7:24 ` Juri Linkov
2024-01-09 12:40 ` Eli Zaretskii
2024-01-10 22:59 ` Jared Finder via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-01-11 10:51 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8721504db5c2be47352db0230248f036@finder.org \
--to=bug-gnu-emacs@gnu.org \
--cc=68334@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=jared@finder.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).