From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: minor mode map question Date: Mon, 26 Feb 2007 15:09:34 -0500 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1172520633 26883 80.91.229.12 (26 Feb 2007 20:10:33 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 26 Feb 2007 20:10:33 +0000 (UTC) Cc: Emacs-Devel To: "Drew Adams" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Feb 26 21:10:25 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HLmAy-0001Od-Eb for ged-emacs-devel@m.gmane.org; Mon, 26 Feb 2007 21:10:24 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HLmAx-0006Zd-Un for ged-emacs-devel@m.gmane.org; Mon, 26 Feb 2007 15:10:23 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HLmAN-0006Nt-MW for emacs-devel@gnu.org; Mon, 26 Feb 2007 15:09:47 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HLmAL-0006M4-4a for emacs-devel@gnu.org; Mon, 26 Feb 2007 15:09:47 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HLmAL-0006M0-1W for emacs-devel@gnu.org; Mon, 26 Feb 2007 15:09:45 -0500 Original-Received: from mercure.iro.umontreal.ca ([132.204.24.67]) by monty-python.gnu.org with esmtp (Exim 4.52) id 1HLmAK-0001LU-Lq for emacs-devel@gnu.org; Mon, 26 Feb 2007 15:09:44 -0500 Original-Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id 684B22CEFB4; Mon, 26 Feb 2007 15:09:44 -0500 (EST) Original-Received: from faina.iro.umontreal.ca (faina.iro.umontreal.ca [132.204.26.177]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id 078943FE0; Mon, 26 Feb 2007 15:09:35 -0500 (EST) Original-Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id E9AF26C1AD; Mon, 26 Feb 2007 15:09:34 -0500 (EST) In-Reply-To: (Drew Adams's message of "Sun\, 31 Dec 2006 18\:15\:26 -0800") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.92 (gnu/linux) X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-2.82, requis 5, autolearn=not spam, ALL_TRUSTED -2.82) X-DIRO-MailScanner-From: monnier@iro.umontreal.ca X-detected-kernel: Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:66875 Archived-At: > 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