InteractivelyDoThings

Ido lets you interactively do things with buffers and files. As an example, while searching for a file with C-x C-f, ido can suggest the files whose paths are closest to your current string, allowing you to find your files more quickly. Created by KimStorm, it has been built into Emacs since version 22.

Using IDO

Place this in your InitFile:

    (ido-mode t)

This will enable using Ido versions of find-file, switch-to-buffer, dired, display-buffer, insert-buffer, kill-buffer, insert-file, write-file and related commands, e.g. find-file-other-frame, when using the regular command key bindings.

To customize ido-mode, do

    M-x customize-group RET ido RET

Switching between buffers

To switch between buffers, press “C-x b”, invoking ido-switch-buffer, then:

Finding files

To find a file, press “C-x C-f”, invoking ido-find-file, then:

To restrict the list after a first filtering:

Recently visited directories:

The documentation for these keys is available via

Using Ido Programmatically

You can use Ido in your emacs-lisp programs. This is all you need:

  (setq mylist (list "red" "blue" "yellow" "clear" "i-dont-know"))
  (ido-completing-read "What, ... is your favorite color? " mylist)

Using IDO Select with ERC

Here is some code showing how to select an erc buffer using IDO features (including flex when enabled)

RichardRiley

  (defun rgr/ido-erc-buffer()
  (interactive)
  (switch-to-buffer
   (ido-completing-read "Channel:" 
                        (save-excursion
                          (delq
                           nil
                           (mapcar (lambda (buf)
                                     (when (buffer-live-p buf)
                                       (with-current-buffer buf
                                         (and (eq major-mode 'erc-mode)
                                              (buffer-name buf)))))
                                   (buffer-list)))))))

  (global-set-key (kbd "C-c e") 'rgr/ido-erc-buffer)

Helper Function to Select Based on Mode

This is based on what RichardRiley provided. I extracted it out, so I can easily make one for erc, one for shell, … . – ajvargo

(defun ido-for-mode(prompt the-mode)
  (switch-to-buffer
   (ido-completing-read prompt
                        (save-excursion
                          (delq
                           nil
                           (mapcar (lambda (buf)
                                     (when (buffer-live-p buf)
                                       (with-current-buffer buf
                                         (and (eq major-mode the-mode)
                                              (buffer-name buf)))))
                                   (buffer-list)))))))

(defun ido-shell-buffer()
  (interactive)
  (ido-for-mode "Shell:" 'shell-mode))

(global-set-key (kbd "C-c s") 'ido-shell-buffer)

Limit to Current Major Mode

Further variation on RichardRiley’s and ajvargo’s examples: Limit ido to the current major mode, whatever that might be. – wgreenhouse

(defun wg/ido-for-this-mode
  ()
  (interactive)
  (let
      ((the-mode major-mode))
    (switch-to-buffer
     (ido-completing-read
      (format "Buffers of %s: " the-mode)
      (save-excursion
	(delq
	 nil
	 (mapcar
	  (lambda
	    (buf)
	    (when
		(buffer-live-p buf)
	      (with-current-buffer buf
		(and
		 (eq major-mode the-mode)
		 (buffer-name buf)))))
	  (buffer-list))))))))

(global-set-key (kbd "H-t") 'wg/ido-for-this-mode)
(global-set-key (kbd "C-c t") 'wg/ido-for-this-mode)

Filter ido buffer list to show only directories

Adopting from RichardRiley’s example, you can filter the ido buffer list printed by “C-x b” by further invoking “C-d”. This allows for an easy way to switch to an opened dired buffer. – sagarjha

(defun ido-switch-to-dired (&optional removep)
  (interactive "P")
  (setq ido-cur-list
	(remove-if-not (lambda (buf-name)
			 (setq buf (get-buffer buf-name))
			 (when (buffer-live-p buf)
			   (with-current-buffer buf
			     (eq major-mode 'dired-mode))))
		       ido-cur-list)))

(defun bind-ido-keys ()
  "Keybindings for ido mode."
  (define-key ido-completion-map (kbd "C-d") 'ido-switch-to-dired))

(add-hook 'ido-setup-hook #'bind-ido-keys)

Mimicking an invocation of ido followed by some keys

I use ERC, and I wanted to bind something to the equivalent of “C-x b #”: that is, launching ido-switch-buffer and hitting a # so that ERC channels are given as options. However, it’s tough in general to write elisp or keyboard macros that run a command and start entering things into a minibuffer without finishing the prompt. For this special case, though, this elisp works:

    (ido-buffer-internal ido-default-buffer-method nil nil nil "#")

Miscellaneous Applications of Ido

M-x mode

    (global-set-key
     "\M-x"
     (lambda ()
       (interactive)
       (call-interactively
        (intern
         (ido-completing-read
          "M-x "
          (all-completions "" obarray 'commandp))))))

You can also check out Smex. On top of a M-x Ido interface it features ranking heuristics and some other extras.

– hfwang, modified by nsq

Invoking Bookmarks From Ido

Did you ever want to use bookmarks from within ido? I just did a little mashup of bookmark and ido code, just M-C-b from your ido file selection. – AnselmHelbig

    (setq enable-recursive-minibuffers t)
    (define-key ido-file-dir-completion-map [(meta control ?b)] 'ido-goto-bookmark)
    (defun ido-goto-bookmark (bookmark)
      (interactive
       (list (bookmark-completing-read "Jump to bookmark"
    				   bookmark-current-bookmark)))
      (unless bookmark
        (error "No bookmark specified"))
      (let ((filename (bookmark-get-filename bookmark)))
        (ido-set-current-directory
         (if (file-directory-p filename)
             filename
           (file-name-directory filename)))
        (setq ido-exit        'refresh
              ido-text-init   ido-text
              ido-rotate-temp t)
        (exit-minibuffer)))

If you don’t want to set recursive minibuffers globally, you could also activate them locally in the above function using a let declaration.

The problem with this function is, if my bookmark is a directory, whose path I already started typing before realizing I could invoke it, the last path component will be appended to the bookmark path.

Eg. if I have a bookmark for path “/Users/gael/Documents/code/2012/my-super-project" and I had typed "/Users/gael/Docu" before invoking the bookmark, then IDO will display the path: "/Users/gael/Documents/code/2012/my-super-project/Docu” and I have to delete “Docu” by hand.

Here is a better way:

  (require 'bookmark)
  (setq enable-recursive-minibuffers t)
  (define-key ido-file-dir-completion-map [(meta control ?b)] 'ido-goto-bookmark)
  (defun ido-goto-bookmark (bookmark)
    (interactive
     (list (bookmark-completing-read "Jump to bookmark"
      				   bookmark-current-bookmark)))
    (unless bookmark
      (error "No bookmark specified"))
    (let ((filename (bookmark-get-filename bookmark)))
      (if (file-directory-p filename)
  	(progn
  	  (ido-set-current-directory filename)
  	  (setq ido-text ""))
        (progn
  	(ido-set-current-directory (file-name-directory filename))))
      (setq ido-exit        'refresh
  	  ido-text-init   ido-text
  	  ido-rotate-temp t)
      (exit-minibuffer)))

--Gaël Deest

What about the following?

  (defun ido-bookmark-jump (bname)
    "*Switch to bookmark interactively using `ido'."
    (interactive (list (ido-completing-read "Bookmark: " (bookmark-all-names) nil t)))
    (bookmark-jump bname))

Complete find-tag using ido

  (defun my-ido-find-tag ()
    "Find a tag using ido"
    (interactive)
    (tags-completion-table)
    (let (tag-names)
      (mapcar (lambda (x)
                  (push (prin1-to-string x t) tag-names))
                tags-completion-table)
      (find-tag (ido-completing-read "Tag: " tag-names))))

If you have a very large Tags file, you might want to cache the tag-names list and refresh it only when you update Tags:

  ;; This isn't necessary, but I thought it helpful as a reminder to refresh if the cache isn't initialized 
  (setq my-tag-names (list "empty (run my-ido-find-tag-refresh"))
  (defun my-ido-find-tag-refresh ()
    "Refresh ido tag list"
    (interactive)
    ;; tags-completion-table() early-outs if the table has already been created
    ;; This is problematic if TAGS has changed
    ;; Clearing it here ensures the table won't get out of sync
    (setq tags-completion-table nil)
    (tags-completion-table)
    (setq my-tag-names nil) ;; Clear the list so we don't get duplicates (and get rid of reminder value)
    (mapcar (lambda (x)
              (push (prin1-to-string x t) my-tag-names))
            tags-completion-table))
  (defun my-ido-find-tag ()
    "Find a tag using ido"
    (interactive)
    (find-tag (ido-completing-read "Tag: " my-tag-names)))

Find files in Tags File

From the screencast above:

    (defun ido-find-file-in-tag-files ()
      (interactive)
      (save-excursion
        (let ((enable-recursive-minibuffers t))
          (visit-tags-table-buffer))
        (find-file
         (expand-file-name
          (ido-completing-read
           "Project file: " (tags-table-files) nil t)))))

Selects among the files listed in the tags file. Similar to “find file in project” in TextMate; the tags file defines your project.

Philipp: Is there an equivalent command that supports TAGS generated by GNU gtags?

Icicles command ‘icicle-find-file-in-tag-table’ does this also. See Icicles - Tags File Projects.

Completing Imenu tags

Lisp:idomenu.el

Use ido to find any file from the project

If you define projects using project-root.el you can quickly find files that belong to the project. Useful as an alternative to bookmarks.

    (defun my-ido-project-files ()
      "Use ido to select a file from the project."
      (interactive)
      (let (my-project-root project-files tbl)
      (unless project-details (project-root-fetch))
      (setq my-project-root (cdr project-details))
      ;; get project files
      (setq project-files 
	    (split-string 
	     (shell-command-to-string 
	      (concat "find "
		      my-project-root
		      " \\( -name \"*.svn\" -o -name \"*.git\" \\) -prune -o -type f -print | grep -E -v \"\.(pyc)$\""
		      )) "\n"))
      ;; populate hash table (display repr => path)
      (setq tbl (make-hash-table :test 'equal))
      (let (ido-list)
      (mapc (lambda (path)
	      ;; format path for display in ido list
	      (setq key (replace-regexp-in-string "\\(.*?\\)\\([^/]+?\\)$" "\\2|\\1" path))
	      ;; strip project root
	      (setq key (replace-regexp-in-string my-project-root "" key))
	      ;; remove trailing | or /
	      (setq key (replace-regexp-in-string "\\(|\\|/\\)$" "" key))
	      (puthash key path tbl)
	      (push key ido-list)
	      )
	    project-files
	    )
      (find-file (gethash (ido-completing-read "project-files: " ido-list) tbl)))))
    ;; bind to a key for quick access
    (define-key global-map [f6] 'my-ido-project-files)

--fas

Make Ido complete almost anything (except the stuff where it shouldn't)

    (defvar ido-enable-replace-completing-read t
      "If t, use ido-completing-read instead of completing-read if possible.
    
    Set it to nil using let in around-advice for functions where the
    original completing-read is required.  For example, if a function
    foo absolutely must use the original completing-read, define some
    advice like this:
    
    (defadvice foo (around original-completing-read-only activate)
      (let (ido-enable-replace-completing-read) ad-do-it))")
    
    ;; Replace completing-read wherever possible, unless directed otherwise
    (defadvice completing-read
      (around use-ido-when-possible activate)
      (if (or (not ido-enable-replace-completing-read) ; Manual override disable ido
              (and (boundp 'ido-cur-list)
                   ido-cur-list)) ; Avoid infinite loop from ido calling this
          ad-do-it
        (let ((allcomp (all-completions "" collection predicate)))
          (if allcomp
              (setq ad-return-value
                    (ido-completing-read prompt
                                   allcomp
                                   nil require-match initial-input hist def))
            ad-do-it))))

Problem using advice to reset to completing-read

1. Incompatible Libraries

2. I like using ido for (almost) everything a lot but it gets slow for a long list of possible completions (e.g. for describe-function).

Using the defadvice as described does not work for me? Is it just me or is this a bug? TIA – sebhofer

Fixed. It seems in version >=23, ido-cur-list is always bound and you need to check it as well. – LeWang

I found ido-completing-read to interfere when using dired mode buffers (e.g., renaming files). To turn it off:

    (add-hook 'dired-mode-hook
              '(lambda () (setq ido-enable-replace-completing-read nil)))

ChrisPoole

Fixed: use local varible

    (add-hook 'dired-mode-hook
              '(lambda ()
                 (set (make-local-variable 'ido-enable-replace-completing-read) nil)))

– Shihpin

Use ido in ibuffer

ibuffer mode doesn’t come with an option to use ido-find-file, so here’s a simple adaptation of ibuffer-find-file that uses ido instead of read-file:

(defun ibuffer-ido-find-file (file &optional wildcards)
  "Like `ido-find-file', but default to the directory of the buffer at point."
  (interactive
   (let ((default-directory
           (let ((buf (ibuffer-current-buffer)))
             (if (buffer-live-p buf)
                 (with-current-buffer buf
                   default-directory)
               default-directory))))
     (list (ido-read-file-name "Find file: " default-directory) t)))
  (find-file file wildcards))

To use this, if you’ve already (require 'ibuffer)’d, (define-key ibuffer-mode-map "\C-x\C-f" 'ibuffer-ido-find-file) should work, if you haven’t required it do

(add-hook 'ibuffer-mode-hook
          (lambda ()
            (define-key ibuffer-mode-map "\C-x\C-f"
              'ibuffer-ido-find-file)))

BrandonWMaister

– new definition of ibuffer-ido-find-file by TreyHarris to suppress wrong type argument errors that could happen in some circumstances.

choosing functions with ido

Use ido-choose-function in your code to select a function and partially apply arguments interactively:

https://github.com/vapniks/ido-choose-function

ido-ubiquitous

The ido ubiquitous module allows you set up to use ido with almost anything that uses completion. For example in ‘C-h f’. Extremely useful. Although for ‘M-x’ there is the improved Smex package. It is now maintained by Ryan Thompson:

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

ido-ubiquitous compile-log issue

If ido-ubiquitous 1.6 is used in emacs 24.3, there will always be a compile-log buffer warning:

    .emacs.d/elpa/ido-ubiquitous-20121214.2145/ido-ubiquitous.elc:Warning:
        reference to free variable `ido-cur-item'
    .emacs.d/elpa/ido-ubiquitous-20121214.2145/ido-ubiquitous.elc:Warning:
        reference to free variable `ido-default-item'
    .emacs.d/elpa/ido-ubiquitous-20121214.2145/ido-ubiquitous.elc:Warning:
        reference to free variable `ido-cur-list'

Just add the following three defvars to get around this problem:

    (defvar ido-cur-item nil)
    (defvar ido-default-item nil)
    (defvar ido-cur-list nil)

ido-at-point

If you want to have ido-style completion-at-point (the default in-buffer completion), check out the ido-at-point package. It replaces the standard completions buffer on M-tab with ido prompt.

Ido Hacks (modifying Ido's behavior)

Better flex (fuzzy) matching for Ido

You can make use of built-in ido fuzzy match with (setq ido-enable-flex-matching t)

Other options include:

Display Completions Vertically

It’s a lot easier to scan long path names if they’re displayed vertically, instead of horizontally. Run this to achieve just that:

This can be achieved by installing package ido-vertical-mode, which (presumably), does the following, below.

  ;; Display ido results vertically, rather than horizontally
  (setq ido-decorations (quote ("\n-> " "" "\n   " "\n   ..." "[" "]" " [No match]" " [Matched]" " [Not readable]" " [Too big]" " [Confirm]")))
  (defun ido-disable-line-truncation () (set (make-local-variable 'truncate-lines) nil))
  (add-hook 'ido-minibuffer-setup-hook 'ido-disable-line-truncation)
  (defun ido-define-keys () ;; C-n/p is more intuitive in vertical layout
    (define-key ido-completion-map (kbd "C-n") 'ido-next-match)
    (define-key ido-completion-map (kbd "C-p") 'ido-prev-match))
  (add-hook 'ido-setup-hook 'ido-define-keys)

timcharper, jpkotta

Control-TAB buffer switching with Ido

nXhtml tweaks Ido to do ControlTABbufferCycling combined with Ido’s normal buffer switching.

Sort files by mtime

Why would anyone want an alphabetically sorted list? You can save keystrokes if the most recently modified files are at the front.

To achieve this use the package ido-sort-mtime (available in MELPA), which is more reliable than the scripts below, which breaks on TRAMP files or if you enter //, etc.

  ; sort ido filelist by mtime instead of alphabetically
  (add-hook 'ido-make-file-list-hook 'ido-sort-mtime)
  (add-hook 'ido-make-dir-list-hook 'ido-sort-mtime)
  (defun ido-sort-mtime ()
    (setq ido-temp-list
          (sort ido-temp-list 
                (lambda (a b)
                  (time-less-p
                   (sixth (file-attributes (concat ido-current-directory b)))
                   (sixth (file-attributes (concat ido-current-directory a)))))))
    (ido-to-end  ;; move . files to end (again)
     (delq nil (mapcar
                (lambda (x) (and (char-equal (string-to-char x) ?.) x))
                ido-temp-list))))

If you want to ensure ‘.’ is not buried by this, change the final lambda as follows (or equivalent):

    (lambda (x) (and (string-match-p "^\\.." x) x))

Depending on the type of entities (e.g. file names) in the list and your current context, it can often be more convenient to sort alphabetically. It all depends. For files and directories, this is why we have different sort orders in DiredMode (see, e.g., DiredSortMenu).

On my system (Debian squeeze), there are “files” in the root directory ending in a colon for which applying file-attributes to them invokes tramp, and tramp hangs with “Tramp: Waiting for prompts from remote shell”. Changing the sort predicate in the above code to the following seems to work:

    (lambda (a b)
      (let ((a-tramp-file-p (string-match-p ":\\'" a))
            (b-tramp-file-p (string-match-p ":\\'" b)))
        (cond
         ((and a-tramp-file-p b-tramp-file-p)
          (string< a b))
         (a-tramp-file-p nil)
         (b-tramp-file-p t)
         (t (time-less-p
             (sixth (file-attributes (concat ido-current-directory b)))
             (sixth (file-attributes (concat ido-current-directory a))))))))

On my system, when I type //, ido-sort-mtime breaks. This is due to having pseudo files in the root like @berend (they don’t exist, they just show up in this sort routine). That breaks the sort with an error message. The following simply checks if the file starts with “@”:

(defun ido-sort-mtime ()
  (message ido-current-directory)
  (setq ido-temp-list
        (sort ido-temp-list
              (lambda (a b)
                if (not (or (char-equal (string-to-char a) ?@) (char-equal (string-to-char b) ?@)))
                (time-less-p
                 (sixth (file-attributes (concat ido-current-directory b))
                        (sixth (file-attributes (concat ido-current-directory a)))))
                 nil)))
                      (ido-to-end  ;; move . files to end (again)
                       (delq nil (mapcar
                                  (lambda (x) (and (string-match-p "^\\.." x) x))
                                  ido-temp-list))))

See also SortOrder.

A better (IMHO) ido-edit-input function

In order to be more consistent with the normal find-file HCI, to which I am really really used (and, by the waym with the way command shells do completion), I changed slighlty the behaviour of the backspace and C-e keys in ‘file mode :

  (defun ido-my-edit-input () "bla" (interactive)
    (setq ido-current-directory 
          (concat (abbreviate-file-name ido-current-directory) ido-text ))
    (setq ido-text "")
    (ido-edit-input)
    )
  
  (defun ido-my-keys ()
    "Add my keybindings for ido."
    (when (eq ido-cur-item 'file)
      (define-key ido-mode-map (kbd "ESC DEL") 'ido-delete-backward-updir)
      (define-key ido-mode-map (kbd "C-e") 'ido-my-edit-input)
      (define-key ido-mode-map (kbd "<backspace>") 'ido-my-edit-input)
     ))

Maybe this is useless with recent versions of emacs/ido, but here I’m forced to use emacs 21, so I downloaded ido 1.56 from cua.dk and it works like a charm. My only difficulty was that I had to comment this line in ido-read-internal, and i don’t really know what kind of wizardry I am trying to cheat here.

   ;;(process-environment (cons "HOME=/" process-environment)) 

Gyom

Invoke any command using ido in other window / split window, deciding after the fact instead of before

This makes ido-find-file-other-window, ido-switch-buffer-other-window, et. al obsolete. It’s a much better abstraction, and I believe it should become apart of ido mode, because any command that uses ido-completing-read can benefit from it without any additional effort, including textmate.el’s textmate-goto-symbol.

http://gist.github.com/493269

Make RET easier to use with ido-find-file

Both SPC and RET in ido-find-file cause ido to descend directories. C-j can be used to select a matched directory name, but if used after typing a prefix, it creates a new file of that name. What I need is a binding between the two: where RET immediately selects whatever directory is shown in the minibuffer -- or has been partially selected – while SPC or / can be used to keep descending. Doing things required a hack, as there is no customization to achieve this. Here is the code for your .emacs. – JohnWiegley

  (defun ido-smart-select-text ()
    "Select the current completed item.  Do NOT descend into directories."
    (interactive)
    (when (and (or (not ido-require-match)
                   (if (memq ido-require-match
                             '(confirm confirm-after-completion))
                       (if (or (eq ido-cur-item 'dir)
                               (eq last-command this-command))
                           t
                         (setq ido-show-confirm-message t)
                         nil))
                   (ido-existing-item-p))
               (not ido-incomplete-regexp))
      (when ido-current-directory
        (setq ido-exit 'takeprompt)
        (unless (and ido-text (= 0 (length ido-text)))
          (let ((match (ido-name (car ido-matches))))
            (throw 'ido
                   (setq ido-selected
                         (if match
                             (replace-regexp-in-string "/\\'" "" match)
                           ido-text)
                         ido-text ido-selected
                         ido-final-text ido-text)))))
      (exit-minibuffer)))
  
  (eval-after-load "ido"
    '(define-key ido-common-completion-map "\C-m" 'ido-smart-select-text))

ido-hacks.el

Misc collection of ido changes, including making it behave better with dired’s copying and renaming commands (such as putting directory as first option).

Emacs 23 and lower: http://www0.fh-trier.de/~politza/emacs/ido-hacks.el.gz An Emacs 24 compatible version is available at https://github.com/scottjad/ido-hacks

Multi-select

Simple function that can be used to select multiple items using ido-completing-read by injecting a “sentinel” value into the possible choices and reading in a loop until the user chooses the sentinel value. The selected choices are returned in a list.

https://gist.github.com/1329188

mgalgs

filtering out items and other hacks

I’ve collected some of the above mentioned hacks, and a few other handy ido functions here:

https://github.com/vapniks/ido-jb-misc-extras

Included is a redefinition of ido-restrict-to-matches so that when called with a prefix arg it removes matching items from the current list instead of restricting to them.

Disable ido mode for particular commands, e.g. write-file

While ido is a great thing, it is totally annoying when trying to write a new file. Of course you can cancel the useles completion prompt anytime with ‘C-f’. However, I do this every single time when I hot ‘C-x C-w’. So I decided to turn ido off for write-file.

ido-mode’s remapping keys are defined in ido-minor-mode-map-entry, this is not the keymap, but its ‘cdr’ is the keymap. So to disable the ‘C-x C-w’ remapping:

    (define-key (cdr ido-minor-mode-map-entry) [remap write-file] nil)

ido-preview

Two functions, that allow to view current item contents in a temporary buffer and window(clearing surrounding windows, but it’s safe). Content is either file contents, buffer contents or function description.

Content can also be second list’s element, that must be string:

  (ido-completing-read "What, ... is your favorite color? "
    (list
      (list "red" "Red is #ff0000")
      (list "blue" "Blue is #0000ff")
      "yellow"
      "clear"
      (list "i-dont-know" "So why do you think my ido-preview will ever know it?")))

Lisp:ido-preview.el

Icicles and Ido

Icicles is similar to Ido in some ways, and the two are sometimes confused. In Icicles, you use the same minibuffer interface for files, buffers, commands – everything (even keys). Like Ido, Icicles offers cycling and several kinds of completion matching (regexp, substring, 5 kinds of fuzzy, prefix).

Unlike Ido, in Icicles you can:

You cannot use Icicles and Ido together – they use the minibuffer differently. You can, however, use Icicles and IswitchB together. (IswitchB provides buffer-switching similar to Ido, but it does not provide Ido’s file visiting.) And you can make Icicles behave more like Ido, if you prefer that interaction – see Icicles - Ido and IswitchB.

Ido Load Library

Load-library alternative for Emacs using ‘ido-completing-read’.

IdoLoadLibrary

ido-gnus

Access gnus groups or servers using ido.

Lisp:ido-gnus.el

ido-yasnippet

Access yas snippets using ido.

Lisp:yas-ido.el

ido-webjump

Use ido for selecting URLs for WebJump.

Lisp:webjump-ido.el

ido-choose-function

Use ido to select functions and (partially) apply arguments.

Lisp:ido-choose-function.el

ido-apt-utils

Ido commands for apt-utils.

Lisp:apt-utils-ido.el

ido-jb-misc-extras

Miscellaneous extra ido related commands.

Lisp:ido-jb-misc-extras.el

Ido History

Quote from the history section of ido.el:

Since I discovered StephenEglen’s excellent iswitchb package, I just couldn’t live without it, but once being addicted to switching buffers with a minimum of keystrokes, I soon found that opening files in the old-fashioned way was just too slow - so I decided to write a package which could open files with the same speed and ease as iswitchb could switch buffers.
I originally wrote a separate ifindf.el package based on a copy of iswitchb.el, which did for opening files what iswitchb did for switching buffers. Along the way, I corrected a few errors in ifindf which could have found its way back into iswitchb, but since most of the functionality of the two package was practically identical, I decided that the proper thing to do was to merge my ifindf package back into iswitchb.
This is basically what ido (interactively do) is all about; but I found it awkward to merge my changes into the “iswitchb-” namespace, so I invented a common “ido-” namespace for the merged packages.

Preventing auto-searches unless called explicitly

   ;; a better solution
   (setq ido-auto-merge-work-directories-length -1)
   ;; disable auto searching for files unless called explicitly
   (setq ido-auto-merge-delay-time 99999)
   (define-key ido-file-dir-completion-map (kbd "C-c C-s") 
      (lambda() 
        (interactive)
        (ido-initiate-auto-merge (current-buffer))))

A Hint About "Too Big"

Once upon a time, I created a lot of files in a given directory. When I later tried to open a file in that directory with C-x C-f (ido-find-file), not surprisingly, it displayed [Too Big], rather than showing me a list of files in that directory.

But after I deleted all those files, it still said [Too Big]. Even after rebooting Emacs!

I eventually realized that the directory itself was Too Big – Unix directories get bigger as you add files, but, oddly, don’t get smaller when you delete those files – and so I needed to ensmallen it. I did that by creating a new directory “frotz”, and in the old, too-big directory, doing something like find . -mindepth 1 -maxdepth 1 -exec mv {} frotz ';'. That moved everything from the old directory to the new. Then I deleted the old directory, and renamed the new one to the old one’s name. Voila.

You could call this “garbage-collecting” a directory.


Alternatively, you can change the value of ido-max-directory-size:

 (setq ido-max-directory-size 100000)

--JasonDunsmore

Wish list

truename files

it would be nice if ido could truename files. ido blows away the truenaming of files that i had set up with ffap. It can be very confusing to open a symlink and have the buffer name be the name of the symlink. I fixed this in ffap with the following code, but I don’t know where to fix it in ido since it does not seem to have a finder variable.

  ;;finding file keeps buffer name as symlink name.  all the truename vars do
  ;;not fix.  this does.  this should use before advice changing filename?
  (defun alpha-find-file-truename (filename &optional codesys)
    "used for ffap."
    (interactive "FFile name (will be truenamed): ")
    (find-file (file-truename filename) codesys))
  (setf ffap-file-finder 'alpha-find-file-truename)
  ;;here are variables.  they are insufficient for getting the ;;truename.  in emacs 22, you only get truename if you
  ;;already had the original file in a buffer.  it is as if these
  ;;variables are simply ignored.  there are no other variables.
  (setf find-file-compare-truenames t)    ;xemacs
  (setf find-file-existing-other-name t)  ;emacs and xemacs alias for ffct
  ;;find-file-use-truenames seems to default to t in xemacs but not in emacs.
  ;;why can't they compare inode for hard links and what happens if these are nil?
  (setf find-file-visit-truename t)

--gambarimasu

bury buffer

Sometimes I think it would be convenient to be able to bury buffer. I can use bury-buffer command, and it works with standard emacs C-xb, but ido seems to ignore it. Is there a way to bury buffer in ido? – KonstantinAntipin

zsh style completion

I find ido-find-file too intrusive, I would prefer something that ressembles my menu completion in zsh. It would run the regular find-file, and switch to ido when I press TAB twice. From there I could select my item with the arrows and RET then the minibuffer would return to find-file mode.

The relevant zsh config is here: http://zshwiki.org/home/examples/compquickstartDenisMartinez

ido and ibus

I have a number of files named in Chinese. In the standard find-file I can use ibus to enter their names, or part of their names. This doesn’t work with ido-find-file. – Bernard Hurley

You might get some help here, but this sounds like a bug. Please use ‘M-x report-emacs-bug’, providing a recipe from emacs -Q. – DrewAdams

Done!! – Bernard Hurley

Searching for unicode characters with IsearchPlus when IdoUbiquitous is enabled.

In Emacs 24.2.1, and maybe other versions, if you use IsearchPlus with Ido Ubiquitous enabled, you find that you can’t search for unicode charaters and if you try an error is generated. In Emacs 24.2.1 the solution is to disable Ido’s advice around ‘completing-read’ when ‘isearchp-read-unicode-char’ is called. This can be done by putting:

(ido-ubiquitous-disable-in isearchp-read-unicode-char)

in your .emacs file. When I first did this, I evaluated the form interactively and it didn’t seem to fix the problem - I don’t know why - but it worked next time I started up Emacs. – Bernard Hurley

Grouping files by directories.

It will be very helpful, especially when browsing code, to be able to group files by directories (so that we get some sort of tree representation) in the ibuffer mode.


CategoryCommands CategoryBufferSwitching CategoryCompletion