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: bizarre problem with minor mode defined using define-minor-mode Date: Tue, 11 Jan 2011 16:42:58 -0500 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1294782562 23215 80.91.229.12 (11 Jan 2011 21:49:22 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 11 Jan 2011 21:49:22 +0000 (UTC) Cc: emacs-devel@gnu.org To: ken manheimer Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jan 11 22:49:18 2011 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.69) (envelope-from ) id 1Pcm5C-00014N-TM for ged-emacs-devel@m.gmane.org; Tue, 11 Jan 2011 22:49:15 +0100 Original-Received: from localhost ([127.0.0.1]:40599 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pclzy-0004SI-Ht for ged-emacs-devel@m.gmane.org; Tue, 11 Jan 2011 16:43:26 -0500 Original-Received: from [140.186.70.92] (port=53491 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pclzk-0004S0-66 for emacs-devel@gnu.org; Tue, 11 Jan 2011 16:43:21 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pclza-0005Y2-Lx for emacs-devel@gnu.org; Tue, 11 Jan 2011 16:43:09 -0500 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]:43377) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pclza-0005Xi-Jb for emacs-devel@gnu.org; Tue, 11 Jan 2011 16:43:02 -0500 Original-Received: from faina.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id p0BLgww9026739; Tue, 11 Jan 2011 16:42:58 -0500 Original-Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id 65CD2B4AAD; Tue, 11 Jan 2011 16:42:58 -0500 (EST) In-Reply-To: (ken manheimer's message of "Sat, 25 Dec 2010 19:31:42 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV3735=0 X-detected-operating-system: by eggs.gnu.org: GNU/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:134455 Archived-At: > i've tried tracking down the failed key substitutions, by > wrapping define-key with some advice that noted when the key defines > happened, and they do every time the mode is activated, whether or not it's > via the byte-compiled version of the mode function (when defined > by define-minor-mode). my function which does the key > substitutions (allout-setup-mode-map) uses fset to ensure that the mode map > is properly globally established, so it's already kind of complicated. i'm > also wondering whether i'm just misunderstanding something about the way > define-minor-mode is supposed to work. I think the code is too complex for its own good, so I can't really track down the problem. But AFAICT, the `allout-mode-map' symbol is never used as a keymap, so the (fset 'allout-mode-map allout-mode-map) has no effect: all the rest of the code uses the allout-mode-map *variable* (i.e. the value stored in the `symbol-value' part of the allout-mode-map symbol). Stefan PS: While I'm here, don't use `setq' at top-level. Either put the right initial value into `defvar', or if you want that value to be re-set when rereading the file, use `defconst' instead of defvar, but don't use `setq' at top-level.