emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nathan Neff <nathan.neff@gmail.com>
To: "Štěpán Němec" <stepnem@gmail.com>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: Frequently used files/headings
Date: Tue, 11 May 2010 10:42:03 -0500	[thread overview]
Message-ID: <AANLkTimXgtpKBrH-D8eOxsPEnST-09Qfx8m7Hkb2oUFi@mail.gmail.com> (raw)
In-Reply-To: <87k4rb783u.fsf@gmail.com>

> 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.
>
>  Štěpán
>

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       | <f6> a    | A33F7A0C-F974-4C7F-A4FD-1AAA6CF9C60E |
| Foo Org File       | <f6> f    | F3B14102-A66D-408C-8833-1F9CF7E5047C |
| Home               | <f6> h    | 772DFBDD-38A3-4E92-8860-6904CC9D4F49 |
| Nav Shortcuts      | <f6> <f6> | FC8A103B-5959-4A13-9735-F175C36CDC01 |


#+srcname: map-nav(shortcut-definition-list=shortcut-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

      reply	other threads:[~2010-05-11 15:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-29 15:47 Frequently used files/headings Nathan Neff
2010-05-06  7:06 ` Nathan Neff
2010-05-10 11:35   ` Štěpán Němec
2010-05-10 20:48     ` Nathan Neff
2010-05-10 21:08       ` Stephan Schmitt
2010-05-10 21:35         ` Štěpán Němec
2010-05-11 15:42           ` Nathan Neff [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AANLkTimXgtpKBrH-D8eOxsPEnST-09Qfx8m7Hkb2oUFi@mail.gmail.com \
    --to=nathan.neff@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=stepnem@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).