[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: server.el problem ?
From: |
Eli Zaretskii |
Subject: |
Re: server.el problem ? |
Date: |
Wed, 01 Aug 2012 18:31:10 +0300 |
> From: Fabrice Popineau <address@hidden>
> Date: Wed, 1 Aug 2012 14:01:14 +0200
>
>
> [1:text/plain Hide]
>
> 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' or when it is a url like in this case.
>
> Have I done something wrong? Or is there a problem here ?
Are you saying the current code runs a URL through expand-file-name?
If so, I'd say it's sure a bug. It probably works on Posix platforms
by sheer luck.
Instead of using string-match, perhaps we have a predicate somewhere
that tests strings for being a URL?