tramp-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: hang forever with an invalid tramp filename


From: Thierry Volpiatto
Subject: Re: hang forever with an invalid tramp filename
Date: Sat, 05 Nov 2011 10:08:33 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.91 (gnu/linux)

Thierry Volpiatto <address@hidden> writes:

> Hi Michael,
> I encountered some issues with tramp while writing `anything' completion
> for hostnames:
>
> - tramp hang if i do (find-file "/ssh:toto")
>   (notice the last ":" is missing)
>   where toto is a valid hostname.
>   I think this should return an error and exiting instead of trying to
>   connect.
>   This is reproductible in emacs -Q with C-x C-f => /ssh:toto RET
>
> - `tramp-parse-connection-properties' should return a list of (user
>   host) as described in docstring, however it return sometimes a list of
>   (user method), so i have to parse this to remove such entries.
>   (not a big deal though, but well..)
Also, to avoid repetition, what about somthing like that:

#+BEGIN_SRC lisp
(defun tramp-parse-sfile (filename function)
  "Return a list of (user host) tuples allowed to access.
User is always nil."
  ;; On Windows, there are problems in completion when
  ;; `default-directory' is remote.
  (let ((default-directory (tramp-compat-temporary-file-directory))
        res)
    (when (file-readable-p filename)
      (with-temp-buffer
        (insert-file-contents filename)
        (goto-char (point-min))
        (while (not (eobp))
          (push (funcall function) res))))
    res))

(defun tramp-parse-shosts (filename)
  "Return a list of (user host) tuples allowed to access.
User is always nil."
  (tramp-parse-sfile filename 'tramp-parse-shosts-group))

(defun tramp-parse-sconfig (filename)
  "Return a list of (user host) tuples allowed to access.
User is always nil."
  (tramp-parse-sfile filename 'tramp-parse-sconfig-group))

#+END_SRC


-- 
  Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]