emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nathan Neff <nathan.neff@gmail.com>
To: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: Frequently used files/headings
Date: Thu, 6 May 2010 02:06:56 -0500	[thread overview]
Message-ID: <l2z211769421005060006x615f6006ie84fdd361086db8a@mail.gmail.com> (raw)
In-Reply-To: <t2i211769421004290847pe2d31a48s96cc5a6fa4cdf65b@mail.gmail.com>

On Thu, Apr 29, 2010 at 10:47 AM, Nathan Neff <nathan.neff@gmail.com> wrote:
> Currently, I'm using org-id-get-create to generate a unique ID
> for headings that I frequently go to in org-mode.
>
> * Foo
> :PROPERTIES:
> :ID: F3B14102-A66D-408C-8833-1F9CF7E5047C
> :END:
>
> Then, I copy the newly created ID to the kill-ring,
> and paste it into a block like this:
>
> (global-set-key (kbd "<f6> f") (lambda () "Goto Foo Org File"
>    (interactive)
>    (org-id-goto "F3B14102-A66D-408C-8833-1F9CF7E5047C")))
>
> This will map F6-f to jump to Foo.
>
> I know that there are many ways to navigate org-files, but using the
> ID is great because it requires only two keystrokes.
>
> This works pretty good, except I'd like to improve three things:
>
> 1)  I'd like to be able to see a menu of where I've mapped my shortcuts
> 2)  I'd like to simplify the creation of these IDs and shortcut keys.
> 3)  I have about 10 quick-keys now, so I have 30 lines of very similar code
>
> I'm sensing an org-babel type approach where I could define an org-mode
> table like this:
>
> | Name | Key       | ID |
> | Foo    | "<f6> f"  | 123456779 |
>
> Then, I could loop through the table, and for each row, I could
> run this code:
>
> (global-set-key (kbd <COLUMN 2>) (lambda () <COLUMN 1>
>    (interactive)
>    (org-id-goto <COLUMN 3>)))
>

I've made some progress on this, and I've defined a table like this:

#+tblname:navigation-shortcuts
| Foo Org File        | <f6 v>   | 733BD03F-0938-432F-B59A-BE235A2DE7E2 |
| Bar Org File        |  <f6 b>  |  123456 |

I would like to map a function that iterates over the items in the
table, and maps
the keyboard string in column 2 to the ID in column 3.

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?

Thanks,
--Nate

  reply	other threads:[~2010-05-06  9:55 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 [this message]
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

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=l2z211769421005060006x615f6006ie84fdd361086db8a@mail.gmail.com \
    --to=nathan.neff@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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).