diff options
author | Michael Albinus <michael.albinus@gmx.de> | 2022-09-22 13:14:46 +0200 |
---|---|---|
committer | Michael Albinus <michael.albinus@gmx.de> | 2022-09-22 13:14:46 +0200 |
commit | 4cb53c0528aad73ac001a5d0b4ae336b8ec65408 (patch) | |
tree | 8a92638ba671d4368d1a6e3be00b98150124c0a6 /lisp/auth-source.el | |
parent | 9369e4242fa51d53b05ce95842f124522289d8a3 (diff) | |
download | emacs-4cb53c0528aad73ac001a5d0b4ae336b8ec65408.tar.gz emacs-4cb53c0528aad73ac001a5d0b4ae336b8ec65408.tar.bz2 emacs-4cb53c0528aad73ac001a5d0b4ae336b8ec65408.zip |
Improve don't save bookmark context from encrypted files
* etc/NEWS: Mention 'bookmark-inhibit-context-functions'.
Fix typos.
* lisp/bookmark.el (bookmark-inhibit-context-functions): New defcustom.
(bookmark-make-record): Use it.
* lisp/auth-source-pass.el (auth-source-pass-file-name-p):
* lisp/auth-source.el (auth-source-file-name-p): New defuns. Add
them to `bookmark-inhibit-context-functions'.
* lisp/epa-hook.el (epa-file-name-p):
* lisp/net/tramp-crypt.el (tramp-crypt-file-name-p): Add them to
`bookmark-inhibit-context-functions'.
Diffstat (limited to 'lisp/auth-source.el')
-rw-r--r-- | lisp/auth-source.el | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lisp/auth-source.el b/lisp/auth-source.el index c79e5b81f76..feefd391a87 100644 --- a/lisp/auth-source.el +++ b/lisp/auth-source.el @@ -522,6 +522,21 @@ parameters." ;; (mapcar #'auth-source-backend-parse auth-sources) +(defun auth-source-file-name-p (file) + "Say whether FILE is used by `auth-sources'." + (let* ((backends (mapcar #'auth-source-backend-parse auth-sources)) + (files + (mapcar (lambda (x) + (when (member (slot-value x 'type) '(json netrc plstore)) + (slot-value x 'source))) + backends))) + (member (expand-file-name file) + (mapcar #'expand-file-name (remq nil files))))) + +(with-eval-after-load 'bookmark + (add-hook 'bookmark-inhibit-context-functions + #'auth-source-file-name-p)) + (cl-defun auth-source-search (&rest spec &key max require create delete &allow-other-keys) |