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

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

bug#78746: 31.0.50; ido-confirm-unique-completion has no effect


From: Pip Cet
Subject: bug#78746: 31.0.50; ido-confirm-unique-completion has no effect
Date: Tue, 10 Jun 2025 14:58:16 +0000

This bug was found by searching the Emacs .el files for misleading
indentation automatically.  This code in ido.el:

     ((and (= 1 (length ido-matches))
           (not (and ido-enable-tramp-completion
                     (string-equal ido-current-directory "/")
                     (string-match ".[@:]\\'" (ido-name (car ido-matches)))))
                     (not (ido-local-file-exists-p (ido-name (car 
ido-matches)))))
      ;; only one choice, so select it.
      (if (not ido-confirm-unique-completion)
          (exit-minibuffer)
        (setq ido-rescan (not ido-enable-prefix))
        (delete-region (minibuffer-prompt-end) (point))
        (insert (ido-name (car ido-matches)))))

is indented correctly, but the parentheses are wrong.  It should be:

     ((and (= 1 (length ido-matches))
           (not (and ido-enable-tramp-completion
                     (string-equal ido-current-directory "/")
                     (string-match ".[@:]\\'" (ido-name (car ido-matches)))
                     (not (ido-local-file-exists-p (ido-name (car 
ido-matches)))))))
      ;; only one choice, so select it.
      (if (not ido-confirm-unique-completion)
          (exit-minibuffer)
        (setq ido-rescan (not ido-enable-prefix))
        (delete-region (minibuffer-prompt-end) (point))
        (insert (ido-name (car ido-matches)))))

This inverts the last condition and changes its priority: in effect,
when completing file names in an ido buffer, ido-complete would never
automatically select a single choice (unless that file was deleted
unexpectedly), even when customized to do so, as it was by default.

For buffers, however, ido-complete would complete the sole remaining
buffer name and exit the minibuffer by default, unless a file named like
the single matching buffer name existed in the current directory.

So our options are:

1. change just the code and make it behave as documented for files as
well as buffers
2. change the code and change the defcustom's default to t, retaining
current behavior for files but not buffers
3. allow the defcustom to specify only files or buffers, and make it
default to applying just to buffers, not files, retaining the current
behavior

I'd prefer the first option.






reply via email to

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