* A patch for a workaround for Chrome - org-protocol use on Gnome/Linux
@ 2012-04-14 23:35 Harri Kiiskinen
0 siblings, 0 replies; only message in thread
From: Harri Kiiskinen @ 2012-04-14 23:35 UTC (permalink / raw)
To: emacs-orgmode
Hi,
below is a small patch that adds a custom separator to
org-protocol.el. This is useful for using org-protocol with Google
Chrome browser, which does not allow the direct use of 'emacsclient'
and one is forced to use the OS protocol handlers. Which in the case
of Gnome use the gvfs which has a long-standing bug concerning escaped
URI's in the protocol string. This made the URI:s escaped with
'encodeURIComponent' unusable with gvfs. With the custom separator,
the separator can be, for example, something like '|||' or as
complicated as one likes, and the URI's can be used unescaped.
I hope the patch is useable; the changes are 8 lines, so I think I
should still be below 20...
All the best,
Harri Kiiskinen
harkiisk@gmail.com
From b869fc378504cce18a19404b4dbdf8ad9a8a02c0 Mon Sep 17 00:00:00 2001
From: Harri Kiiskinen <harri@pp-kaitue.(none)>
Date: Sun, 15 Apr 2012 02:07:48 +0300
Subject: [PATCH] * org-protocol.el: Added a variable to customize the separator in the data supplied to the protocol handlers. This
allows one to skip the use of encodeURIComponent in the browser and allows therefore the use of gvfs-open in the
protocol handler, since it seems that the respective gvfs bug is not going to be fixed.
TINYCHANGE
---
lisp/org-protocol.el | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/lisp/org-protocol.el b/lisp/org-protocol.el
index 6ffa86a..30d13ca 100644
--- a/lisp/org-protocol.el
+++ b/lisp/org-protocol.el
@@ -274,6 +274,12 @@ string with two characters."
:group 'org-protocol
:type 'string)
+(defcustom org-protocol-data-separator "/+"
+ "The default data separator to use.
+ This should be a single regexp string."
+ :group 'org-protocol
+ :type 'string)
+
;;; Helper functions:
(defun org-protocol-sanitize-uri (uri)
@@ -373,7 +379,7 @@ could contain slashes and the location definitely will.
The sub-protocol used to reach this function is set in
`org-protocol-protocol-alist'."
- (let* ((splitparts (org-protocol-split-data fname t))
+ (let* ((splitparts (org-protocol-split-data fname t org-protocol-data-separator))
(uri (org-protocol-sanitize-uri (car splitparts)))
(title (cadr splitparts))
orglink)
@@ -434,7 +440,7 @@ Now template ?b will be used."
(defun org-protocol-do-capture (info capture-func)
"Support `org-capture' and `org-remember' alike.
CAPTURE-FUNC is either the symbol `org-remember' or `org-capture'."
- (let* ((parts (org-protocol-split-data info t))
+ (let* ((parts (org-protocol-split-data info t org-protocol-data-separator))
(template (or (and (>= 2 (length (car parts))) (pop parts))
org-protocol-default-template-key))
(url (org-protocol-sanitize-uri (car parts)))
--
1.7.2.5
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2012-04-14 23:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-14 23:35 A patch for a workaround for Chrome - org-protocol use on Gnome/Linux Harri Kiiskinen
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).