Subject: bug#43397: 28.0.50; Adding tool bar items: update tool bar

From: Lars Ingebrigtsen <[email-masked]>
Date: Tue, 03 May 2022 18:39:51 +0200

Stefan Monnier <[email-masked]> writes:

> `tool-bar-map` is a normal keymap, which we modify in the usual way,
> i.e. via side-effect.  So the key we place in this `equal` hash table
> will be routinely modified via side-effect, thus changing its sxhash.

Hm...  I assumed that that was the point, really, but that it didn't
work for...  reasons...  I.e., whenever somebody modifies the map, the
cache is supposed to be refreshed.  I don't understand why that didn't
work, but it doesn't.

> Maybe we'd be better off using an `eq` hash table and manually flushing
> the corresponding entry whenever `tool-bar-map` is modified by
> side-effect.

Yup.  Should be faster, too.

> I also see that we use a `:weakness t` but the values stored there will
> usually not be stored anywhere else, so the hash table will be
> completely flushed at every GC (and partly refilled soon after as part
> of redisplay).

Yeah, that's true, too.  But if we have flushing, then we can probably
make it non-weak, because we'll get rid up the values that way.

> It should have `:weakness 'key` instead (but without
> fixing the current bug report, this will cause the keymap to never be
> refreshed until we manually flush the hash table ;-).

I added flushing in one of the interface functions -- I didn't know
whether any needed it, but they probably do.  

I'll poke around a bit.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no