* 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.
@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:
\f
* 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
(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))
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"