GNU bug report logs -
#19480
Tool-bar modifications not reflected on display
Previous Next
Reported by: Eli Zaretskii <eliz <at> gnu.org>
Date: Thu, 1 Jan 2015 15:36:02 UTC
Severity: normal
Fixed in version 29.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 19480 in the body.
You can then email your comments to 19480 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#19480
; Package
emacs
.
(Thu, 01 Jan 2015 15:36:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Eli Zaretskii <eliz <at> gnu.org>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
Your message did not contain a Subject field. They are recommended and
useful because the title of a $gBug is determined using this field.
Please remember to include a Subject field in your messages in future.
(Thu, 01 Jan 2015 15:36:03 GMT) Full text and rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Moved this here from help-gnu-emacs. For the original thread, see
http://lists.gnu.org/archive/html/help-gnu-emacs/2014-12/msg00379.html.]
> From: Michael Heerdegen <michael_heerdegen <at> web.de>
> Date: Wed, 31 Dec 2014 23:13:54 +0100
> Cc: Emacs Help <help-gnu-emacs <at> gnu.org>,
> Stefan Monnier <monnier <at> iro.umontreal.ca>
>
> Bostjan Vilfan <bjvilfan <at> gmail.com> writes:
>
> (progn
> (define-key global-map [tool-bar bvdotex] 'tex-file)
> (tool-bar-local-item "save" 'tex-file 'bvdotex tool-bar-map
> :help "Process file with default tex command"))
>
> Evaluate it, and you have to "do some things" until the item is displayed.
> No way of redisplay helps to force the displaying of the button, and it
> seems to appear after a random command.
>
> I guess all the Emacs modes set up the toolbar before it is actually
> displayed. Doing it afterwards doesn't seem to work reliably. I don't
> see such a limitation being described in the manual
This should fix the problem:
(progn
(define-key global-map [tool-bar bvdotex] 'tex-file)
(tool-bar-local-item "save" 'tex-file 'bvdotex tool-bar-map
:help "Process file with default tex command")
(force-mode-line-update)
(garbage-collect))
The last line is the reason that you need to "do some things" in order
for the tool bar to get updated: you need to eval enough stuff so that
Emacs enters GC.
This is a clear bug, and it has 2 parts, an easy one and a harder one.
The easy part is to add a call to force-mode-line-update to 2
functions that modify tool-bar-map (done in commit 5a9710f on the
emacs-24 branch).
The harder part, the one that requires a GC, has something to do with
the fact that we use a hash table to avoid recomputing tool-bar items
when the tool bar didn't change. From tool-bar.el:
(global-set-key [tool-bar]
`(menu-item ,(purecopy "tool bar") ignore
:filter tool-bar-make-keymap))
(defconst tool-bar-keymap-cache (make-hash-table :weakness t :test 'equal))
(defun tool-bar-make-keymap (&optional _ignore)
"Generate an actual keymap from `tool-bar-map'.
Its main job is to figure out which images to use based on the display's
color capability and based on the available image libraries."
(let ((key (cons (frame-terminal) tool-bar-map)))
(or (gethash key tool-bar-keymap-cache)
(puthash key (tool-bar-make-keymap-1) tool-bar-keymap-cache))))
We started doing this in Emacs 23, and sure enough, this problem
didn't exist in Emacs 22, where just evaluating the original progn
above, without the last two lines, immediately caused the tool bar to
be updated. Emacs 23 already exhibits the problem.
By stepping through tool-bar-make-keymap, I've discovered that after
the tool-bar-map is updated, gethash still returns non-nil, as if the
old value of tool-bar-map were still in effect. So we don't recompute
the updated keymap from tool-bar-map, and redisplay doesn't think the
tool bar changed and should be redrawn.
Mind you, this is on MS-Windows, which represents the toolkits where
Emacs itself displays the tool bar; the GTK and NS builds might have
different or additional quirks.
I hope the above will give enough info to keymap experts to fix the
remaining problem (please do that on the emacs-24 branch).
Changed bug title to 'Tool-bar modifications not reflected on display' from '(no subject)'
Request was from
Eli Zaretskii <eliz <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Thu, 01 Jan 2015 16:00:03 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#19480
; Package
emacs
.
(Thu, 01 Jan 2015 20:39:02 GMT)
Full text and
rfc822 format available.
Message #10 received at 19480 <at> debbugs.gnu.org (full text, mbox):
Hi Eli,
> This should fix the problem:
>
> (progn
> (define-key global-map [tool-bar bvdotex] 'tex-file)
> (tool-bar-local-item "save" 'tex-file 'bvdotex tool-bar-map
> :help "Process file with default tex command")
> (force-mode-line-update)
> (garbage-collect))
I can confirm that this avoids the problem under Debian Gnu/Linux using
the GTK+ toolkit.
Michael.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#19480
; Package
emacs
.
(Thu, 01 Jan 2015 20:57:02 GMT)
Full text and
rfc822 format available.
Message #13 received at 19480 <at> debbugs.gnu.org (full text, mbox):
> From: Michael Heerdegen <michael_heerdegen <at> web.de>
> Cc: bjvilfan <at> gmail.com, 19480 <at> debbugs.gnu.org
> Date: Thu, 01 Jan 2015 21:37:52 +0100
>
> Hi Eli,
>
> > This should fix the problem:
> >
> > (progn
> > (define-key global-map [tool-bar bvdotex] 'tex-file)
> > (tool-bar-local-item "save" 'tex-file 'bvdotex tool-bar-map
> > :help "Process file with default tex command")
> > (force-mode-line-update)
> > (garbage-collect))
>
> I can confirm that this avoids the problem under Debian Gnu/Linux using
> the GTK+ toolkit.
Thanks for checking.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#19480
; Package
emacs
.
(Tue, 03 May 2022 16:59:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 19480 <at> debbugs.gnu.org (full text, mbox):
This was fixed for Emacs 29 in the bug#43397 bug report, so I'm also
closing this one.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
bug marked as fixed in version 29.1, send any further explanations to
19480 <at> debbugs.gnu.org and Eli Zaretskii <eliz <at> gnu.org>
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Tue, 03 May 2022 16:59:03 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 01 Jun 2022 11:24:08 GMT)
Full text and
rfc822 format available.
This bug report was last modified 3 years and 75 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.