DarwinAwardWinner / ido-completing-read-plus

Fancy completion all over Emacs, not just for buffers and files.
GNU General Public License v3.0
241 stars 31 forks source link

Emacs bug #19412 might be fixable in ido-cr+ #166

Closed DarwinAwardWinner closed 4 years ago

DarwinAwardWinner commented 4 years ago

https://debbugs.gnu.org/cgi/bugreport.cgi?bug=19412

DarwinAwardWinner commented 4 years ago

After further investigation, this must be fixed by patching ido itself. It can't be fixed by advice, short of completely redefining a function from scratch.

DarwinAwardWinner commented 4 years ago

Buttercup tests:

(expect
 (with-simulated-input "C-f RET"
   (ido-read-file-name
    "Pick a file (default ~/temp/test.R): "
    "~/" "~/temp/test.R"))
 :to-equal "~/temp/test.R")

(expect
 (with-simulated-input "C-f RET"
   (ido-read-directory-name
    "Pick a file (default ~/temp/test.R): "
    "~/" "~/temp/"))
 :to-equal "~/temp/")

(expect
 (cl-letf*
     ;; Redefine `write-file' as a no-op stub with the same
     ;; interactive form that just returns its argument
     ((write-file-intform (interactive-form 'write-file))
      ((symbol-function 'write-file)
       `(lambda (filename &optional confirm) ,write-file-intform
          (message "Would have written file: %S" filename)
          filename)))
   (with-temp-buffer
     (setq default-directory "~/temp/"
           buffer-file-name "~/temp/test.R")
     (with-simulated-input "/ / t m p / C-f RET"
       (call-interactively 'ido-write-file))))
 :to-equal "/tmp/")