From a6a5c52cb08e37ec25a2672e6d538d743058cd71 Mon Sep 17 00:00:00 2001 From: Arash Esbati Date: Wed, 10 Apr 2024 23:05:39 +0200 Subject: [PATCH] Suppress bogus messages in the echo area * lisp/textmodes/reftex-dcr.el (reftex-view-crossref-when-idle): Check if point inside a mandatory argument where the cite/ref key usually resides. For example, with \cite[45]{emacs:30} and point on 4, the following bogus message in the echo area is suppressed: "cite: no such database entry: \cite[45]". (bug#38258) Fix docstring. (cherry picked from commit ca528f7c6ac9b907564298bc96663579d09f9434) --- lisp/textmodes/reftex-dcr.el | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lisp/textmodes/reftex-dcr.el b/lisp/textmodes/reftex-dcr.el index 2c5e5cb7ce6..c8ca054407c 100644 --- a/lisp/textmodes/reftex-dcr.el +++ b/lisp/textmodes/reftex-dcr.el @@ -241,9 +241,9 @@ With argument, actually select the window showing the cross reference." (reftex-view-crossref current-prefix-arg)) (defun reftex-view-crossref-when-idle () - ;; Display info about crossref at point in echo area or a window. - ;; This function was designed to work with an idle timer. - ;; We try to get out of here as quickly as possible if the call is useless. + "Display info about crossref at point in echo area or a window. +This function is designed to work with an idle timer and returns quickly +if the call is useless." (and reftex-mode ;; Make sure message area is free if we need it. (or (eq reftex-auto-view-crossref 'window) (not (current-message))) @@ -255,7 +255,15 @@ With argument, actually select the window showing the cross reference." (save-excursion (search-backward "\\" nil t) (looking-at "\\\\[a-zA-Z]*\\(cite\\|ref\\|bibentry\\)")) - + ;; Also check if point is inside a mandatory argument where the + ;; cite/ref key usually resides: (bug#38258) + (save-excursion + (condition-case nil + (let ((forward-sexp-function nil)) + (up-list -1) + (= (following-char) ?\{)) + (error nil))) + ;; Finally, call `reftex-view-crossref': (condition-case nil (let ((current-prefix-arg nil)) (cond -- 2.39.5