aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip Hudson2018-11-24 00:16:14 +0000
committerEli Zaretskii2018-12-08 11:07:43 +0200
commitddb6efdbc52d9abc09511842988c5220961e1ec8 (patch)
tree86314bbd4d936dc154db4b9219a344627968e031
parent3660d665874dfea54571be0619f5d033b7873594 (diff)
downloademacs-ddb6efdbc52d9abc09511842988c5220961e1ec8.tar.gz
emacs-ddb6efdbc52d9abc09511842988c5220961e1ec8.zip
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'. (Bug#33477)
-rw-r--r--lisp/eshell/em-dirs.el9
1 files changed, 5 insertions, 4 deletions
diff --git a/lisp/eshell/em-dirs.el b/lisp/eshell/em-dirs.el
index b7d13ee27b7..c16a5ac6e07 100644
--- a/lisp/eshell/em-dirs.el
+++ b/lisp/eshell/em-dirs.el
@@ -552,15 +552,16 @@ in the minibuffer:
552 552
553(defun eshell-write-last-dir-ring () 553(defun eshell-write-last-dir-ring ()
554 "Write the buffer's `eshell-last-dir-ring' to a history file." 554 "Write the buffer's `eshell-last-dir-ring' to a history file."
555 (let ((file eshell-last-dir-ring-file-name)) 555 (let* ((file eshell-last-dir-ring-file-name)
556 (resolved-file (file-truename file)))
556 (cond 557 (cond
557 ((or (null file) 558 ((or (null file)
558 (equal file "") 559 (equal file "")
559 (null eshell-last-dir-ring) 560 (null eshell-last-dir-ring)
560 (ring-empty-p eshell-last-dir-ring)) 561 (ring-empty-p eshell-last-dir-ring))
561 nil) 562 nil)
562 ((not (file-writable-p file)) 563 ((not (file-writable-p resolved-file))
563 (message "Cannot write last-dir-ring file %s" file)) 564 (message "Cannot write last-dir-ring file %s" resolved-file))
564 (t 565 (t
565 (let* ((ring eshell-last-dir-ring) 566 (let* ((ring eshell-last-dir-ring)
566 (index (ring-length ring))) 567 (index (ring-length ring)))
@@ -570,7 +571,7 @@ in the minibuffer:
570 (insert (ring-ref ring index) ?\n)) 571 (insert (ring-ref ring index) ?\n))
571 (insert (eshell/pwd) ?\n) 572 (insert (eshell/pwd) ?\n)
572 (eshell-with-private-file-modes 573 (eshell-with-private-file-modes
573 (write-region (point-min) (point-max) file nil 574 (write-region (point-min) (point-max) resolved-file nil
574 'no-message)))))))) 575 'no-message))))))))
575 576
576(provide 'em-dirs) 577(provide 'em-dirs)