emacs-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] make ido show known tramp host in read-directory-name


From: Vitalie Spinu
Subject: Re: [PATCH] make ido show known tramp host in read-directory-name
Date: Wed, 20 Nov 2013 13:44:29 -0800
User-agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (gnu/linux)

 >>> Stefan Monnier on Wed, 20 Nov 2013 08:29:17 -0500 wrote:

 >> +           (and (ido-final-slash (concat dir name))
 > Can expand-file-name be used here instead of concat?

Not really. The dir is like /ssh: and the name is like "amazon:". The
concat is for ido-final-slash to see that the name actually contains the
tramp root. 

The following patch is probably a cleaner implementation of the same
idea:


>From 358e9957a45b7a0689029ec014b56c37691cf939 Mon Sep 17 00:00:00 2001
From: Vitalie Spinu <address@hidden>
Date: Tue, 19 Nov 2013 18:52:35 -0800
Subject: [PATCH 1/1] make ido-make-dir-list-1 show known host

   allow missing end slash with tramp directories
---
 lisp/ido.el | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/lisp/ido.el b/lisp/ido.el
index 42b3607..08c9c47 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -3672,13 +3672,15 @@ in this list."
 (defun ido-make-dir-list-1 (dir &optional merged)
   "Return list of non-ignored subdirs in DIR.
 If MERGED is non-nil, each subdir is cons'ed with DIR."
-  (and (or (ido-is-tramp-root dir) (file-directory-p dir))
-       (delq nil
-            (mapcar
-             (lambda (name)
-               (and (ido-final-slash name) (not (ido-ignore-item-p name 
ido-ignore-directories))
-                    (if merged (cons name dir) name)))
-             (ido-file-name-all-completions dir)))))
+  (let ((tramp-root (ido-is-tramp-root dir)))
+    (and (or tramp-root (file-directory-p dir))
+         (delq nil
+               (mapcar
+                (lambda (name)
+                  (and (or tramp-root (ido-final-slash dir))
+                       (not (ido-ignore-item-p name ido-ignore-directories))
+                       (if merged (cons name dir) name)))
+                (ido-file-name-all-completions dir))))))
 
 (defun ido-make-dir-list (default)
   "Return the current list of directories.
-- 
1.8.1.2


reply via email to

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