unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Fabrice Popineau <fabrice.popineau@supelec.fr>
Cc: emacs-devel@gnu.org
Subject: Re: server.el problem ?
Date: Wed, 01 Aug 2012 18:31:10 +0300	[thread overview]
Message-ID: <833946eiip.fsf@gnu.org> (raw)
In-Reply-To: <CAFgFV9Pr9uADNBmQZXd5W9hPVRXSCznObgDmFsbn_+iaS+TNAw@mail.gmail.com>

> From: Fabrice Popineau <fabrice.popineau@supelec.fr>
> 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?



  parent reply	other threads:[~2012-08-01 15:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-01 12:01 server.el problem ? Fabrice Popineau
2012-08-01 14:25 ` Tassilo Horn
2012-08-01 18:36   ` Fabrice Popineau
2012-08-01 18:47     ` Tassilo Horn
2012-08-01 15:31 ` Eli Zaretskii [this message]
2012-08-01 18:51   ` Fabrice Popineau
2012-08-01 19:09     ` Tassilo Horn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=833946eiip.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=fabrice.popineau@supelec.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.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).