On Mon, May 10, 2010 at 6:35 AM, Štěpán Němec<address@hidden> wrote:
Nathan Neff<address@hidden> 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=navigation-shortcuts)
#+begin_src emacs-lisp
(defun map-navigation-shortcuts (shortcut-def)
(global-set-key (kbd (second shortcut-def)) (lambda () "Goto Foo Org File"
(interactive)
(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<f6> 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 |<f6> a | 733BD03F-0938-432F-B59A-BE235A2DE7E2 |
#+srcname: map-nav(navigation-shortcuts=navigation-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
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
address@hidden
http://lists.gnu.org/mailman/listinfo/emacs-orgmode