Subject: Re: bug#77063: 29.1; ido-read-buffer

From: Keith David Bershatsky <[email-masked]>
Date: Mon, 17 Mar 2025 08:16:31 -0700

Thank you, Eli, for looking into this particular bug report.  I just installed Emacs 30.1 on Debian 8.11 (Jessie) and was able to repeat the steps to reproduce the reported behavior.  Attached hereto are four (4) screenshots depicting both of the issues reported:

SCREENSHOT:  001__part_1_of_2__step_2.png

This screenshot depicts the minibuffer PROMPT _without_ any ido completion choices.

PROMPT:  [no ido choices]

In order to display ido completion choices following the PROMPT, it is necessary to first run (ido-common-initialization).  Once that is done, repeating Step 2 yields the expected result:

PROMPT:  {*scratch* | *Messages* | *GNU Emacs*}

SCREENSHOT:  002__part_2_of_2__step_4__select_messages_buffer.png

After pressing the tab key, navigate to the ido choices buffer and select the *Messages* buffer.

SCREENSHOT:  002__part_2_of_2__step_4__messages_buffer_selected.png

We have chosen the *Messages* buffer from the ido choices buffer, and inserted that choice into the minibuffer -- following the PROMPT:.

SCREENSHOT:  002__part_2_of_2__step_4__returns_scratch_buffer.png

We pressed the enter button to select the *Messages* buffer and exit the ido-read-buffer function.  The erroneous result returned is the *scratch* buffer.

One idea to fix the first issue is to add (ido-common-initialization) inside ido-read-buffer:

(defun ido-read-buffer (prompt &optional default require-match predicate)
  "..."
  (let* (...
         (buf (progn (ido-common-initialization)
                     (ido-read-internal 'buffer prompt 'ido-buffer-history default require-match))))
    ...

I do not have a solution for the second problem described in part 2 of 2.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

> Date: [03-17-2025 06:40:07] <17 Mar 2025 15:40:07 +0200>
> From: Eli Zaretskii <[email-masked]>
> To: Keith David Bershatsky <[email-masked]>
> Cc: [email-masked]
> Subject: Re: bug#77063: 29.1; ido-read-buffer
> 
> > Date: Sun, 16 Mar 2025 20:16:45 -0700
> > From: Keith David Bershatsky <[email-masked]>
> >
> > This is a two part bug report:
> >
> > PART 1 of 2:
> >
> > STEP 0:  Start-up Emacs 29 without any user configuration.
> >
> > STEP 1:  (require 'ido)
> >
> > STEP 2:  (ido-read-buffer "PROMPT:  " nil 'require-match nil)
> >
> > STEP 3:  Observe that there are no visible ido rotational buffer choices.
> >
> > STEP 4:  (ido-common-initialization)
> >
> > STEP 5:  Repeat STEP 2 and observe that it now works; i.e., there are now visible ido rotational buffer choices.
> >
> > ================
> >
> > PART 2 of 2
> >
> > STEP 0:  Start-up Emacs 29 without any user configuration.
> >
> > STEP 1:  (require 'ido)
> >
> > STEP 2:  (ido-read-buffer "PROMPT:  " nil 'require-match nil)
> >
> > STEP 3:  Press the TAB key to open the *Ido Completions* buffer.
> >
> > STEP 4:  Navigate to the *Ido Completions* buffer and select the *Messages* buffer, and press the enter key.
> >
> > STEP 5:  Now that the word *Messages* is in the minibuffer following the word PROMPT:, press the enter key.  The function erroneously returns the "*scratch*" buffer instead of the *Messages* buffer.
> 
> This appears to be fixed already in Emacs 30 and later.