]> git.eshelyaron.com Git - emacs.git/commitdiff
Follow links in Eshell last-dir-ring
authorPhilip Hudson <phil.hudson@iname.com>
Sat, 24 Nov 2018 00:16:14 +0000 (00:16 +0000)
committerEli Zaretskii <eliz@gnu.org>
Sat, 8 Dec 2018 09:07:43 +0000 (11:07 +0200)
* lisp/eshell/em-hist.el (eshell-write-last-dir-ring):
Follow symlinks in 'eshell-last-dir-ring-file-name'.
(Bug#33477)

lisp/eshell/em-dirs.el

index b7d13ee27b7378083ae772d97ac9c64c39acec00..c16a5ac6e071f05576b685aa01f6aefc0f2db710 100644 (file)
@@ -552,15 +552,16 @@ in the minibuffer:
 
 (defun eshell-write-last-dir-ring ()
   "Write the buffer's `eshell-last-dir-ring' to a history file."
-  (let ((file eshell-last-dir-ring-file-name))
+  (let* ((file eshell-last-dir-ring-file-name)
+        (resolved-file (file-truename file)))
     (cond
      ((or (null file)
          (equal file "")
          (null eshell-last-dir-ring)
          (ring-empty-p eshell-last-dir-ring))
       nil)
-     ((not (file-writable-p file))
-      (message "Cannot write last-dir-ring file %s" file))
+     ((not (file-writable-p resolved-file))
+      (message "Cannot write last-dir-ring file %s" resolved-file))
      (t
       (let* ((ring eshell-last-dir-ring)
             (index (ring-length ring)))
@@ -570,7 +571,7 @@ in the minibuffer:
            (insert (ring-ref ring index) ?\n))
          (insert (eshell/pwd) ?\n)
          (eshell-with-private-file-modes
-          (write-region (point-min) (point-max) file nil
+          (write-region (point-min) (point-max) resolved-file nil
                         'no-message))))))))
 
 (provide 'em-dirs)