I recently upgraded to Emacs 29.1 from Emacs 26.3.

I primarily use Emacs as a LaTeX document editor. One of the things I do is use loops to select and isolate regions in the buffer for operations. In these loops, I use the read-string function to control the transition from one iteration to the next.

This is an example:

(defun my-function ()
    (let ((enable-recursive-minibuffers t))
      (goto-char (point-min))
      (while (search-forward-regexp "\\\\bibitem" nil t)
      (let* ((b (copy-marker (match-beginning 0)))
         (e (copy-marker (progn 
                    "\\(?:\\\\bibitem\\|\\\\end{thebibliography}\\)" nil t)
                   (match-beginning 0)))))

          (narrow-to-region b e)
           "Make any further manual corrections if necessary and press [ENTER]: "))))))))

(defun it-to-emph ()
  (query-replace "{\\it " "\\emph{" nil (point-min) (point-max)))

And this is a LaTeX code snippet:


L.~Bombelli, R.K.~Koul, J.~Lee and R.D.~Sorkin,
\emph{A Quantum Source of Entropy for Black Holes},
\href{https://doi.org/10.1103/PhysRevD.34.373}{\emph{Phys. Rev. D} {\bfseries 34} (1986) 373}.

{\it Entropy and area},
\href{https://doi.org/10.1103/PhysRevLett.71.666}{\emph{Phys. Rev. Lett.} {\bfseries 71} (1993) 666}
[\href{https://arxiv.org/abs/hep-th/9303048}{{\ttfamily hep-th/9303048}}].

C.~Holzhey, F.~Larsen and F.~Wilczek,
{\it Geometric and renormalized entropy in conformal field theory},
\href{https://doi.org/10.1016/0550-3213(94)90402-2}{\emph{Nucl. Phys. B} {\bfseries 424} (1994) 443}
[\href{https://arxiv.org/abs/hep-th/9403108}{{\ttfamily hep-th/9403108}}].


I have noticed that in previous versions of Emacs, any messages temporarily overlaid the read-string prompt in the minibuffer.

Emacs 26.3 (Look at the "Replaced 1 occurrence" message) enter image description here

However, in Emacs 29.1, messages are displayed alongside the read-string prompt.

Emacs 29.1 (Look at the "Replaced 1 occurrence" message)

enter image description here

  1. Is there a way to restore the behavior of previous versions?
  2. Is read-string the wrong function to be used for this purpose?

Note. The same thing happens with the prompt of query-replace.

  • I think this is deliberate, but I can't find the change responsible at the moment. Look into set-message-functions, maybe one of the functions there does what you want.
    – rpluim
    Commented Feb 8 at 10:55
  • There was a long discussion during 27.1 pretest which is related, but one comment in the thread (by @Drew) might be more closely relevant here, in view of the OP's second question: lists.gnu.org/archive/html/bug-gnu-emacs/2019-12/msg00460.html. But the whole thread is worth reading, just to get a feel for all the complications. Also, it's probably not the last word: given the disagreements that surfaced then, it's probably the case that more discussion and more work was done in this area during subsequent release cycles.
    – NickD
    Commented Feb 8 at 13:26
  • @rpluim let-binding the set-message-function variable to nil restores the previous behaviuor. But it's not clear to me why. Do you think I can consider it a solution? If you'd like, please post your comment as an answer so that I can accept it.
    – Gabriele
    Commented Feb 8 at 14:42
  • set-message-function or set-message-functions? The latter could be considered part of the contract, and the former is an implementation detail, so things might break in later releases (unless Emacs adds a specific function for set-message-functions that means "restore emacs-26 behaviour").
    – rpluim
    Commented Feb 8 at 15:07
  • Actually, I take that back: set-message-function is just as much part of the contract, and the nil behaviour is documented.
    – rpluim
    Commented Feb 8 at 15:10

1 Answer 1


emacs-27 introduced set-message-function to call set-message-functions, which by default appends the message to the prompt. To get back the emacs-26 behaviour, set or let-bind set-message-function to nil.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.