(or emacs irrelevant)

Easy ido improvement

Heh, I guess I was so busy at work that I missed the opportunity to make an especially good post for the 50-post landmark. At least according to M-= (count-words-region) in my _posts' dired buffer, this is the 53rd post.


This echoes to my very second post, easy helm improvement, which was about implementing a similar function for helm. So here it is:

(require 'delsel)
(defun ido-backspace ()
  "Forward to `backward-delete-char'.
On error (read-only), quit without selecting."
  (condition-case nil
      (backward-delete-char 1)
(define-key ido-common-completion-map (kbd "DEL") 'ido-backspace)

With this setup, when e.g. calling ido-switch-buffer, you can cancel with DEL. This, of course, will also work for smex and some other packages that allow for ido completion:

(setq magit-completing-read-function #'magit-ido-completing-read)
(setq lispy-completion-method 'ido)

Note that the define-key part of the code takes an advantage of a recent patch to ido that's available in the trunk. You can find the old way of binding keys for ido in an earlier post, tilde in ido-find-file. That post actually played a small role in speeding up the patch, for which we should thank @tarsius.

Note that this behavior will not affect ido-find-file, since it has its own map.