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 | |
| 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.
| -rw-r--r-- | doc/misc/tramp.texi | 8 | ||||
| -rw-r--r-- | etc/NEWS | 5 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 19 |
3 files changed, 32 insertions, 0 deletions
diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index 128501c3908..f68205519f3 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi | |||
| @@ -2538,6 +2538,14 @@ names on that host. | |||
| 2538 | When the configuration (@pxref{Customizing Completion}) includes user | 2538 | When the configuration (@pxref{Customizing Completion}) includes user |
| 2539 | names, then the completion lists will account for the user names as well. | 2539 | names, then the completion lists will account for the user names as well. |
| 2540 | 2540 | ||
| 2541 | @vindex tramp-completion-use-auth-sources | ||
| 2542 | Results from @code{auth-sources} search (@pxref{Using an | ||
| 2543 | authentication file}) are added to the completion candidates. This | ||
| 2544 | search could be annoying, for example due to a passphrase request of | ||
| 2545 | the @file{~/.authinfo.gpg} authentication file. The user option | ||
| 2546 | @code{tramp-completion-use-auth-sources} controls, whether such a | ||
| 2547 | search is performed during completion. | ||
| 2548 | |||
| 2541 | Remote hosts previously visited or hosts whose connections are kept | 2549 | Remote hosts previously visited or hosts whose connections are kept |
| 2542 | persistently (@pxref{Connection caching}) will be included in the | 2550 | persistently (@pxref{Connection caching}) will be included in the |
| 2543 | completion lists. | 2551 | completion lists. |
| @@ -751,6 +751,11 @@ are obsoleted in GVFS. | |||
| 751 | *** Validated passwords are saved by auth-source backends which support this. | 751 | *** Validated passwords are saved by auth-source backends which support this. |
| 752 | 752 | ||
| 753 | +++ | 753 | +++ |
| 754 | *** During user and host name completion in the minibuffer, results | ||
| 755 | from auth-source search are taken into account. This can be disabled | ||
| 756 | by setting user option 'tramp-completion-use-auth-sources' to nil. | ||
| 757 | |||
| 758 | +++ | ||
| 754 | *** The user option 'tramp-ignored-file-name-regexp' allows to disable | 759 | *** The user option 'tramp-ignored-file-name-regexp' allows to disable |
| 755 | Tramp for some look-alike remote file names. | 760 | Tramp for some look-alike remote file names. |
| 756 | 761 | ||
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. |