emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/ivy-hydra 388e0d4 043/395: ivy.el (ivy--magic-tilde-dir


From: Basil L. Contovounesios
Subject: [elpa] externals/ivy-hydra 388e0d4 043/395: ivy.el (ivy--magic-tilde-directory): Fix for non-standard home path
Date: Thu, 25 Feb 2021 08:31:27 -0500 (EST)

branch: externals/ivy-hydra
commit 388e0d415f013cea48d92d1ac0cfd73ddbab173f
Author: Ha Le <halequang314@gmail.com>
Commit: Oleh Krehel <ohwoeowho@gmail.com>

    ivy.el (ivy--magic-tilde-directory): Fix for non-standard home path
    
    Fixes #2316
    Fixes #2319
---
 ivy.el | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/ivy.el b/ivy.el
index a7788a8..1a02aa3 100644
--- a/ivy.el
+++ b/ivy.el
@@ -3200,14 +3200,14 @@ Should be run via minibuffer `post-command-hook'."
 
 (defun ivy--magic-tilde-directory (dir)
   "Return an appropriate home for DIR for when ~ or ~/ are entered."
-  (expand-file-name
-   (let (remote)
-     (if (and (setq remote (file-remote-p dir))
-              (let ((local (file-local-name dir)))
-                (not (or (string= "/root/" local)
-                         (string-match-p "/home/\\([^/]+\\)/\\'" local)))))
-         (concat remote "~/")
-       "~/"))))
+  (file-name-as-directory
+   (expand-file-name
+    (let* ((home (expand-file-name (concat (file-remote-p dir) "~/")))
+           (dir-path (file-local-name dir))
+           (home-path (file-local-name home)))
+      (if (string= dir-path home-path)
+          "~"
+        home)))))
 
 (defun ivy-update-candidates (cands)
   (ivy--insert-minibuffer



reply via email to

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