help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to speed up ido-use-filename-at-point 'guess on large directories


From: Tomas Volf
Subject: How to speed up ido-use-filename-at-point 'guess on large directories
Date: Fri, 27 Oct 2023 22:58:17 +0200

Hello,

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>)()
      ido-ignore-item-p("gi4q3azbf5akkn2lwzqwk7w9zbb23xps-pyfuse3-3.2.1.tar..." 
("\\`CVS/" "\\`#" "\\`.#" "\\`\\.\\./" "\\`\\./") t)
      #f(compiled-function (name) #<bytecode 
-0x1fcf4865f9f8d5f0>)("gi4q3azbf5akkn2lwzqwk7w9zbb23xps-pyfuse3-3.2.1.tar...")
      ido-make-file-list-1("/gnu/store/")
      ido-make-file-list(nil)
      ido-read-internal(file "Find file: " ido-file-history nil 
confirm-after-completion "a1252v3fav1fabl1qmbzyjl936prabir-foo")
      ido-file-internal(raise-frame)
      ido-find-file()
      funcall-interactively(ido-find-file)
      command-execute(ido-find-file)

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?

Thank you and have a nice day,
Tomas Volf

-- 
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]