[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 0913f18: Remote file name completion is also perfor
From: |
Michael Albinus |
Subject: |
[Emacs-diffs] master 0913f18: Remote file name completion is also performed by auth-sources search |
Date: |
Wed, 31 Oct 2018 15:04:14 -0400 (EDT) |
branch: master
commit 0913f18dbebd8480289863480cd147a63ee59cca
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>
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.
---
doc/misc/tramp.texi | 8 ++++++++
etc/NEWS | 5 +++++
lisp/net/tramp.el | 19 +++++++++++++++++++
3 files changed, 32 insertions(+)
diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi
index 128501c..f682055 100644
--- a/doc/misc/tramp.texi
+++ b/doc/misc/tramp.texi
@@ -2538,6 +2538,14 @@ names on that host.
When the configuration (@pxref{Customizing Completion}) includes user
names, then the completion lists will account for the user names as well.
address@hidden tramp-completion-use-auth-sources
+Results from @code{auth-sources} search (@pxref{Using an
+authentication file}) are added to the completion candidates. This
+search could be annoying, for example due to a passphrase request of
+the @file{~/.authinfo.gpg} authentication file. The user option
address@hidden controls, whether such a
+search is performed during completion.
+
Remote hosts previously visited or hosts whose connections are kept
persistently (@pxref{Connection caching}) will be included in the
completion lists.
diff --git a/etc/NEWS b/etc/NEWS
index 226ae1e..ac23b3b 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -751,6 +751,11 @@ are obsoleted in GVFS.
*** Validated passwords are saved by auth-source backends which support this.
+++
+*** During user and host name completion in the minibuffer, results
+from auth-source search are taken into account. This can be disabled
+by setting user option 'tramp-completion-use-auth-sources' to nil.
+
++++
*** The user option 'tramp-ignored-file-name-regexp' allows to disable
Tramp for some look-alike remote file names.
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index a124665..13c3b5f 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'."
(append
`(;; Default settings are taken into account.
(tramp-parse-default-user-host ,method)
+ ;; Hits from auth-sources.
+ (tramp-parse-auth-sources ,method)
;; Hosts visited once shall be remembered.
(tramp-parse-connection-properties ,method))
;; The method related defaults.
@@ -2788,6 +2790,23 @@ This function is added always in
`tramp-get-completion-function'
for all methods. Resulting data are derived from default settings."
`((,(tramp-find-user method nil nil) ,(tramp-find-host method nil nil))))
+(defcustom tramp-completion-use-auth-sources auth-source-do-cache
+ "Whether to use `auth-source-search' for completion of user and host names.
+This could be disturbing, if it requires a password / passphrase,
+as for \"~/.authinfo.gpg\"."
+ :group 'tramp
+ :version "27.1"
+ :type 'boolean)
+
+(defun tramp-parse-auth-sources (method)
+ "Return a list of (user host) tuples allowed to access for METHOD.
+This function is added always in `tramp-get-completion-function'
+for all methods. Resulting data are derived from default settings."
+ (and tramp-completion-use-auth-sources
+ (mapcar
+ (lambda (x) `(,(plist-get x :user) ,(plist-get x :host)))
+ (auth-source-search :port method :max most-positive-fixnum))))
+
;; Generic function.
(defun tramp-parse-group (regexp match-level skip-regexp)
"Return a (user host) tuple allowed to access.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 0913f18: Remote file name completion is also performed by auth-sources search,
Michael Albinus <=