[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Orgmode] Binding a key to org-store-link in a shell (non-eshell)
From: |
Friedrich Delgado Friedrichs |
Subject: |
[Orgmode] Binding a key to org-store-link in a shell (non-eshell) |
Date: |
Sun, 18 Oct 2009 14:01:05 +0200 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
Hi!
I usually prefer to use a regular shell in screen, and today I wanted
to press my <f9>n remember keybinding on the shell, which already
works in mutt and emacs (and also via bookmarklet, shortcut 'a', in
firefox).
I use zsh, I'm not a zsh expert (still a newbie after a couple of
years), but I managed to cook up the following:
In my .zshrc:
# bind <f9>n to org-store-link
bindkey -s "\e[20~n" 'emacsclient
org-protocol://store-link://file:`uriescapepwd.pl`\n'
And I have a little perl program in my $PATH, because doing it all with perl -e
demanded too many levels of quoting which confused me and zsh alike:
uriescapepwd.pl:
#!/usr/bin/perl -w
use URI::Escape qw/ uri_escape uri_escape_utf8 /;
use Cwd qw/getcwd abs_path/;
$pwd = abs_path(getcwd);
print uri_escape_utf8($pwd);
Now I press <f9>n on the shell prompt and the following happens:
address@hidden:~/anon-vc/org-mode> emacsclient
org-protocol://store-link://file:`uriescapepwd.pl`
Waiting for Emacs...
And I can press Ctrl-l in an org mode buffer to insert that link.
Good enough for me ;)
Questions:
- Are there any zsh veterans here who know a cleaner, nicer, more
zsh-y way of doing this?
- Any bash (or tcsh, ksh) user wants to jump in and provide their equivalent?
- Any idea how to do this without perl, just with emacs and the shell?
Have a nice sunday!
FDF
--
Friedrich Delgado Friedrichs <address@hidden>
TauPan on Ircnet and Freenode ;)
pgpBZnBuW0aNz.pgp
Description: PGP signature
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Orgmode] Binding a key to org-store-link in a shell (non-eshell),
Friedrich Delgado Friedrichs <=