Commit 3660d665 authored by Philip Hudson's avatar Philip Hudson Committed by Eli Zaretskii

Follow symlink in Eshell history

* lisp/eshell/em-hist.el (eshell-write-history): Follow
symlinks in 'eshell-history-file-name'.  (Bug#33460)
parent 1fc73de5
......@@ -466,15 +466,16 @@ lost if `eshell-history-ring' is not empty. If
Useful within process sentinels.
See also `eshell-read-history'."
(let ((file (or filename eshell-history-file-name)))
(let* ((file (or filename eshell-history-file-name))
(resolved-file (file-truename file)))
((or (null file)
(equal file "")
(null eshell-history-ring)
(ring-empty-p eshell-history-ring))
((not (file-writable-p file))
(message "Cannot write history file %s" file))
((not (file-writable-p resolved-file))
(message "Cannot write history file %s" resolved-file))
(let* ((ring eshell-history-ring)
(index (ring-length ring)))
......@@ -489,7 +490,7 @@ See also `eshell-read-history'."
(insert (substring-no-properties (ring-ref ring index)) ?\n)
(subst-char-in-region start (1- (point)) ?\n ?\177)))
(write-region (point-min) (point-max) file append
(write-region (point-min) (point-max) resolved-file append
(defun eshell-list-history ()
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