unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: "Drew Adams" <drew.adams@oracle.com>
Cc: Emacs-Devel <emacs-devel@gnu.org>
Subject: Re: minor mode map question
Date: Mon, 26 Feb 2007 15:09:34 -0500	[thread overview]
Message-ID: <jwvlkiksn3t.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <EIENLHALHGIMHGDOLMIMGEPECNAA.drew.adams@oracle.com> (Drew Adams's message of "Sun\, 31 Dec 2006 18\:15\:26 -0800")

> 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
that).

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.


        Stefan

      parent reply	other threads:[~2007-02-26 20:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-28  7:00 minor mode map question Drew Adams
2007-01-01  2:15 ` Drew Adams
2007-01-02  3:08   ` Richard Stallman
2007-02-26 18:04   ` Johan Bockgård
2007-02-26 20:09   ` Stefan Monnier [this message]

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=jwvlkiksn3t.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.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).