summaryrefslogtreecommitdiff
path: root/lisp/eshell/em-hist.el
diff options
context:
space:
mode:
authorPhilip Hudson <phil.hudson@iname.com>2018-11-21 23:09:16 +0000
committerEli Zaretskii <eliz@gnu.org>2018-12-08 11:03:44 +0200
commit3660d665874dfea54571be0619f5d033b7873594 (patch)
tree5e3e50f86d7f1277ed0c099937454cba78569099 /lisp/eshell/em-hist.el
parent1fc73de597ba395b3575c70dae68b6c3e5b5a3b7 (diff)
downloademacs-3660d665874dfea54571be0619f5d033b7873594.tar.gz
Follow symlink in Eshell history
* lisp/eshell/em-hist.el (eshell-write-history): Follow symlinks in 'eshell-history-file-name'. (Bug#33460)
Diffstat (limited to 'lisp/eshell/em-hist.el')
-rw-r--r--lisp/eshell/em-hist.el9
1 files changed, 5 insertions, 4 deletions
diff --git a/lisp/eshell/em-hist.el b/lisp/eshell/em-hist.el
index 62e2f57d0fd..f866dfd7276 100644
--- a/lisp/eshell/em-hist.el
+++ b/lisp/eshell/em-hist.el
@@ -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)))
(cond
((or (null file)
(equal file "")
(null eshell-history-ring)
(ring-empty-p eshell-history-ring))
nil)
- ((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))
(t
(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)))
(eshell-with-private-file-modes
- (write-region (point-min) (point-max) file append
+ (write-region (point-min) (point-max) resolved-file append
'no-message))))))))
(defun eshell-list-history ()