[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: minor mode map question

From: Stefan Monnier
Subject: Re: minor mode map question
Date: Mon, 26 Feb 2007 15:09:34 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.92 (gnu/linux)

> I wish that you could provide, as the cdr of an entry to
> `minor-mode-map-alist', an expression to be evaled to a keymap value, or
> perhaps a function that is called to return a keymap value. That would
> obviate needing to delete and re-add an entry, just to ensure that the alist
> is up-to-date whenever the keymap changes. It seems a bit weird to me that
> `minor-mode-map-alist' is so static, given how dynamic Emacs is otherwise.
> Why not use a keymap-valued variable or keymap-returning function here,
> instead of an actual keymap?

A keymap-valued variable is quite doable.
But something more dynamic is slightly tricky because the code tries to only
allocate memory *after* processing *one* key.  The reason is that in case we
run out of memory, we still want to guarantee progress (or something like

Basically we want to avoid something like:
1 - prepare to read a key: fetch the active keymaps.
2 - oops, running out of memory while doing that, let's signal an error.
3 - unhandled error, let's go back to the toplevel (i.e. to point 1).

I'm not sure how important it is to avoid such a freeze, since the
alternative is "read a key, signal an error, read a key, signal an error",
but the code does go through some extra trouble for this.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]