From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nathan Neff Subject: Re: Frequently used files/headings Date: Mon, 10 May 2010 15:48:44 -0500 Message-ID: References: <87fx20at17.fsf@gmail.com> 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=46470 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OBZuC-0004tj-Ee for emacs-orgmode@gnu.org; Mon, 10 May 2010 16:48:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OBZuA-0005NS-L8 for emacs-orgmode@gnu.org; Mon, 10 May 2010 16:48:48 -0400 Received: from mail-ww0-f41.google.com ([74.125.82.41]:54651) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OBZuA-0005NA-Fr for emacs-orgmode@gnu.org; Mon, 10 May 2010 16:48:46 -0400 Received: by wwf26 with SMTP id 26so145946wwf.0 for ; Mon, 10 May 2010 13:48:44 -0700 (PDT) In-Reply-To: <87fx20at17.fsf@gmail.com> 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: =?UTF-8?B?xaB0xJtww6FuIE7Em21lYw==?= Cc: emacs-orgmode On Mon, May 10, 2010 at 6:35 AM, =C5=A0t=C4=9Bp=C3=A1n N=C4=9Bmec wrote: > Nathan Neff writes: >> I tried something like this, but all I get is "Wrong type argument: >> integer-or-marker-p, (quote (second shortcut-def))" >> >> #+srcname: map-nav(navigation-shortcuts=3Dnavigation-shortcuts) >> #+begin_src emacs-lisp >> =C2=A0(defun map-navigation-shortcuts (shortcut-def) >> (global-set-key (kbd (second shortcut-def)) (lambda () "Goto Foo Org Fil= e" >> =C2=A0 =C2=A0 (interactive) >> =C2=A0 =C2=A0 (org-id-goto '(third shortcut-def))))) >> >> (mapcar #'map-navigation-shortcuts navigation-shortcuts) >> >> #+end_src >> >> Can anyone point out where I'm going wrong? > > I haven't tried your code, but the way you call `kbd' is obviously > wrong. > > `kbd' is a macro and does not evaluate its arguments; try > using `read-kbd-macro' instead. Stepan, Thanks for your help -- The keyboard shortcut is now being mapped correctly, but whenever I press a, I get "Symbol's value as a variable is void: shortcut-def" I suspect that (lambda()) is not evaluating (org-id-goto (third shortcut-def)). I need some way to do that. I would really like to know an "acceptable" or "standard" way to implement this feature -- I think it would help me a lot with learning Lisp & functional languages. Any help is appreciated! Here's my new code: #+tblname:navigation-shortcuts | Vim | a | 733BD03F-0938-432F-B59A-BE235A2DE7E2 | #+srcname: map-nav(navigation-shortcuts=3Dnavigation-shortcuts) #+begin_src emacs-lisp (defun map-navigation-shortcuts (shortcut-def) (global-set-key (read-kbd-macro (second shortcut-def)) (lambda () (interactive) (org-id-goto (third shortcut-def)))) ;; this line is not evaluated inside lambda() ) Thanks, --Nate