emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Edward Lilley <ejlilley@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Encoded slashes in capture protocol URIs (via Chromium)
Date: Sat, 04 Dec 2010 14:23:55 +0000	[thread overview]
Message-ID: <m3ipz9aa6c.fsf@gmail.com> (raw)

I've just had quite a bit of trouble setting up org capture protocol
handling with the Chromium web browser.

Using the Javascript function encodeURIComponent() replaces slashes with
a %2F, as expected; the problem is then that xdg-open fails to open URIs
containing %2F. Eventually I realised that xdg-open *can* accept a %2F,
but *only* if it comes after a "?" in the URI.

So, as an ugly hack, I set the identifying character for the org-capture
template that handles my bookmarks to be a "?"; this way, any occurrence
of %2F will come after a "?", so xdg-open won't complain!

So the bookmarklet (attached to the F4 key in chromium, using the
"yakshave" extension" looks like this:

yak.bindings.add({
    '<f4>': {
        onkeydown: function(event) {
        eval('location.href="org-protocol:/capture:/?/" +
        encodeURIComponent(location.href) + "/" +
        encodeURIComponent(document.title) + "/" +
        encodeURIComponent(window.getSelection());');
        }
    }
});

Of course this is basically a horrible hack; but it might help some of
you out very slightly!

-- 
Edward Lilley <ejlilley@gmail.com>
http://www.ugnus.uk.eu.org/~edward/

             reply	other threads:[~2010-12-04 15:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-04 14:23 Edward Lilley [this message]
2010-12-04 17:59 ` Encoded slashes in capture protocol URIs (via Chromium) Mattias Jämting

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=m3ipz9aa6c.fsf@gmail.com \
    --to=ejlilley@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).