From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nathan Neff Subject: Re: Frequently used files/headings Date: Tue, 11 May 2010 10:42:03 -0500 Message-ID: References: <87fx20at17.fsf@gmail.com> <4BE875CC.20208@cs.tu-berlin.de> <87k4rb783u.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=47857 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OBrb3-0002KX-9y for emacs-orgmode@gnu.org; Tue, 11 May 2010 11:42:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OBraz-0002Fw-Ft for emacs-orgmode@gnu.org; Tue, 11 May 2010 11:42:11 -0400 Received: from mail-wy0-f169.google.com ([74.125.82.169]:33192) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OBrav-0002F7-5w for emacs-orgmode@gnu.org; Tue, 11 May 2010 11:42:09 -0400 Received: by wyi11 with SMTP id 11so680941wyi.0 for ; Tue, 11 May 2010 08:42:04 -0700 (PDT) In-Reply-To: <87k4rb783u.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 > Another way would be to use `lexical-let' from the CL package, i.e.: > > =C2=A0(global-set-key (read-kbd-macro (second shortcut-def)) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(lexical-le= t ((shortcut-def shortcut-def)) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(lam= bda () > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0(interactive) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0(org-id-goto (third shortcut-def))))) > > should do what you want. > > =C2=A0=C5=A0t=C4=9Bp=C3=A1n > This is very cool! Here's the final source code for defining shortcuts to headings in org-mode files, if anyone's interested: * Fast Navigation to Files :PROPERTIES: :ID: FC8A103B-5959-4A13-9735-F175C36CDC01 :END: - Create an ID using org-id-get-create (See the :ID: in the :PROPERTIES: for this heading) - Put that ID in the table below, along with your favorite shortcut sequence and a description - See "Nav Shortcuts" below for an example - Save oodles of time with your shortcuts, but waste the time writing lisp code to implement the shortcut list :-) #+tblname:shortcut-definition-list | Appointments | a | A33F7A0C-F974-4C7F-A4FD-1AAA6CF9C60E | | Foo Org File | f | F3B14102-A66D-408C-8833-1F9CF7E5047C | | Home | h | 772DFBDD-38A3-4E92-8860-6904CC9D4F49 | | Nav Shortcuts | | FC8A103B-5959-4A13-9735-F175C36CDC01 | #+srcname: map-nav(shortcut-definition-list=3Dshortcut-definition-list) #+begin_src emacs-lisp (defun map-navigation-shortcuts(shortcut-def) (global-set-key (read-kbd-macro (second shortcut-def)) (lexical-let ((shortcut-def shortcut-def)) (lambda () (interactive) (org-id-goto (third shortcut-def)))))) (mapcar #'map-navigation-shortcuts shortcut-definition-list) #+end_src