From dada2a8f8df5c5b939e388dbac97640755620715 Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Sun, 25 Feb 2024 12:25:58 +0100 Subject: [PATCH] ; Refine dictionary definition display in *Help* buffers * lisp/net/dictionary.el (dictionary-display-definition-in-help-buffer): Add one-line description and normalize whitespace in references. --- lisp/net/dictionary.el | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lisp/net/dictionary.el b/lisp/net/dictionary.el index 1981b757017..f207894ae14 100644 --- a/lisp/net/dictionary.el +++ b/lisp/net/dictionary.el @@ -1569,7 +1569,13 @@ Further arguments are currently ignored." (called-interactively-p 'interactive)) (with-help-window (help-buffer) (with-current-buffer (help-buffer) - (insert definition) + (insert "Definition of {" word "} in " + (cond + ((string= dictionary "*") "all dictionaries") + ((string= dictionary "!") "first matching dictionary") + (t (format "dictionary %s" dictionary))) + ":\n\n" + definition) ;; Buttonize references to other definitions. These appear as ;; words enclosed with curly braces. (goto-char (point-min)) @@ -1578,7 +1584,9 @@ Further arguments are currently ignored." "}") nil t) (help-xref-button 1 'help-word - (match-string 1) + ;; Normalize spaces in references. + (replace-regexp-in-string + (rx (+ (or space "\n"))) " " (match-string 1)) dictionary)))))) (defvar dictionary-color-support (display-color-p) -- 2.39.5