Search code examples
emacsido-mode

Paths with whitespaces in ido (find-file) (on MS Windows)


I am running GNU Emacs 23 on a Windows-machine and having problems getting ido-find-file to match files that contain whitespaces.

In my .emacs I (setq ido-use-filename-at-point t) and would like to match a string like "D:\Dokumente und Einstellungen\Username\Eigene Dateien\Scratch\ipswitch.bat" when hitting C-x C-f.

When point is located between " and D:\, IDO suggests d:/Dokumente[Dokumente und Einstellungen], i.e. the pattern "breaks" on the whitespaces.

I would like the whole string (maybe restricted to certain modes (like org-mode) if that is necessary) to be matched and suggested.

How could I get that working?


Solution

  • I have not found a solution for ffap/thingatpt, but for ido-mode the following code in init.el works wonders.

    I use Gnu Emacs on Windows with ido-mode, and have found joy in changing the minibuffer completion map:

    ;; EXPERIMENTAL: unbind SPACE and ? in minibuffer, to allow typing in completions with those chars
    (add-hook 'minibuffer-setup-hook (lambda () 
                                       (define-key minibuffer-local-completion-map " " nil)
                                       (define-key minibuffer-local-must-match-map " " nil)
                                       (define-key minibuffer-local-completion-map "?" nil)
                                       (define-key minibuffer-local-must-match-map "?" nil)))
    

    The comment warns it is "experimental" so I can reverse it in case I ever encounter strange behavior. But I have used this for over a year now with no problems.

    Now when I do C-x C-f C:/Doc

    ido-mode suggests C:/Documents and Settings/