> 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

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

Reply via email to