David Abrahams <[email protected]> writes:

>>>
>>> Unfortunately, that won't match because TRAMP seems to use the
>>> result of
>>>
>>>  $ hostname
>>
>> But that's the same as (system-name) in ELisp. So you can write
>>
>>    (add-to-list 'tramp-default-proxies-alist
>>                 `(,(format "\\`%s\\'" (system-name)) nil nil))
>
> Yes, of course I can.  However, as I wrote, this is not achievable
> with the customize UI, and I think it's an important enough use case
> that it should be made possible with customize.

Good point! Could you, please, check the attached patch? It shall serve
your purpose.

Of course, changes in tramp.texi, including an example, must be added,
too.

> David Abrahams

Best regards, Michael.

*** /home/albinus/src/tramp/lisp/tramp.el.~1~	2009-04-21 15:27:53.650002000 +0200
--- /home/albinus/src/tramp/lisp/tramp.el	2009-04-21 16:53:08.860000000 +0200
***************
*** 757,772 ****
  This is an alist of items (HOST USER PROXY).  The first matching
  item specifies the proxy to be passed for a file name located on
  a remote target matching u...@host.  HOST and USER are regular
! expressions or nil, which is interpreted as a regular expression
! which always matches.  PROXY must be a Tramp filename without a
! localname part.  Method and user name on PROXY are optional,
! which is interpreted with the default values.  PROXY can contain
! the patterns %h and %u, which are replaced by the strings
! matching HOST or USER, respectively."
    :group 'tramp
!   :type '(repeat (list (regexp :tag "Host regexp")
! 		       (regexp :tag "User regexp")
! 		       (string :tag "Proxy remote name"))))
  
  (defconst tramp-local-host-regexp
    (concat
--- 757,775 ----
  This is an alist of items (HOST USER PROXY).  The first matching
  item specifies the proxy to be passed for a file name located on
  a remote target matching u...@host.  HOST and USER are regular
! expressions.  PROXY must be a Tramp filename without a localname
! part.  Method and user name on PROXY are optional, which is
! interpreted with the default values.  PROXY can contain the
! patterns %h and %u, which are replaced by the strings matching
! HOST or USER, respectively.
! 
! HOST, USER or PROXY could also be Lisp forms, which will be
! evaluated.  The result must be a string or nil, which is
! interpreted as a regular expression which always matches."
    :group 'tramp
!   :type '(repeat (list (choice :tag "Host regexp" regexp sexp)
! 		       (choice :tag "User regexp" regexp sexp)
! 		       (choice :tag "Proxy remote name" string (const nil)))))
  
  (defconst tramp-local-host-regexp
    (concat
***************
*** 6320,6332 ****
      ;; Look for proxy hosts to be passed.
      (while choices
        (setq item (pop choices)
! 	    proxy (nth 2 item))
        (when (and
  	     ;; host
! 	     (string-match (or (nth 0 item) "")
  			   (or (tramp-file-name-host (car target-alist)) ""))
  	     ;; user
! 	     (string-match (or (nth 1 item) "")
  			   (or (tramp-file-name-user (car target-alist)) "")))
  	(if (null proxy)
  	    ;; No more hops needed.
--- 6323,6335 ----
      ;; Look for proxy hosts to be passed.
      (while choices
        (setq item (pop choices)
! 	    proxy (eval (nth 2 item)))
        (when (and
  	     ;; host
! 	     (string-match (or (eval (nth 0 item)) "")
  			   (or (tramp-file-name-host (car target-alist)) ""))
  	     ;; user
! 	     (string-match (or (eval (nth 1 item)) "")
  			   (or (tramp-file-name-user (car target-alist)) "")))
  	(if (null proxy)
  	    ;; No more hops needed.
_______________________________________________
Tramp-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/tramp-devel

Reply via email to