diff options
author | Lars Ingebrigtsen <larsi@gnus.org> | 2022-09-19 09:42:28 +0200 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2022-09-19 09:43:05 +0200 |
commit | a53781470935fc0b7c7e576c3d02ed723c9587c4 (patch) | |
tree | 76d7f07acdfd0b045d4fb26460e890ac2d0adf62 /lisp/bookmark.el | |
parent | 3fd2b00a4b20afa827afe0eee2b7ba5f08e4cce6 (diff) | |
download | emacs-a53781470935fc0b7c7e576c3d02ed723c9587c4.tar.gz |
Don't save bookmark context from encrypted files
* doc/emacs/regs.texi (Bookmarks): Mention this.
* lisp/bookmark.el (bookmark-make-record): Don't include context
in encrypted files (bug#57856).
* lisp/epa-hook.el (epa-file-name-p): New function.
Diffstat (limited to 'lisp/bookmark.el')
-rw-r--r-- | lisp/bookmark.el | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lisp/bookmark.el b/lisp/bookmark.el index 8dfc16bf9fa..f150a24bbfb 100644 --- a/lisp/bookmark.el +++ b/lisp/bookmark.el @@ -594,7 +594,18 @@ equivalently just return ALIST without NAME.") (defun bookmark-make-record () "Return a new bookmark record (NAME . ALIST) for the current location." - (let ((record (funcall bookmark-make-record-function))) + (let* ((bookmark-search-size + ;; If we're in a buffer that's visiting an encrypted file, + ;; don't include any context in the bookmark file, because + ;; that would leak (possibly secret) data. + (if (and buffer-file-name + (or (and (fboundp 'epa-file-name-p) + (epa-file-name-p buffer-file-name)) + (and (fboundp 'tramp-crypt-file-name-p) + (tramp-crypt-file-name-p buffer-file-name)))) + 0 + bookmark-search-size)) + (record (funcall bookmark-make-record-function))) ;; Set up default name if the function does not provide one. (unless (stringp (car record)) (if (car record) (push nil record)) |