emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] org-protocol and server.el


From: Fabrice Popineau
Subject: [O] org-protocol and server.el
Date: Sun, 29 Jul 2012 22:53:10 +0200

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="" 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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]