From: Harri Kiiskinen <harkiisk@gmail.com>
To: emacs-orgmode@gnu.org
Subject: A patch for a workaround for Chrome - org-protocol use on Gnome/Linux
Date: Sun, 15 Apr 2012 02:35:38 +0300 (EEST) [thread overview]
Message-ID: <20120415.023538.124679170.harkiisk@gmail.com> (raw)
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
reply other threads:[~2012-04-14 23:35 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=20120415.023538.124679170.harkiisk@gmail.com \
--to=harkiisk@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 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.