From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Marcin Borkowski Newsgroups: gmane.emacs.help Subject: Re: A problem with eval-after-load Date: Wed, 16 Oct 2013 20:31:39 +0200 Organization: WMI UAM Message-ID: <20131016203139.020765da@aga-netbook> References: <20131016111314.7fa2ccc9@aga-netbook> <87bo2pnm2p.fsf@web.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1381948322 7938 80.91.229.3 (16 Oct 2013 18:32:02 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 16 Oct 2013 18:32:02 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Oct 16 20:32:07 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VWVt8-0000dw-16 for geh-help-gnu-emacs@m.gmane.org; Wed, 16 Oct 2013 20:32:06 +0200 Original-Received: from localhost ([::1]:48868 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VWVt7-00011A-IP for geh-help-gnu-emacs@m.gmane.org; Wed, 16 Oct 2013 14:32:05 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42786) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VWVss-000115-Kb for help-gnu-emacs@gnu.org; Wed, 16 Oct 2013 14:31:55 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VWVsn-0003tA-Qb for help-gnu-emacs@gnu.org; Wed, 16 Oct 2013 14:31:50 -0400 Original-Received: from msg.wmi.amu.edu.pl ([2001:808:114:2::50]:37076) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VWVsn-0003t2-Je for help-gnu-emacs@gnu.org; Wed, 16 Oct 2013 14:31:45 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by msg.wmi.amu.edu.pl (Postfix) with ESMTP id 857DE4E1E8 for ; Wed, 16 Oct 2013 20:31:43 +0200 (CEST) Original-Received: from msg.wmi.amu.edu.pl ([127.0.0.1]) by localhost (msg.wmi.amu.edu.pl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WVXUlxNHL6h8 for ; Wed, 16 Oct 2013 20:31:43 +0200 (CEST) Original-Received: from aga-netbook (99-52.echostar.pl [213.156.99.52]) by msg.wmi.amu.edu.pl (Postfix) with ESMTPSA id 4F3E04E1CC for ; Wed, 16 Oct 2013 20:31:42 +0200 (CEST) In-Reply-To: <87bo2pnm2p.fsf@web.de> X-Mailer: Claws Mail 3.8.1 (GTK+ 2.24.17; i686-pc-linux-gnu) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:808:114:2::50 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:94047 Archived-At: Dnia 2013-10-16, o godz. 19:48:46 Michael Heerdegen napisa=C5=82(a): > Marcin Borkowski writes: >=20 > > Hi all, >=20 > Hi! >=20 > > I have a problem with eval-after-load. (In fact, this is one of the > > reasons I subscribed to this list;).) I have something like this > > in my init.el: > > > > (eval-after-load 'org-tree-slide '(setq org-tree-slide-mode-map > > (let ((map (make-sparse-keymap))) > > (define-key map (kbd "") 'org-tree-slide-content) > > (define-key map (kbd "") 'org-tree-slide-move-previous-tree) > > (define-key map (kbd "") 'org-tree-slide-move-next-tree) > > map))) > > > > (load-file "~/some/path/org-tree-slide/org-tree-slide.el") > > > > The rationale is that I did not like the default keybindings of > > org-tree-slide (which is an Org-mode based simple presentation > > tool). > > > > The problem is that this doesn't work: the keymap is not updated. > > When I load the org-tree-slide.el *manually*, somehow it gets > > updated. (It is a bit embarassing that I noticed it before I > > posted this blog post: > > http://mbork.pl/2013-10-09_Better_keymap_for_org-tree-slide > > , > > but I didn't notice this at first. I will update the said post as > > soon as I understand what's going on here.) > > > > Of course, I could just get rid of eval-after-load and change the > > order of the loading and redefining the keymap - but I want to know > > what's the problem. (Initially, I didn't want to load > > org-tree-slide by default, hence the eval-after-load stuff. Then, > > I decided it won't hurt to have it loaded always. I should > > probably learn to use autoload.) > > > > Am I doing something wrong? >=20 > AFAIK, when the minor mode is defined, the _value_ of the map variable > is used. The function object representing the mode doesn't refer to > the keymap variable, but only to the value (a keymap, typically a > nested list structure). >=20 > That implies that setting the variable has no effect once the mode has > been defined. So, `eval-after-load' is wrong here, you must set the > map variable _before_ loading the file. Thanks! It's so obvious now... (I didn't see this in the manual, though I didn't read it *very* carefully, so maybe I missed it.) > Regards, >=20 > Michael. Best, --=20 Marcin Borkowski http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski Adam Mickiewicz University