unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Albinus <michael.albinus@gmx.de>
To: Christoph Michelbach <michelbach94@gmail.com>
Cc: 31489@debbugs.gnu.org
Subject: bug#31489: 25.3; Dired unable to open directory "/ssh:example.com"
Date: Fri, 18 May 2018 17:25:17 +0200	[thread overview]
Message-ID: <87zi0xkmua.fsf@gmx.de> (raw)
In-Reply-To: <1526643719.9043.13.camel@gmail.com> (Christoph Michelbach's message of "Fri, 18 May 2018 13:41:59 +0200")

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

Christoph Michelbach <michelbach94@gmail.com> writes:

Hi Christoph,

> When a file's path conflicts with how an external resource is
> addressed, you can tell Emacs to open the local path by preceding it
> with "/:". If you created a file with
>
> sudo touch "/ssh:example.com/file"
>
> , you could access it via:
>
> C-x C-f /:/ssh:example.com/file RET
>
> However, if you leave "file" out, you don't get to see a dired buffer after
> hitting return. Instead, the current windows are retained and the mini buffer
> reads:
>
> Host name must not match method "ssh"

Thanks for the bug report. The appended patch, towards the master branch
of the Emacs repository, fixes it for me. Could you pls check?

> You also cannot first navigate to "/" and then enter the directory by moving
> point to it and hitting return. The same problem accompanied by the same error
> message occurs.

You should navigate to "/:". Then it works, after applying the patch.

However, before committing the patch I need to run further tests. The
patch let tramp-tests.el fail, which must be investigated further.

Best regards, Michael.


[-- Attachment #2: Type: text/plain, Size: 2367 bytes --]

diff --git a/lisp/files.el b/lisp/files.el
index d98d09bb1e..2478a22046 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -7056,7 +7056,8 @@ file-name-non-special
 		   '(nil 0))))
 	 method
 	 ;; Copy ARGUMENTS so we can replace elements in it.
-	 (arguments (copy-sequence arguments)))
+	 (arguments (copy-sequence arguments))
+         file-name-handler-alist)
     (if (symbolp (car file-arg-indices))
 	(setq method (pop file-arg-indices)))
     ;; Strip off the /: from the file names that have it.
@@ -7064,27 +7065,20 @@ file-name-non-special
       (while (consp file-arg-indices)
 	(let ((pair (nthcdr (car file-arg-indices) arguments)))
 	  (and (car pair)
-	       (string-match "\\`/:" (car pair))
-	       (setcar pair
-		       (if (= (length (car pair)) 2)
-			   "/"
-			 (substring (car pair) 2)))))
+	       (setcar pair (file-name-unquote (car pair)))))
 	(setq file-arg-indices (cdr file-arg-indices))))
     (pcase method
       (`identity (car arguments))
       (`add (file-name-quote (apply operation arguments)))
       (`buffer-file-name
-       (let ((buffer-file-name
-              (if (string-match "\\`/:" buffer-file-name)
-                  (substring buffer-file-name (match-end 0))
-                buffer-file-name)))
+       (let ((buffer-file-name (file-name-unquote buffer-file-name)))
          (apply operation arguments)))
       (`insert-file-contents
        (let ((visit (nth 1 arguments)))
          (unwind-protect
              (apply operation arguments)
            (when (and visit buffer-file-name)
-             (setq buffer-file-name (concat "/:" buffer-file-name))))))
+             (setq buffer-file-name (file-name-quote buffer-file-name))))))
       (`unquote-then-quote
        ;; We can't use `cl-letf' with `(buffer-local-value)' here
        ;; because it wouldn't work during bootstrapping.
@@ -7093,7 +7087,7 @@ file-name-non-special
          ;; `verify-visited-file-modtime' action, which takes a buffer
          ;; as only optional argument.
          (with-current-buffer (or (car arguments) buffer)
-           (let ((buffer-file-name (substring buffer-file-name 2)))
+           (let ((buffer-file-name (file-name-unquote buffer-file-name)))
              ;; Make sure to hide the temporary buffer change from the
              ;; underlying operation.
              (with-current-buffer buffer

  reply	other threads:[~2018-05-18 15:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-18 11:41 bug#31489: 25.3; Dired unable to open directory "/ssh:example.com" Christoph Michelbach
2018-05-18 15:25 ` Michael Albinus [this message]
2018-05-18 22:16   ` Christoph Michelbach
2018-05-19 18:10     ` Michael Albinus
2018-05-20 18:12       ` Christoph Michelbach
2018-05-20 18:30         ` Michael Albinus
2018-05-20 19:19           ` Christoph Michelbach
2018-05-21 17:53             ` Michael Albinus
2018-06-04 16:37               ` Michael Albinus
2018-05-21 12:59           ` Christoph Michelbach
2018-05-21 14:46             ` Michael Albinus

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=87zi0xkmua.fsf@gmx.de \
    --to=michael.albinus@gmx.de \
    --cc=31489@debbugs.gnu.org \
    --cc=michelbach94@gmail.com \
    /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).