[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 5120b61: Improve command completion in tramp-crypt.el
From: |
Michael Albinus |
Subject: |
master 5120b61: Improve command completion in tramp-crypt.el |
Date: |
Mon, 15 Mar 2021 04:49:27 -0400 (EDT) |
branch: master
commit 5120b612f8520a855fc1819c3ebf86453c361e55
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>
Improve command completion in tramp-crypt.el
* lisp/net/tramp-crypt.el (tramp-crypt-command-completion-p):
Rename from `tramp-crypt-enabled-p'. Handle
`tramp-crypt-remove-directory' special.
---
lisp/net/tramp-crypt.el | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/lisp/net/tramp-crypt.el b/lisp/net/tramp-crypt.el
index f44be44..1d8c0ad 100644
--- a/lisp/net/tramp-crypt.el
+++ b/lisp/net/tramp-crypt.el
@@ -115,10 +115,14 @@ initializing a new crypted remote directory."
;; This function takes action since Emacs 28.1, when
;; `read-extended-command-predicate' is set to
;; `command-completion-default-include-p'.
-(defun tramp-crypt-enabled-p (_symbol _buffer)
+(defun tramp-crypt-command-completion-p (symbol _buffer)
"A predicate for Tramp interactive commands.
They are completed by \"M-x TAB\" only when encryption support is enabled."
- tramp-crypt-enabled)
+ (and tramp-crypt-enabled
+ ;; `tramp-crypt-remove-directory' needs to be completed only in
+ ;; case we have already crypted directories.
+ (or (not (eq symbol #'tramp-crypt-remove-directory))
+ tramp-crypt-directories)))
;;;###tramp-autoload
(defconst tramp-crypt-encfs-config ".encfs6.xml"
@@ -489,15 +493,17 @@ directory. File names will be also encrypted."
(setq tramp-crypt-directories (cons name tramp-crypt-directories)))
(tramp-register-file-name-handlers))
-;; `tramp-crypt-enabled-p' is not autoloaded, and this setting isn't either.
+;; `tramp-crypt-command-completion-p' is not autoloaded, and this
+;; setting isn't either.
(function-put
- #'tramp-crypt-add-directory 'completion-predicate #'tramp-crypt-enabled-p)
+ #'tramp-crypt-add-directory 'completion-predicate
+ #'tramp-crypt-command-completion-p)
(defun tramp-crypt-remove-directory (name)
"Unmark remote directory NAME for encryption.
Existing files in that directory and its subdirectories will be
kept in their encrypted form."
- ;; (declare (completion tramp-crypt-enabled-p))
+ ;; (declare (completion tramp-crypt-command-completion-p))
(interactive "DRemote directory name: ")
(unless tramp-crypt-enabled
(tramp-user-error nil "Feature is not enabled."))
@@ -513,7 +519,8 @@ kept in their encrypted form."
;; Starting with Emacs 28.1, this can be replaced by the "(declare ...)" form.
(function-put
- #'tramp-crypt-remove-directory 'completion-predicate #'tramp-crypt-enabled-p)
+ #'tramp-crypt-remove-directory 'completion-predicate
+ #'tramp-crypt-command-completion-p)
;; `auth-source' requires a user.
(defun tramp-crypt-dissect-file-name (name)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 5120b61: Improve command completion in tramp-crypt.el,
Michael Albinus <=