* Binding a key to org-store-link in a shell (non-eshell)
@ 2009-10-18 12:01 Friedrich Delgado Friedrichs
0 siblings, 0 replies; only message in thread
From: Friedrich Delgado Friedrichs @ 2009-10-18 12:01 UTC (permalink / raw)
To: Emacs-orgmode mailing list
[-- Attachment #1.1: Type: text/plain, Size: 1524 bytes --]
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:
friedel@abrasax:~/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 <friedel@nomaden.org>
TauPan on Ircnet and Freenode ;)
[-- Attachment #1.2: Type: application/pgp-signature, Size: 198 bytes --]
[-- Attachment #2: Type: text/plain, Size: 204 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-10-18 12:01 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-18 12:01 Binding a key to org-store-link in a shell (non-eshell) Friedrich Delgado Friedrichs
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).