all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michael Albinus <michael.albinus@gmx.de>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: Change Tramp syntax
Date: Sun, 12 Mar 2017 10:10:28 +0100	[thread overview]
Message-ID: <874lyyhncr.fsf@detlef> (raw)
In-Reply-To: <jwv4lyzze0y.fsf-monnier+emacsdiffs@gnu.org> (Stefan Monnier's message of "Sat, 11 Mar 2017 16:54:13 -0500")

Stefan Monnier <monnier@iro.umontreal.ca> writes:

Hi Stefan,

> I don't understand this either.  Currently I see two Tramp entries in
> f-n-h-alist:
>
>  ("\\`/[^/]*\\'" . tramp-completion-file-name-handler)
>  ("^/\\(\\(?:\\(?:\\([a-zA-Z_0-9-]+\\):\\)?\\(?:\\([^/|: 	]+\\)@\\)?\\(\\(?:[a-zA-Z0-9_.-]+\\|\\[\\(?:\\(?:\\(?:[a-zA-Z0-9]+\\)?:\\)+[a-zA-Z0-9.]+\\)?]\\)\\(?:#[0-9]+\\)?\\)?|\\)+\\)?\\(?:\\([a-zA-Z_0-9-]+\\):\\)?\\(?:\\([^/|: 	]+\\)@\\)?\\(\\(?:[a-zA-Z0-9_.-]+\\|\\[\\(?:\\(?:\\(?:[a-zA-Z0-9]+\\)?:\\)+[a-zA-Z0-9.]+\\)?]\\)\\(?:#[0-9]+\\)?\\)?:\\(.*$\\)" . tramp-file-name-handler)
>
> Neither of those regexps seems to handle an /ssh: prefix differently
> from a /host: prefix.

The first file name handler is intended to perform method, user name and
host name completion. It offers only handlers for `expand-file-name',
`file-name-all-completions' and `file-name-completion', everything else
will be handled either by `tramp-file-name-handler' (if the regexp
matches that handler), or by the native file name operation. In
`tramp-completion-handle-file-name-all-completions' it checks for both
possibilities, "/ssh:" and "/host:".

The second file name handler is intended to handle everything else. It
also performs a check, that a host name is not a method. But this is not
part of the regexp; this check is performed in
`tramp-maybe-open-connection', when a remote connection is being opened.

It would be preferable to extend the second regexp such a way, that
remote file names like "/ssh:whatever" are not allowed. But this is not
possible, because the method names to be excluded as host names are not
known at the time this file name handler is installed in
`file-name-handler-alist'.

If we discard ange-ftp syntax, the two entries would look like

("\\`/\\(-:\\)?[^:]*\\'" . tramp-completion-file-name-handler)

("\\`/[a-zA-Z_0-9-]+:\\([^/|: \t]+@\\)?[a-zA-Z0-9_.-]+:"
;;    method            user name      host name
 . tramp-file-name-handler)

The two regexps don't overlap any longer, which is the key.

Of course, the second regexp must be more complex, due to the multi-hop
syntax, due to Samba domains, due to IPv6 addresses, and due to port
numbers. But you see the idea.

>         Stefan

Best regards, Michael.



  reply	other threads:[~2017-03-12  9:10 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20170309184457.29604.13048@vcs0.savannah.gnu.org>
     [not found] ` <20170309184458.08C9725FCF@vcs0.savannah.gnu.org>
2017-03-10  8:43   ` [Emacs-diffs] master 37b88d7: Fix bug#23006 Stefan Monnier
2017-03-10 10:00     ` Michael Albinus
2017-03-10 10:10       ` Stefan Monnier
2017-03-10 10:32         ` Michael Albinus
2017-03-10 10:57           ` Stefan Monnier
2017-03-10 14:14             ` Change Tramp syntax (was: [Emacs-diffs] master 37b88d7: Fix bug#23006) Michael Albinus
2017-03-10 15:22               ` Eli Zaretskii
2017-04-03 15:54                 ` Change Tramp syntax John Wiegley
2017-04-03 17:00                   ` Michael Albinus
2017-04-03 23:14                     ` John Wiegley
2017-04-03 23:35                       ` Drew Adams
2017-04-04  8:46                       ` Michael Albinus
2017-04-04 16:46                         ` John Wiegley
2017-04-04 16:59                           ` Michael Albinus
2017-04-04 19:44                             ` John Wiegley
2017-04-06 19:12                               ` Michael Albinus
2017-04-07  5:27                                 ` John Wiegley
2017-04-08 16:43                                   ` Michael Albinus
2017-04-13 18:00                                     ` John Wiegley
2017-04-07 13:52                                 ` Filipp Gunbin
2017-04-07 14:02                                   ` Michael Albinus
2017-04-08 16:41                                   ` Michael Albinus
2017-04-09 19:18                                     ` Talking about Lisp symbols Richard Stallman
2017-04-10 13:43                                     ` Change Tramp syntax Filipp Gunbin
2017-04-10 16:18                                     ` Teemu Likonen
2017-04-10 16:45                                       ` Michael Albinus
2017-04-10 18:03                                         ` Teemu Likonen
2017-04-04 17:04                       ` John Wiegley
2017-04-04 17:50                         ` Michael Albinus
2017-04-04 21:08                           ` John Wiegley
2017-04-04  7:09                     ` Andreas Schwab
2017-03-10 16:56               ` Stefan Monnier
2017-03-11 19:44                 ` Michael Albinus
2017-03-11 20:08                   ` Eli Zaretskii
2017-03-11 20:31                     ` Michael Albinus
2017-03-12 15:18                       ` Eli Zaretskii
2017-03-12 18:30                         ` Michael Albinus
2017-03-12 22:11                           ` Eli Zaretskii
2017-03-13 17:23                           ` Michael Albinus
2017-03-13 17:30                             ` Eli Zaretskii
2017-03-13 17:35                               ` Michael Albinus
2017-03-14  3:38                                 ` Eli Zaretskii
2017-03-14  9:06                                   ` Michael Albinus
2017-03-14 14:13                                     ` Michael Albinus
2017-03-14 16:11                                       ` Eli Zaretskii
2017-03-14 15:58                                     ` Eli Zaretskii
2017-03-11 21:54                   ` Stefan Monnier
2017-03-12  9:10                     ` Michael Albinus [this message]
2017-03-12 17:12                       ` Stefan Monnier
2017-03-12 18:43                         ` Michael Albinus
2017-03-12 21:50                           ` Stefan Monnier
2017-03-13  7:23                             ` Michael Albinus
2017-03-10 10:30       ` [Emacs-diffs] master 37b88d7: Fix bug#23006 Dmitry Gutov
2017-03-10 10:36         ` Michael Albinus
2017-03-10 13:44           ` Dmitry Gutov
2017-03-10 10:34       ` Stefan Monnier

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

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

  git send-email \
    --in-reply-to=874lyyhncr.fsf@detlef \
    --to=michael.albinus@gmx.de \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.