aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip Hudson2018-11-21 23:09:16 +0000
committerEli Zaretskii2018-12-08 11:03:44 +0200
commit3660d665874dfea54571be0619f5d033b7873594 (patch)
tree5e3e50f86d7f1277ed0c099937454cba78569099
parent1fc73de597ba395b3575c70dae68b6c3e5b5a3b7 (diff)
downloademacs-3660d665874dfea54571be0619f5d033b7873594.tar.gz
emacs-3660d665874dfea54571be0619f5d033b7873594.zip
Follow symlink in Eshell history
* lisp/eshell/em-hist.el (eshell-write-history): Follow symlinks in 'eshell-history-file-name'. (Bug#33460)
-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
466Useful within process sentinels. 466Useful within process sentinels.
467 467
468See also `eshell-read-history'." 468See also `eshell-read-history'."
469 (let ((file (or filename eshell-history-file-name))) 469 (let* ((file (or filename eshell-history-file-name))
470 (resolved-file (file-truename file)))
470 (cond 471 (cond
471 ((or (null file) 472 ((or (null file)
472 (equal file "") 473 (equal file "")
473 (null eshell-history-ring) 474 (null eshell-history-ring)
474 (ring-empty-p eshell-history-ring)) 475 (ring-empty-p eshell-history-ring))
475 nil) 476 nil)
476 ((not (file-writable-p file)) 477 ((not (file-writable-p resolved-file))
477 (message "Cannot write history file %s" file)) 478 (message "Cannot write history file %s" resolved-file))
478 (t 479 (t
479 (let* ((ring eshell-history-ring) 480 (let* ((ring eshell-history-ring)
480 (index (ring-length ring))) 481 (index (ring-length ring)))
@@ -489,7 +490,7 @@ See also `eshell-read-history'."
489 (insert (substring-no-properties (ring-ref ring index)) ?\n) 490 (insert (substring-no-properties (ring-ref ring index)) ?\n)
490 (subst-char-in-region start (1- (point)) ?\n ?\177))) 491 (subst-char-in-region start (1- (point)) ?\n ?\177)))
491 (eshell-with-private-file-modes 492 (eshell-with-private-file-modes
492 (write-region (point-min) (point-max) file append 493 (write-region (point-min) (point-max) resolved-file append
493 'no-message)))))))) 494 'no-message))))))))
494 495
495(defun eshell-list-history () 496(defun eshell-list-history ()