3

I have discovered that a recent update to some of my emacs packages have caused C-x C-f while on a dired file to perform some operation on the entire file before prompting me for other files/directories.

I know that I need to track down what is causing this issue, but in the meantime, is there a way I can tell dired to ignore the current file-at-point when invoking C-x C-f in a dired buffer?

I frequently invoke this in a dired buffer containing videos around 500mb-1gb, and even with (setq debug-on-quit t) I cannot interrupt the process after hitting C-x C-f, emacs simply spins at 100% cpu for a few minutes until the ido prompt comes up.

10
  • Clarify, please: to what command is C-x C-f bound?
    – Dan
    Commented Dec 12, 2014 at 15:52
  • @Dan C-x C-f is bound to find-file
    – Lee H
    Commented Dec 12, 2014 at 15:55
  • 1
    If debug-on-quit doesn't work, the next thing to try is kill -USR2 <emacspid>. That should hopefully give you a backtrace.
    – Stefan
    Commented Dec 12, 2014 at 16:46
  • 1
    I don't know what is causing this, but I was just able to confirm the issue with a 3.15gb ISO file. In my case this was on Win7 on a network share (mapped drive). C-x C-f bound to ido-find-file and ido-use-filename-at-point as t. Changing it to nil removed the delay. Commented Dec 12, 2014 at 16:49
  • 1
    @JonathanLeech-Pepin Interesting, so I guess file size is a factor after all. In that case my answer below might be helpful. Another thing to play with might be ido-max-directory-size, which can disable ido completion in large directories.
    – glucas
    Commented Dec 12, 2014 at 16:52

1 Answer 1

5

If you are using ido-find-file and have configured ido to use the filename at point (e.g. you have ido-use-filename-at-point set to t or 'guess), you can prevent ido from using the name at point from a dired buffer with a hook:

(defun my/ido-ignore-file-at-point ()
  "Disable ido-use-filename-at-point for the current buffer."
  (when (bound-and-true-p ido-use-filename-at-point)
    (setq-local ido-use-filename-at-point nil)))

(add-hook 'dired-mode-hook #'my/ido-ignore-file-at-point)))

If you never want ido to use the name at point, set ido-use-filename-at-point to nil. I believe that is the default behavior though, so you may have customized it at some point.

If you experience issues with ido completion in large directories you may also want to customize ido-max-directory-size.

0

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.