emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master ddb6efd 2/4: Follow links in Eshell last-dir-ring


From: Eli Zaretskii
Subject: [Emacs-diffs] master ddb6efd 2/4: Follow links in Eshell last-dir-ring
Date: Sat, 8 Dec 2018 04:13:51 -0500 (EST)

branch: master
commit ddb6efdbc52d9abc09511842988c5220961e1ec8
Author: Philip Hudson <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    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)
---
 lisp/eshell/em-dirs.el | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lisp/eshell/em-dirs.el b/lisp/eshell/em-dirs.el
index b7d13ee..c16a5ac 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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]