]> git.eshelyaron.com Git - emacs.git/commitdiff
Suppress bogus messages in the echo area
authorArash Esbati <arash@gnu.org>
Wed, 10 Apr 2024 21:05:39 +0000 (23:05 +0200)
committerEshel Yaron <me@eshelyaron.com>
Sun, 14 Apr 2024 16:48:25 +0000 (18:48 +0200)
* 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

index 2c5e5cb7ce6889787694319dab3971080a61a5a3..c8ca054407c8a713fc5b521d220d7f0ea902c065 100644 (file)
@@ -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