mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-30 04:10:54 -08:00
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.
This commit is contained in:
parent
3fd2b00a4b
commit
a537814709
4 changed files with 23 additions and 2 deletions
|
|
@ -381,7 +381,8 @@ jump to the bookmark.
|
|||
@code{bookmark-jump} can find the proper position even if the file is
|
||||
modified slightly. The variable @code{bookmark-search-size} says how
|
||||
many characters of context to record on each side of the bookmark's
|
||||
position.
|
||||
position. (In buffers that are visiting encrypted files, no context
|
||||
is saved in the bookmarks file no matter the value of this variable.)
|
||||
|
||||
Here are some additional commands for working with bookmarks:
|
||||
|
||||
|
|
|
|||
5
etc/NEWS
5
etc/NEWS
|
|
@ -180,6 +180,11 @@ of 'user-emacs-directory'.
|
|||
|
||||
* Incompatible changes in Emacs 29.1
|
||||
|
||||
+++
|
||||
*** bookmarks no longer include context for encrypted files.
|
||||
If you're visiting an encrypted file, setting a bookmark no longer
|
||||
includes excerpts from that buffer in the bookmarks file.
|
||||
|
||||
---
|
||||
*** 'show-paren-mode' is now disabled in 'special-mode' buffers.
|
||||
In Emacs versions previous to Emacs 28.1, 'show-paren-mode' defaulted
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -88,6 +88,10 @@ interface, update `file-name-handler-alist'."
|
|||
epa-file-inhibit-auto-save)
|
||||
(auto-save-mode 0)))
|
||||
|
||||
(defun epa-file-name-p (file)
|
||||
"Say whether FILE is handled by `epa-file'."
|
||||
(and auto-encryption-mode (string-match-p epa-file-name-regexp file)))
|
||||
|
||||
(define-minor-mode auto-encryption-mode
|
||||
"Toggle automatic file encryption/decryption (Auto Encryption mode)."
|
||||
:global t :init-value t :group 'epa-file :version "23.1"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue