From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: server.el problem ? Date: Wed, 01 Aug 2012 18:31:10 +0300 Message-ID: <833946eiip.fsf@gnu.org> References: Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: dough.gmane.org 1343835129 5449 80.91.229.3 (1 Aug 2012 15:32:09 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 1 Aug 2012 15:32:09 +0000 (UTC) Cc: emacs-devel@gnu.org To: Fabrice Popineau Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Aug 01 17:32:09 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Swau7-00069S-FY for ged-emacs-devel@m.gmane.org; Wed, 01 Aug 2012 17:32:07 +0200 Original-Received: from localhost ([::1]:43617 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Swau6-0004Mu-Iz for ged-emacs-devel@m.gmane.org; Wed, 01 Aug 2012 11:32:06 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:60035) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Swatz-000499-JO for emacs-devel@gnu.org; Wed, 01 Aug 2012 11:32:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Swatt-0007bc-9M for emacs-devel@gnu.org; Wed, 01 Aug 2012 11:31:59 -0400 Original-Received: from mtaout20.012.net.il ([80.179.55.166]:44752) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Swats-0007Z9-S2 for emacs-devel@gnu.org; Wed, 01 Aug 2012 11:31:53 -0400 Original-Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0M8300B001Q5TC00@a-mtaout20.012.net.il> for emacs-devel@gnu.org; Wed, 01 Aug 2012 18:31:20 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0M8300BL21S7J940@a-mtaout20.012.net.il>; Wed, 01 Aug 2012 18:31:20 +0300 (IDT) In-reply-to: X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-Received-From: 80.179.55.166 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:152084 Archived-At: > From: Fabrice Popineau > 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?