diff options
| author | Lars Ingebrigtsen | 2022-09-19 09:42:28 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2022-09-19 09:43:05 +0200 |
| commit | a53781470935fc0b7c7e576c3d02ed723c9587c4 (patch) | |
| tree | 76d7f07acdfd0b045d4fb26460e890ac2d0adf62 | |
| parent | 3fd2b00a4b20afa827afe0eee2b7ba5f08e4cce6 (diff) | |
| download | emacs-a53781470935fc0b7c7e576c3d02ed723c9587c4.tar.gz emacs-a53781470935fc0b7c7e576c3d02ed723c9587c4.zip | |
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.
| -rw-r--r-- | doc/emacs/regs.texi | 3 | ||||
| -rw-r--r-- | etc/NEWS | 5 | ||||
| -rw-r--r-- | lisp/bookmark.el | 13 | ||||
| -rw-r--r-- | lisp/epa-hook.el | 4 |
4 files changed, 23 insertions, 2 deletions
diff --git a/doc/emacs/regs.texi b/doc/emacs/regs.texi index fb936018798..ef9187bb9a6 100644 --- a/doc/emacs/regs.texi +++ b/doc/emacs/regs.texi | |||
| @@ -381,7 +381,8 @@ jump to the bookmark. | |||
| 381 | @code{bookmark-jump} can find the proper position even if the file is | 381 | @code{bookmark-jump} can find the proper position even if the file is |
| 382 | modified slightly. The variable @code{bookmark-search-size} says how | 382 | modified slightly. The variable @code{bookmark-search-size} says how |
| 383 | many characters of context to record on each side of the bookmark's | 383 | many characters of context to record on each side of the bookmark's |
| 384 | position. | 384 | position. (In buffers that are visiting encrypted files, no context |
| 385 | is saved in the bookmarks file no matter the value of this variable.) | ||
| 385 | 386 | ||
| 386 | Here are some additional commands for working with bookmarks: | 387 | Here are some additional commands for working with bookmarks: |
| 387 | 388 | ||
| @@ -180,6 +180,11 @@ of 'user-emacs-directory'. | |||
| 180 | 180 | ||
| 181 | * Incompatible changes in Emacs 29.1 | 181 | * Incompatible changes in Emacs 29.1 |
| 182 | 182 | ||
| 183 | +++ | ||
| 184 | *** bookmarks no longer include context for encrypted files. | ||
| 185 | If you're visiting an encrypted file, setting a bookmark no longer | ||
| 186 | includes excerpts from that buffer in the bookmarks file. | ||
| 187 | |||
| 183 | --- | 188 | --- |
| 184 | *** 'show-paren-mode' is now disabled in 'special-mode' buffers. | 189 | *** 'show-paren-mode' is now disabled in 'special-mode' buffers. |
| 185 | In Emacs versions previous to Emacs 28.1, 'show-paren-mode' defaulted | 190 | In Emacs versions previous to Emacs 28.1, 'show-paren-mode' defaulted |
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.") | |||
| 594 | 594 | ||
| 595 | (defun bookmark-make-record () | 595 | (defun bookmark-make-record () |
| 596 | "Return a new bookmark record (NAME . ALIST) for the current location." | 596 | "Return a new bookmark record (NAME . ALIST) for the current location." |
| 597 | (let ((record (funcall bookmark-make-record-function))) | 597 | (let* ((bookmark-search-size |
| 598 | ;; If we're in a buffer that's visiting an encrypted file, | ||
| 599 | ;; don't include any context in the bookmark file, because | ||
| 600 | ;; that would leak (possibly secret) data. | ||
| 601 | (if (and buffer-file-name | ||
| 602 | (or (and (fboundp 'epa-file-name-p) | ||
| 603 | (epa-file-name-p buffer-file-name)) | ||
| 604 | (and (fboundp 'tramp-crypt-file-name-p) | ||
| 605 | (tramp-crypt-file-name-p buffer-file-name)))) | ||
| 606 | 0 | ||
| 607 | bookmark-search-size)) | ||
| 608 | (record (funcall bookmark-make-record-function))) | ||
| 598 | ;; Set up default name if the function does not provide one. | 609 | ;; Set up default name if the function does not provide one. |
| 599 | (unless (stringp (car record)) | 610 | (unless (stringp (car record)) |
| 600 | (if (car record) (push nil record)) | 611 | (if (car record) (push nil record)) |
diff --git a/lisp/epa-hook.el b/lisp/epa-hook.el index 18e47c682e8..70c30308819 100644 --- a/lisp/epa-hook.el +++ b/lisp/epa-hook.el | |||
| @@ -88,6 +88,10 @@ interface, update `file-name-handler-alist'." | |||
| 88 | epa-file-inhibit-auto-save) | 88 | epa-file-inhibit-auto-save) |
| 89 | (auto-save-mode 0))) | 89 | (auto-save-mode 0))) |
| 90 | 90 | ||
| 91 | (defun epa-file-name-p (file) | ||
| 92 | "Say whether FILE is handled by `epa-file'." | ||
| 93 | (and auto-encryption-mode (string-match-p epa-file-name-regexp file))) | ||
| 94 | |||
| 91 | (define-minor-mode auto-encryption-mode | 95 | (define-minor-mode auto-encryption-mode |
| 92 | "Toggle automatic file encryption/decryption (Auto Encryption mode)." | 96 | "Toggle automatic file encryption/decryption (Auto Encryption mode)." |
| 93 | :global t :init-value t :group 'epa-file :version "23.1" | 97 | :global t :init-value t :group 'epa-file :version "23.1" |