I ran into an issue of C-x C-f being very slow when guessing the filename at point if the file at point is located in a large directory (119765 entries).

My ido configuration:

(require 'ido)
(setq ido-enable-flex-matching t
      ido-enable-dot-prefix t
      ido-max-prospects 8
      ido-everywhere t
      ido-auto-merge-work-directories-length -1
      ido-create-new-buffer 'always
      ido-use-filename-at-point 'guess)
(ido-mode 1)

I did manage to find ido-big-directories variable, so I also added this:

(add-to-list 'ido-big-directories (rx "/gnu/store"))

That does seem to work, because trying to navigate into /gnu/store does tell me [Too big].

However when I have a point over a filename inside the /gnu/store, for example /gnu/store/a1252v3fav1fabl1qmbzyjl936prabir-foo, the ido-find-file takes a long time (many seconds) before showing the prompt (with the file at point filled in).

#emacs did advice me to use toggle-debug-on-quit, so I do have a backtrace:

    Debugger entered--Lisp error: (quit)
      #f(compiled-function () #<bytecode 0x1e3ca1a0816daf>)()
("\\`CVS/" "\\`#" "\\`.#" "\\`\\.\\./" "\\`\\./") t)
      #f(compiled-function (name) #<bytecode 
      ido-read-internal(file "Find file: " ido-file-history nil 
confirm-after-completion "a1252v3fav1fabl1qmbzyjl936prabir-foo")

It seems to be building a list of the files, I somewhat hoped the ido-big-directories would prevent that.

Would someone have any idea how to make this faster?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.