From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.bugs Subject: bug#13961: 24.3; ffap-url-unwrap-remote fails for remote file URIs Date: Thu, 14 Mar 2013 22:57:34 +0100 Message-ID: <871ubh8x0x.fsf@gmx.de> References: <871ubh7v3s.fsf@pcwi7557.uni-muenster.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1363298337 27911 80.91.229.3 (14 Mar 2013 21:58:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 14 Mar 2013 21:58:57 +0000 (UTC) Cc: 13961@debbugs.gnu.org To: Jens Lechtenboerger Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Mar 14 22:59:22 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1UGGBF-0005di-SL for geb-bug-gnu-emacs@m.gmane.org; Thu, 14 Mar 2013 22:59:22 +0100 Original-Received: from localhost ([::1]:60583 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UGGAt-0000r8-Dl for geb-bug-gnu-emacs@m.gmane.org; Thu, 14 Mar 2013 17:58:59 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:58479) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UGGAp-0000r0-84 for bug-gnu-emacs@gnu.org; Thu, 14 Mar 2013 17:58:56 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UGGAj-0000fG-S9 for bug-gnu-emacs@gnu.org; Thu, 14 Mar 2013 17:58:55 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:50715) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UGGAj-0000fC-OU for bug-gnu-emacs@gnu.org; Thu, 14 Mar 2013 17:58:49 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1UGGBu-0007Lo-JB for bug-gnu-emacs@gnu.org; Thu, 14 Mar 2013 18:00:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Albinus Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 14 Mar 2013 22:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13961 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 13961-submit@debbugs.gnu.org id=B13961.136329834228161 (code B ref 13961); Thu, 14 Mar 2013 22:00:02 +0000 Original-Received: (at 13961) by debbugs.gnu.org; 14 Mar 2013 21:59:02 +0000 Original-Received: from localhost ([127.0.0.1]:54824 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UGGAv-0007Jw-6F for submit@debbugs.gnu.org; Thu, 14 Mar 2013 17:59:01 -0400 Original-Received: from mout.gmx.net ([212.227.17.22]:61217) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UGGAs-0007Je-5q for 13961@debbugs.gnu.org; Thu, 14 Mar 2013 17:58:59 -0400 Original-Received: from mailout-de.gmx.net ([10.1.76.27]) by mrigmx.server.lan (mrigmx001) with ESMTP (Nemesis) id 0MB0kk-1UQBmw2XVk-009ueF for <13961@debbugs.gnu.org>; Thu, 14 Mar 2013 22:57:38 +0100 Original-Received: (qmail invoked by alias); 14 Mar 2013 21:57:37 -0000 Original-Received: from p57BB985B.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.152.91] by mail.gmx.net (mp027) with SMTP; 14 Mar 2013 22:57:37 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX1+rBA58pGqrWNON7gG7ho2Ug5RYBt47ZHiBEUcwfY AdxO3XIFSRSciD In-Reply-To: <871ubh7v3s.fsf@pcwi7557.uni-muenster.de> (Jens Lechtenboerger's message of "Thu, 14 Mar 2013 18:24:23 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-Y-GMX-Trusted: 0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:72512 Archived-At: Jens Lechtenboerger writes: > Hi there, Hi Jens, > I=E2=80=99d like to access remote file URIs via ffap and ssh, e.g., /bar = on > host foo via =E2=80=9Cfile://foo/bar=E2=80=9D. However, the behavior of > ffap-url-unwrap-remote has changed from Emacs 23 to 24. Yes. See the NEWS file of Emacs 24.3: --8<---------------cut here---------------start------------->8--- ** The FFAP option `ffap-url-unwrap-remote' can now be a list of strings, specifying URL types that should be converted to remote file names at the FFAP prompt. The default is now '("ftp"). --8<---------------cut here---------------end--------------->8--- > I=E2=80=99m using: > > src/emacs -Q > (ffap-bindings) > (setq ffap-ftp-default-user nil) > > In Emacs 23.4, with point in =E2=80=9Cfile://foo/bar=E2=80=9D, =E2=80=9CC= -x C-f=E2=80=9D shows > =E2=80=9C/foo:/bar=E2=80=9D in=20=20 > the minibuffer, and RET retrieves the file via ssh, which is good. In Emacs 23, ffap-url-unwrap-remote had the intention to unwrap to an ftp file name. It uses the ange-ftp syntax "/host:/remote/path". Tramp is bundled with Emacs 23, and it uses an extended syntax "/method:host:/remote/path". The "method:" part is optional; in this case the default method ("ssh" in your case) will be used. So it did work for you due to an unintended side effect. > In Emacs 24.3, =E2=80=9CC-x C-f=E2=80=9D shows =E2=80=9Cfile://foo/bar=E2= =80=9D, and RET opens a > browser, which tries to access =E2=80=9Cfile:///bar=E2=80=9D, which is in= correct as > it misses the host. ffap-url-unwrap-remote has been changed to handle the scheme part of the url as Tramp method, when it is known in ffap-url-unwrap-remote. "file" does not belong to this list by default; therefore the url is regarded as url, and it is sent to the browser. > The file scheme is not recognized as remote one. Thus: > (setq ffap-url-unwrap-remote '("ftp" "file")) > Now, =E2=80=9CC-x C-f=E2=80=9D shows =E2=80=9C/file:foo:/bar=E2=80=9D, an= d RET leads to the error: > =E2=80=9CHost `foo' looks like a remote host, `file' can only use the loc= al host=E2=80=9D In this case, you declare "file" as Tramp method. The resulting "/file:foo:/bar" is not accepted by Tramp; it doesn't know of any method "file". > I=E2=80=99m not sure whether the previous result should be changed > somewhere. Why should file only use the local host? > > However, the problem can be avoided by the following version of > ffap-url-unwrap-remote. Moreover, changing ffap-ftp-default-user is > not necessary any more. > > (defun ffap-url-unwrap-remote (url) > "Return URL as a remote file name, or nil." > (let* ((obj (url-generic-parse-url url)) > (scheme (url-type obj)) > (valid-schemes (if (listp ffap-url-unwrap-remote) > ffap-url-unwrap-remote > '("ftp"))) > (host (url-host obj)) > (port (url-port-if-non-default obj)) > (user (url-user obj)) > (filename (car (url-path-and-query obj)))) > (when (and (member scheme valid-schemes) > (string-match "\\`[a-zA-Z][-a-zA-Z0-9+.]*\\'" scheme) > (not (equal host ""))) > (concat "/" > (if (not (string=3D scheme "file")) > (concat scheme ":")) > (if user (concat user "@")) > host > (if port (concat "#" (number-to-string port))) > ":" filename)))) This patch tries to conserve the side effect of ffap in Emacs 23. I'm not a user of ffap, so I don't know whether it is acceptable to add such a kludge. > Best wishes > Jens Best regards, Michael.