diff options
| author | Michael Albinus | 2018-10-31 20:04:04 +0100 |
|---|---|---|
| committer | Michael Albinus | 2018-10-31 20:04:04 +0100 |
| commit | 0913f18dbebd8480289863480cd147a63ee59cca (patch) | |
| tree | 928657cdee62bea8261f93a6c00108dc121e2475 /lisp | |
| parent | 42681c54bf5ea2ff9d2a3ec6553766b194454caf (diff) | |
| download | emacs-0913f18dbebd8480289863480cd147a63ee59cca.tar.gz emacs-0913f18dbebd8480289863480cd147a63ee59cca.zip | |
Remote file name completion is also performed by auth-sources search
* doc/misc/tramp.texi (File name completion): User and host name
completion is also performed by auth-sources search.
* etc/NEWS: Document remote file name completion using auth-sources.
* lisp/net/tramp.el (tramp-completion-use-auth-sources):
New user option.
(tramp-parse-auth-sources): New defun.
(tramp-get-completion-function): Call it.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/net/tramp.el | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index a1246659d8d..13c3b5f939c 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -1985,6 +1985,8 @@ For definition of that list see `tramp-set-completion-function'." | |||
| 1985 | (append | 1985 | (append |
| 1986 | `(;; Default settings are taken into account. | 1986 | `(;; Default settings are taken into account. |
| 1987 | (tramp-parse-default-user-host ,method) | 1987 | (tramp-parse-default-user-host ,method) |
| 1988 | ;; Hits from auth-sources. | ||
| 1989 | (tramp-parse-auth-sources ,method) | ||
| 1988 | ;; Hosts visited once shall be remembered. | 1990 | ;; Hosts visited once shall be remembered. |
| 1989 | (tramp-parse-connection-properties ,method)) | 1991 | (tramp-parse-connection-properties ,method)) |
| 1990 | ;; The method related defaults. | 1992 | ;; The method related defaults. |
| @@ -2788,6 +2790,23 @@ This function is added always in `tramp-get-completion-function' | |||
| 2788 | for all methods. Resulting data are derived from default settings." | 2790 | for all methods. Resulting data are derived from default settings." |
| 2789 | `((,(tramp-find-user method nil nil) ,(tramp-find-host method nil nil)))) | 2791 | `((,(tramp-find-user method nil nil) ,(tramp-find-host method nil nil)))) |
| 2790 | 2792 | ||
| 2793 | (defcustom tramp-completion-use-auth-sources auth-source-do-cache | ||
| 2794 | "Whether to use `auth-source-search' for completion of user and host names. | ||
| 2795 | This could be disturbing, if it requires a password / passphrase, | ||
| 2796 | as for \"~/.authinfo.gpg\"." | ||
| 2797 | :group 'tramp | ||
| 2798 | :version "27.1" | ||
| 2799 | :type 'boolean) | ||
| 2800 | |||
| 2801 | (defun tramp-parse-auth-sources (method) | ||
| 2802 | "Return a list of (user host) tuples allowed to access for METHOD. | ||
| 2803 | This function is added always in `tramp-get-completion-function' | ||
| 2804 | for all methods. Resulting data are derived from default settings." | ||
| 2805 | (and tramp-completion-use-auth-sources | ||
| 2806 | (mapcar | ||
| 2807 | (lambda (x) `(,(plist-get x :user) ,(plist-get x :host))) | ||
| 2808 | (auth-source-search :port method :max most-positive-fixnum)))) | ||
| 2809 | |||
| 2791 | ;; Generic function. | 2810 | ;; Generic function. |
| 2792 | (defun tramp-parse-group (regexp match-level skip-regexp) | 2811 | (defun tramp-parse-group (regexp match-level skip-regexp) |
| 2793 | "Return a (user host) tuple allowed to access. | 2812 | "Return a (user host) tuple allowed to access. |