comparison .elisp/settings/50.localfuncs.el @ 180:cd4e645d1207

emacs localfuncs: add advice for ido to avoid blocking in flex matching
author Augie Fackler <durin42@gmail.com>
date Wed, 13 Jan 2010 10:29:36 -0600
parents 36a4e4b0f9c3
children e77c01b7b0f4
comparison
equal deleted inserted replaced
179:ebbbf3567a0e 180:cd4e645d1207
1 ;; advice to prevent ido from using flex matches on huge lists of files
2 ;; with enough characters typed and blocking for an absurd amount of time
3 ;; after a stupid typo
4 ;; The value af-ido-flex-fuzzy-limit is the maximum value of the product
5 ;; of the number of characters the user has entered and the number of
6 ;; options in the ido list.
7 ;; The default value was determined experimentally and seemed to be
8 ;; the boundary of sane wait times when this was written.
9 (defvar af-ido-flex-fuzzy-limit (* 2000 5))
10 (defadvice ido-set-matches-1 (around my-ido-set-matches-1 activate)
11 "Conditionally disable flex matching if the list is huge.
12
13 This is useful because when the ido list is huge, ido flex matching
14 spends an eternity in a regex if you make a typo."
15 (let ((ido-enable-flex-matching (< (* (length (ad-get-arg 0)) (length ido-text))
16 af-ido-flex-fuzzy-limit)))
17 ad-do-it))
18
19 ;; Generic repository differ. Requires textmate.el and mercurial.el.
1 (defun af-generic-diff-repo () 20 (defun af-generic-diff-repo ()
2 (interactive) 21 (interactive)
3 (let ((root (textmate-project-root))) 22 (let ((root (textmate-project-root)))
4 (cd root) 23 (cd root)
5 (hg-view-output 24 (hg-view-output