Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Now we can use "wide find file" on remote directories #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 25 additions & 21 deletions lisp/ido.el
Original file line number Diff line number Diff line change
Expand Up @@ -3297,29 +3297,33 @@ instead removed from the current item list."

(defun ido-wide-find-dirs-or-files (dir file &optional prefix finddir)
;; As ido-run-find-command, but returns a list of cons pairs ("file" . "dir")
(let ((filenames
(delq nil
(mapcar (lambda (name)
(unless (ido-ignore-item-p name ido-ignore-files t)
name))
(split-string
(shell-command-to-string
(concat "find "
(shell-quote-argument dir)
(if ido-case-fold " -iname " " -name ")
(shell-quote-argument
(concat (if prefix "" "*") file "*"))
" -type " (if finddir "d" "f") " -print"))))))
filename d f
res)
(let* ((remote-prefix (file-remote-p dir))
(default-directory dir)
(filenames
(delq nil
(mapcar (lambda (name)
(unless (ido-ignore-item-p name ido-ignore-files t)
name))
(split-string
(shell-command-to-string
(concat "find "
(shell-quote-argument
(if remote-prefix
(string-remove-prefix remote-prefix dir) dir))
(if ido-case-fold " -iname " " -name ")
(shell-quote-argument
(concat (if prefix "" "*") file "*"))
" -type " (if finddir "d" "f") " -print"))))))
filename d f
res)
(while filenames
(setq filename (car filenames)
filenames (cdr filenames))
(setq filename (format "%s%s" (or remote-prefix "") (car filenames))
filenames (cdr filenames))
(if (and (file-name-absolute-p filename)
(file-exists-p filename))
(setq d (file-name-directory filename)
f (file-name-nondirectory filename)
res (cons (cons (if finddir (ido-final-slash f t) f) d) res))))
(file-exists-p filename))
(setq d (file-name-directory filename)
f (file-name-nondirectory filename)
res (cons (cons (if finddir (ido-final-slash f t) f) d) res))))
res))

(defun ido-flatten-merged-list (items)
Expand Down