emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-protocol and server.el
@ 2012-07-29 20:53 Fabrice Popineau
  2012-07-31 15:34 ` Bastien
  0 siblings, 1 reply; 2+ messages in thread
From: Fabrice Popineau @ 2012-07-29 20:53 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1664 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 2356 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: org-protocol and server.el
  2012-07-29 20:53 org-protocol and server.el Fabrice Popineau
@ 2012-07-31 15:34 ` Bastien
  0 siblings, 0 replies; 2+ messages in thread
From: Bastien @ 2012-07-31 15:34 UTC (permalink / raw)
  To: Fabrice Popineau; +Cc: emacs-orgmode

Hi Fabrice,

Fabrice Popineau <fabrice.popineau@supelec.fr> writes:

> @@ -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))

I suggest you send this to the emacs-devel@ mailing list or fill a bug
report M-x report-emacs-bug RET.

Thanks,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-07-31 15:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-29 20:53 org-protocol and server.el Fabrice Popineau
2012-07-31 15:34 ` Bastien

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).