From mboxrd@z Thu Jan 1 00:00:00 1970 From: Fabrice Popineau Subject: org-protocol and server.el Date: Sun, 29 Jul 2012 22:53:10 +0200 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=0016e6dd8d633b41b004c5fe230a Return-path: Received: from eggs.gnu.org ([208.118.235.92]:56526) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SvaUX-0001Yo-8Y for emacs-orgmode@gnu.org; Sun, 29 Jul 2012 16:53:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SvaUW-0007gS-7G for emacs-orgmode@gnu.org; Sun, 29 Jul 2012 16:53:33 -0400 Received: from mail-we0-f169.google.com ([74.125.82.169]:52815) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SvaUV-0007fz-Lg for emacs-orgmode@gnu.org; Sun, 29 Jul 2012 16:53:31 -0400 Received: by weys10 with SMTP id s10so3546972wey.0 for ; Sun, 29 Jul 2012 13:53:30 -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 --0016e6dd8d633b41b004c5fe230a Content-Type: text/plain; charset=ISO-8859-1 Hi all, I wanted to use org-protocol with chrome and emacs-24.1 under windows 7. I registered the org-protocol protocol with: [HKEY_CLASSES_ROOT\org-protocol] @="URL:Org Protocol" "URL Protocol"="" [HKEY_CLASSES_ROOT\org-protocol\shell] [HKEY_CLASSES_ROOT\org-protocol\shell\open] [HKEY_CLASSES_ROOT\org-protocol\shell\open\command] @="\"C:\\Local\\Emacs-24.1\\bin\\emacsclientw.exe\" \"-n\" \"%1\"" I added a button to the chrome toolbar with : javascript:location.href='org-protocol://capture://'+encodeURIComponent(location.href)+'/'+encodeURIComponent(document.title)+'/'+ encodeURIComponent(window.getSelection()) but org-protocol failed to capture anything. The reason was that the emacsclientw.exe directory was added to the org-protocol url. I traced the problem to server.el and I had to patch it this way: @@ -1137,7 +1135,8 @@ (let ((file (pop args-left))) (if coding-system (setq file (decode-coding-string file coding-system))) - (setq file (expand-file-name file dir)) + (unless (string-match "^[^/]+:/" file) + (setq file (expand-file-name file dir))) (push (cons file filepos) files) (server-log (format "New file: %s %s" file (or filepos "")) proc)) to prevent addition of the current directory to the org-protocol url. This is a crude patch, but anyway, I have the feeling nothing should be added to 'file' when it is 'absolute'. Have I done something wrong? Or is there a problem here ? Thanks for your comments, -- Fabrice Popineau --0016e6dd8d633b41b004c5fe230a Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi all,

I wanted to use org-protocol with chrome and ema= cs-24.1 under windows 7.
I registered the org-protocol protocol w= ith:

[HKEY_CLASSES_ROOT\org-protocol]
@=3D"URL:Org Protocol"
"URL Protocol"=3D= ""

[HKEY_CLASSES_ROOT\org-protocol\shell= ]

[HKEY_CLASSES_ROOT\org-protocol\shell\open]

[HKEY_CLASSES_ROOT\org-protocol\shell\open\command]
@=3D"\"C:\\Local\\Emacs-24.1\\bin\\emacsclientw.exe\"= \"-n\" \"%1\""

I added a button to the chrome toolbar with :

java= script:location.href=3D'org-protocol://capture://'+encodeURICompone= nt(location.href)+'/'+encodeURIComponent(document.title)+'/'= ;+ encodeURIComponent(window.getSelection())

but org-protocol failed to capture anything. The reason= was that the emacsclientw.exe directory was added to the org-protocol url.=
I traced the problem to server.el and I had to patch it this way= :

@@ -1137,7 +1135,8 @@
=A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 (let ((file (pop args-left)))
=A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0 (if coding-system
=A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 (setq file (decode-coding-string file coding-sy= stem)))
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (setq file (expand-file-name fil= e dir))
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (unless (string-mat= ch "^[^/]+:/" file)
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 (setq file (expand-file-name file dir)))
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (push (cons file filepos) file= s)
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (server-log (format &q= uot;New file: %s %s"
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 file (or filepos "")) pr= oc))

to prevent addition of the current directory to t= he org-protocol url.
This is a crude patch, but anyway, I have th= e feeling nothing should be=A0
added to 'file' when it is= 'absolute'.

Have I done something wrong? Or is there a problem here= ?

Thanks for your comments,

-= -
Fabrice Popineau

--0016e6dd8d633b41b004c5fe230a--