From: Friedrich Delgado Friedrichs <friedel@nomaden.org>
To: Emacs-orgmode mailing list <emacs-orgmode@gnu.org>
Subject: Binding a key to org-store-link in a shell (non-eshell)
Date: Sun, 18 Oct 2009 14:01:05 +0200 [thread overview]
Message-ID: <20091018120105.GA30519@taupan.ath.cx> (raw)
[-- 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
reply other threads:[~2009-10-18 12:01 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091018120105.GA30519@taupan.ath.cx \
--to=friedel@nomaden.org \
--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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.