11

Suppose that I have this function, that inserts some stuff into the minibuffer:

(defun foobar ()
  (interactive)
  (minibuffer-with-setup-hook
      (lambda ()
        (let ((resize-mini-windows t))
          (save-excursion
            (insert "foo\nbar")
            (fit-window-to-buffer))))
    (read-from-minibuffer "string: ")))
(global-set-key (kbd "M-RET") 'foobar)

It works fine if I call it from any buffer, except when I'm already in the minibuffer.

For example, if I eval (read-from-minibuffer "test: "), and then press M-RET, my minibuffer becomes string: foo (note the 1 line height). After I press any character, I see that bar is also in the minibuffer. The problem is that the minibuffer height won't update until I press any character.

Why does this happen and how to get around it?

9
  • Your example in the question behaves fine (I can see both foo and bar). But I know that issue you are talking about and I have seen that frequently with ido, since last 2 or so weeks. But the issue doesn't repeat after the first few times you enter something in the minibuffer to increase its height. I am looking forward to the cause for this. I am using emacs built from master branch in git. Commented May 11, 2015 at 18:48
  • What version of emacs are you using? I'm using 24.4.1 (from Debian unstable) and it works OK for me. When I go M-x foobar, I see string: foo[newline]bar.
    – edam
    Commented Jun 24, 2015 at 8:08
  • I tried 24.5 and 25.
    – abo-abo
    Commented Jun 24, 2015 at 8:22
  • You're right, it's a regression. It still works fine on 24.3.1, but is broken on 24.5
    – abo-abo
    Commented Jun 24, 2015 at 8:26
  • It sounds like the consensus is that this is bug in 24.5. Someone please report it (M-x report-emacs-bug). And then post that as an answer (and OP please then accept that answer).
    – Drew
    Commented Dec 4, 2015 at 17:48

0

Your Answer

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

Browse other questions tagged or ask your own question.