From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= Subject: Re: Frequently used files/headings Date: Mon, 10 May 2010 23:35:49 +0200 Message-ID: <87k4rb783u.fsf@gmail.com> References: <87fx20at17.fsf@gmail.com> <4BE875CC.20208@cs.tu-berlin.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from [140.186.70.92] (port=51013 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OBado-0003tt-Qb for emacs-orgmode@gnu.org; Mon, 10 May 2010 17:35:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OBadn-0003Xi-4V for emacs-orgmode@gnu.org; Mon, 10 May 2010 17:35:56 -0400 Received: from mail-fx0-f41.google.com ([209.85.161.41]:64362) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OBadm-0003Xb-UQ for emacs-orgmode@gnu.org; Mon, 10 May 2010 17:35:55 -0400 Received: by fxm9 with SMTP id 9so1224248fxm.0 for ; Mon, 10 May 2010 14:35:54 -0700 (PDT) In-Reply-To: <4BE875CC.20208@cs.tu-berlin.de> (Stephan Schmitt's message of "Mon, 10 May 2010 23:08:28 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Stephan Schmitt Cc: emacs-orgmode Stephan Schmitt writes: > Hi Nathan, > > when the lambda form is evaluated (when you press f6) the variable > shortcut-def doesn't exist any more. > > The problem is that elisp doesn't support closures. See > this info page: > (elisp) Top > Variables > Variable Scoping > Extent > > As a workaraound you can save the table in a global variable with setq > and access that variable in the lambda form. Another way would be to use `lexical-let' from the CL package, i.e.: (global-set-key (read-kbd-macro (second shortcut-def)) (lexical-let ((shortcut-def shortcut-def)) (lambda () (interactive) (org-id-goto (third shortcut-def))))) should do what you want. =C5=A0t=C4=9Bp=C3=A1n