Commit ddb6efdb authored by Philip Hudson's avatar Philip Hudson Committed by Eli Zaretskii

Follow links in Eshell last-dir-ring

* lisp/eshell/em-hist.el (eshell-write-last-dir-ring):
Follow symlinks in 'eshell-last-dir-ring-file-name'.
parent 3660d665
......@@ -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)))
((or (null file)
(equal file "")
(null eshell-last-dir-ring)
(ring-empty-p eshell-last-dir-ring))
((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))
(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)
(write-region (point-min) (point-max) file nil
(write-region (point-min) (point-max) resolved-file nil
(provide 'em-dirs)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment