Re: tramp (2.6.0.29.1 nil/nil); Provides option to disable shortened multi-hop tramp file name

2023-06-21 Thread Michael Albinus
Warren Lynn  writes:

> Hi Michael,

Hi Warren,

> I verified your latest patch works. Thanks a lot for your quick
> action.

Thanks for the feedback. I've pushed the patch to the Tramp and Emacs
repositories. It will appear on GNU ELPA with Tramp 2.6.1, scheduled for
next week. And also, months away from now, it will be in Emacs 29.2.

> Best regards.
>
> Warren

Best regards, Michael.



Re: tramp (2.6.0.29.1 nil/nil); Provides option to disable shortened multi-hop tramp file name

2023-06-21 Thread Warren Lynn
Hi Michael,

I verified your latest patch works. Thanks a lot for your quick action.

Best regards.

Warren

On Wed, Jun 21, 2023 at 9:02 AM Michael Albinus 
wrote:

> Warren Lynn  writes:
>
> > Hi Michael,
>
> Hi Warren,
>
> > I actually put in a similar patch as yours myself, and found that is
> > not enough. The tricky part is when tramp-make-tramp-file-name is
> > called by tramp-make-tramp-hop-name, the hop name must be omitted (set
> > to nil). Otherwise, we will get into some infinite loop. For other
> > cases, keep the hop. With that additional consideration, it works for
> > me, although I do not know how the whole system works and the code is
> > really hacky. Maybe you can give some thoughts on that?
>
> I've seen the same problem in my regression tests. See a reworked patch
> appended. Note also, that I have renamed the new user option to
> `tramp-show-ad-hoc-proxies', in order to be consistent with other
> variable names.
>
> > Thanks.
> >
> > Warren
>
> Best regards, Michael.
>
>


Re: tramp (2.6.0.29.1 nil/nil); Provides option to disable shortened multi-hop tramp file name

2023-06-21 Thread Michael Albinus
Warren Lynn  writes:

> Hi Michael,

Hi Warren,

> I actually put in a similar patch as yours myself, and found that is
> not enough. The tricky part is when tramp-make-tramp-file-name is
> called by tramp-make-tramp-hop-name, the hop name must be omitted (set
> to nil). Otherwise, we will get into some infinite loop. For other
> cases, keep the hop. With that additional consideration, it works for
> me, although I do not know how the whole system works and the code is
> really hacky. Maybe you can give some thoughts on that?

I've seen the same problem in my regression tests. See a reworked patch
appended. Note also, that I have renamed the new user option to
`tramp-show-ad-hoc-proxies', in order to be consistent with other
variable names.

> Thanks.
>
> Warren

Best regards, Michael.

diff --git a/lisp/tramp.el b/lisp/tramp.el
index 90fd53b0..8e5b7527 100644
--- a/lisp/tramp.el
+++ b/lisp/tramp.el
@@ -523,6 +523,11 @@ interpreted as a regular expression which always matches."
   :version "24.3"
   :type 'boolean)

+(defcustom tramp-show-ad-hoc-proxies nil
+  "Whether to show ad-hoc proxies in file names."
+  :version "29.2"
+  :type 'boolean)
+
 ;; For some obscure technical reasons, `system-name' on w32 returns
 ;; either lower case or upper case letters.  See
 ;; .
@@ -1825,8 +1830,8 @@ the form (METHOD USER DOMAIN HOST PORT LOCALNAME  HOP)."
   (when (cadr args)
 	(setq localname (and (stringp (cadr args)) (cadr args
   (when hop
-	;; Keep hop in file name for completion.
-	(unless minibuffer-completing-file-name
+	;; Keep hop in file name for completion or when indicated.
+	(unless (or minibuffer-completing-file-name tramp-show-ad-hoc-proxies)
 	  (setq hop nil))
 	;; Assure that the hops are in `tramp-default-proxies-alist'.
 	;; In tramp-archive.el, the slot `hop' is used for the archive
@@ -1877,7 +1882,7 @@ the form (METHOD USER DOMAIN HOST PORT LOCALNAME  HOP)."
  (tramp-compat-rx
   (regexp tramp-postfix-host-regexp) eos)
  tramp-postfix-hop-format
- (tramp-make-tramp-file-name vec 'noloc)
+ (tramp-make-tramp-file-name (tramp-file-name-unify vec))

 (defun tramp-completion-make-tramp-file-name (method user host localname)
   "Construct a Tramp file name from METHOD, USER, HOST and LOCALNAME.