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 ()
(interactive)
(save-excursion
(let ((enable-recursive-minibuffers t))
(goto-char (point-min))
(while (search-forward-regexp "\\\\bibitem" nil t)
(save-excursion
(let* ((b (copy-marker (match-beginning 0)))
(e (copy-marker (progn
(search-forward-regexp
"\\(?:\\\\bibitem\\|\\\\end{thebibliography}\\)" nil t)
(match-beginning 0)))))
(save-restriction
(narrow-to-region b e)
(read-string
"Make any further manual corrections if necessary and press [ENTER]: "))))))))
(defun it-to-emph ()
(interactive)
(query-replace "{\\it " "\\emph{" nil (point-min) (point-max)))
And this is a LaTeX
code snippet:
\begin{thebibliography}{99}
\bibitem{Bombelli:1986rw}
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}.
\bibitem{Srednicki:1993im}
M.~Srednicki,
{\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}}].
\bibitem{Holzhey:1994we}
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}}].
\end{thebibliography}
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)
However, in Emacs 29.1
, messages are displayed alongside the read-string
prompt.
Emacs 29.1 (Look at the "Replaced 1 occurrence" message)
- Is there a way to restore the behavior of previous versions?
- Is
read-string
the wrong function to be used for this purpose?
Note. The same thing happens with the prompt of query-replace
.
set-message-functions
, maybe one of the functions there does what you want.set-message-function
variable tonil
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.set-message-function
orset-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 forset-message-functions
that means "restore emacs-26 behaviour").set-message-function
is just as much part of the contract, and thenil
behaviour is documented.