summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorPhilip Hudson <phil.hudson@iname.com>2018-11-24 00:16:14 +0000
committerEli Zaretskii <eliz@gnu.org>2018-12-08 11:07:43 +0200
commitddb6efdbc52d9abc09511842988c5220961e1ec8 (patch)
tree86314bbd4d936dc154db4b9219a344627968e031 /lisp
parent3660d665874dfea54571be0619f5d033b7873594 (diff)
downloademacs-ddb6efdbc52d9abc09511842988c5220961e1ec8.tar.gz
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)
Diffstat (limited to 'lisp')
-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:
(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)))
(cond
((or (null file)
(equal file "")
(null eshell-last-dir-ring)
(ring-empty-p eshell-last-dir-ring))
nil)
- ((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))
(t
(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)
(eshell-with-private-file-modes
- (write-region (point-min) (point-max) file nil
+ (write-region (point-min) (point-max) resolved-file nil
'no-message))))))))
(provide 'em-dirs)