emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 42037d8 2/2: Don't save places in literally-visited files


From: Lars Ingebrigtsen
Subject: master 42037d8 2/2: Don't save places in literally-visited files
Date: Wed, 10 Nov 2021 23:05:26 -0500 (EST)

branch: master
commit 42037d8948f0209a88c64949adf5016229e4beec
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Don't save places in literally-visited files
    
    * lisp/saveplace.el (save-places-to-alist): Don't save places in
    literally-visited files (bug#51740).
---
 lisp/saveplace.el | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/lisp/saveplace.el b/lisp/saveplace.el
index 4191a3f..3eff816 100644
--- a/lisp/saveplace.el
+++ b/lisp/saveplace.el
@@ -328,11 +328,18 @@ may have changed) back to `save-place-alist'."
       (with-current-buffer (car buf-list)
        ;; save-place checks buffer-file-name too, but we can avoid
        ;; overhead of function call by checking here too.
-       (and (or buffer-file-name (and (derived-mode-p 'dired-mode)
-                                       (boundp 'dired-subdir-alist)
-                                      dired-subdir-alist
-                                      (dired-current-directory)))
-            (save-place-to-alist))
+       (when (and (or buffer-file-name
+                       (and (derived-mode-p 'dired-mode)
+                            (boundp 'dired-subdir-alist)
+                           dired-subdir-alist
+                           (dired-current-directory)))
+                   ;; Don't save place in literally-visited file
+                   ;; because this will commonly differ from the place
+                   ;; when visiting literally (and
+                   ;; `find-file-literally' always places point at the
+                   ;; start of the buffer).
+                   (not find-file-literally))
+         (save-place-to-alist))
        (setq buf-list (cdr buf-list))))))
 
 (defun save-place-find-file-hook ()



reply via email to

[Prev in Thread] Current Thread [Next in Thread]