emacs-diffs
[Top][All Lists]
Advanced

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

master 93da7a202d: Tweak how eshell/cd works when cd-ing to ".." from "/


From: Lars Ingebrigtsen
Subject: master 93da7a202d: Tweak how eshell/cd works when cd-ing to ".." from "/"
Date: Sat, 5 Feb 2022 17:58:27 -0500 (EST)

branch: master
commit 93da7a202d8fc23cd3af064eb94adbb1c9c0944f
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Tweak how eshell/cd works when cd-ing to ".." from "/"
    
    * lisp/eshell/em-dirs.el (eshell/cd): Make "cd .." from "/" less
    confusing (bug#16861).
---
 lisp/eshell/em-dirs.el | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lisp/eshell/em-dirs.el b/lisp/eshell/em-dirs.el
index 893cad7b4f..3998026d7f 100644
--- a/lisp/eshell/em-dirs.el
+++ b/lisp/eshell/em-dirs.el
@@ -391,6 +391,10 @@ in the minibuffer:
        (unless (equal curdir newdir)
          (eshell-add-to-dir-ring curdir))
        (let ((result (cd newdir)))
+          ;; If we're in "/" and cd to ".." or the like, make things
+          ;; less confusing by changing "/.." to "/".
+          (when (equal (file-truename result) "/")
+            (setq result (cd "/")))
          (and eshell-cd-shows-directory
               (eshell-printn result)))
        (run-hooks 'eshell-directory-change-hook)



reply via email to

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