Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get ido in dired buffers

Tags:

emacs

ido

dired

I frequently use dired-mode and I recently started using ido:

(ido-mode 1); enable ido-mode
(setq ido-enable-flex-matching t); flexibly match names via fuzzy matching
(setq ido-everywhere t); use ido-mode everywhere, in buffers and for finding files
(setq ido-use-filename-at-point 'guess); for find-file-at-point
(setq ido-use-url-at-point t); look for URLs at point
(setq ffap-require-prefix t); get find-file-at-point with C-u C-x C-f 

When I copy a file (with C) in a dired buffer, I still have to use the "standard way" of giving the new location where the file is copied to. That means, I have to use standard TAB-completion but there is no ido-completion. The same applies for R for moving files etc. I am thus wondering if it is possible to get ido also acting on C or R in dired buffers?

like image 423
Marius Hofert Avatar asked Jul 16 '12 13:07

Marius Hofert


2 Answers

Looks like I had the same problem you are experiencing. Some investigating shows that we need to override the variable read-file-name-function which, by default, calls read-file-name-function-default. But, looking at the source code for ido-everywhere (which is a minor mode), it does this for us.

Solution:

Rather than doing (setq ido-everywhere t), replace that with:

(ido-everywhere t)

This fixes it for me, causing ido-read-file-name to be called in dired buffers when you use C or similar.

Another Option:

You might also consider this beefed up version of ido-everywhere:

https://github.com/DarwinAwardWinner/ido-ubiquitous

;;; Commentary:

;; You may have seen the `ido-everywhere' variable in ido.el and got
;; excited that you could use ido completion for everything. Then you
;; were probably disappointed when you realized that it only applied
;; to *file names* and nothing else. Well, ido-ubiquitous is here to
;; fulfill the original promise and let you use ido completion for
;; (almost) any command that uses `completing-read' to offer you a
;; choice of several alternatives.
like image 88
assem Avatar answered Oct 01 '22 04:10

assem


I found that (put 'dired-do-rename 'ido 'find-file) for the R key works fine, if you need to stop at a path you simply press C-j instead of completing a file name.

like image 33
Silex Avatar answered Oct 01 '22 06:10

Silex