From mboxrd@z Thu Jan 1 00:00:00 1970 From: Harri Kiiskinen Subject: A patch for a workaround for Chrome - org-protocol use on Gnome/Linux Date: Sun, 15 Apr 2012 02:35:38 +0300 (EEST) Message-ID: <20120415.023538.124679170.harkiisk@gmail.com> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([208.118.235.92]:60288) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SJCVQ-0004Av-Fd for emacs-orgmode@gnu.org; Sat, 14 Apr 2012 19:35:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SJCVO-0001AA-JC for emacs-orgmode@gnu.org; Sat, 14 Apr 2012 19:35:48 -0400 Received: from mail-lb0-f169.google.com ([209.85.217.169]:64789) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SJCVO-0001A1-8e for emacs-orgmode@gnu.org; Sat, 14 Apr 2012 19:35:46 -0400 Received: by lbbgp10 with SMTP id gp10so679408lbb.0 for ; Sat, 14 Apr 2012 16:35:42 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org 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 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