From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?Q?Mattias_J=C3=A4mting?= Subject: Re: Encoded slashes in capture protocol URIs (via Chromium) Date: Sat, 4 Dec 2010 18:59:41 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1561125792==" Return-path: Received: from [140.186.70.92] (port=33082 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1POwP5-0000eT-1F for emacs-orgmode@gnu.org; Sat, 04 Dec 2010 13:00:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1POwP2-0006OS-3j for emacs-orgmode@gnu.org; Sat, 04 Dec 2010 13:00:10 -0500 Received: from mail-qw0-f41.google.com ([209.85.216.41]:39884) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1POwP2-0006Nq-0L for emacs-orgmode@gnu.org; Sat, 04 Dec 2010 13:00:08 -0500 Received: by qwk4 with SMTP id 4so989920qwk.0 for ; Sat, 04 Dec 2010 10:00:03 -0800 (PST) Received: by qyk10 with SMTP id 10so12454282qyk.0 for ; Sat, 04 Dec 2010 10:00:01 -0800 (PST) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Cc: emacs-orgmode@gnu.org --===============1561125792== Content-Type: multipart/alternative; boundary=00163630f8277edbdb0496996cb1 --00163630f8277edbdb0496996cb1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I solved it in a different way, but none the less very hacky :) http://www.mail-archive.com/emacs-orgmode@gnu.org/msg33861.html /Mattias On Sat, Dec 4, 2010 at 15:23, Edward Lilley wrote: > 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({ > '': { > onkeydown: function(event) { > eval('location.href=3D"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 > http://www.ugnus.uk.eu.org/~edward/ > > > > _______________________________________________ > Emacs-orgmode mailing list > Please use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode > > --=20 * Mattias J=C3=A4mting * www.jwd.se | mattias@jwd.se | 070-6760182 *Internet, Coding, Design, Usablility - since 1998 * --00163630f8277edbdb0496996cb1 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I solved it in a different way, but none the less very hacky :)

http://www.mail-archive.com/emacs-orgmode@gnu.org/msg33861.html<= /div>

/Mattias

On Sat,= Dec 4, 2010 at 15:23, Edward Lilley <ejlilley@gmail.com> wrote:
I've just had quite a bit of trouble se= tting 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 occ= urrence
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({
=C2=A0 =C2=A0'<f4>': {
=C2=A0 =C2=A0 =C2=A0 =C2=A0onkeydown: function(event) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0eval('location.href=3D"org-protocol:/c= apture:/?/" +
=C2=A0 =C2=A0 =C2=A0 =C2=A0encodeURIComponent(location.href) + "/&quo= t; +
=C2=A0 =C2=A0 =C2=A0 =C2=A0encodeURIComponent(document.title) + "/&qu= ot; +
=C2=A0 =C2=A0 =C2=A0 =C2=A0encodeURIComponent(window.getSelection());'= );
=C2=A0 =C2=A0 =C2=A0 =C2=A0}
=C2=A0 =C2=A0}
});

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

--
Edward Lilley <ejlilley@gmail.com<= /a>>
http://ww= w.ugnus.uk.eu.org/~edward/



_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode




--

=C2=A0Mattias J=C3=A4mting = =C2=A0=C2=A0www.jwd.se=C2=A0|=C2=A0mattias@jwd.se=C2=A0| 070-6760182