]> git.eshelyaron.com Git - emacs.git/commitdiff
Don't save places in literally-visited files
authorLars Ingebrigtsen <larsi@gnus.org>
Thu, 11 Nov 2021 04:04:31 +0000 (05:04 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Thu, 11 Nov 2021 04:04:31 +0000 (05:04 +0100)
* lisp/saveplace.el (save-places-to-alist): Don't save places in
literally-visited files (bug#51740).

lisp/saveplace.el

index 4191a3fa62e6f64e21f3850812e06a150025df42..3eff816fa0705d62d10c2648565be9435a452c9a 100644 (file)
@@ -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 ()