summaryrefslogtreecommitdiff
path: root/lisp/help-fns.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2022-06-28 15:22:13 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2022-06-28 15:22:13 +0200
commitfb0d95984b522687eb10aebbc1b1cef7cca7c5ec (patch)
treed5dd53235250e0f9495c6d45bcc71e9c930381e3 /lisp/help-fns.el
parentc23a49d256771739d78eca1f371f69c46979d90c (diff)
downloademacs-fb0d95984b522687eb10aebbc1b1cef7cca7c5ec.tar.gz
Put the obsoletion earlier in the *Help* buffer
* lisp/help-fns.el (help-fns--obsolete): Remove indentation and fill. (help-fns--var-obsolete): Ditto. (describe-function-1): Output the obsoletion info first since it's vital information. (describe-variable): Ditto (bug#56251).
Diffstat (limited to 'lisp/help-fns.el')
-rw-r--r--lisp/help-fns.el37
1 files changed, 22 insertions, 15 deletions
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 364fce4ea64..705f92b37be 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -725,19 +725,22 @@ the C sources, too."
;; Ignore lambda constructs, keyboard macros, etc.
(let* ((obsolete (and (symbolp function)
(get function 'byte-obsolete-info)))
- (use (car obsolete)))
+ (use (car obsolete))
+ (start (point)))
(when obsolete
- (insert " This "
+ (insert "This "
(if (eq (car-safe (symbol-function function)) 'macro)
"macro"
"function")
" is obsolete")
(when (nth 2 obsolete)
(insert (format " since %s" (nth 2 obsolete))))
- (insert (cond ((stringp use) (concat ";\n " use))
- (use (format-message ";\n use `%s' instead." use))
+ (insert (cond ((stringp use) (concat "; " use))
+ (use (format-message "; use `%s' instead." use))
(t "."))
- "\n"))))
+ "\n")
+ (fill-region-as-paragraph start (point))
+ (ensure-empty-lines))))
(add-hook 'help-fns-describe-function-functions
#'help-fns--globalized-minor-mode)
@@ -1044,6 +1047,8 @@ Returns a list of the form (REAL-FUNCTION DEF ALIASED REAL-DEF)."
nil t)
(ensure-empty-lines))))
+ (help-fns--obsolete function)
+
(pcase-let* ((`(,real-function ,def ,_aliased ,real-def)
(help-fns--analyze-function function))
(doc-raw (condition-case nil
@@ -1082,7 +1087,6 @@ Returns a list of the form (REAL-FUNCTION DEF ALIASED REAL-DEF)."
(set-buffer-file-coding-system 'utf-8)))))
;; Add defaults to `help-fns-describe-function-functions'.
-(add-hook 'help-fns-describe-function-functions #'help-fns--obsolete)
(add-hook 'help-fns-describe-function-functions #'help-fns--interactive-only)
(add-hook 'help-fns-describe-function-functions #'help-fns--parent-mode)
(add-hook 'help-fns-describe-function-functions #'help-fns--compiler-macro 100)
@@ -1338,6 +1342,7 @@ it is displayed along with the global value."
alias 'variable-documentation))))
(with-current-buffer standard-output
+ (help-fns--var-obsolete variable)
(insert (or doc "Not documented as a variable.")))
;; Output the indented administrative bits.
@@ -1531,19 +1536,21 @@ variable.\n")))
(princ watchpoints)
(terpri))))
-(add-hook 'help-fns-describe-variable-functions #'help-fns--var-obsolete)
(defun help-fns--var-obsolete (variable)
(let* ((obsolete (get variable 'byte-obsolete-variable))
- (use (car obsolete)))
+ (use (car obsolete))
+ (start (point)))
(when obsolete
- (princ " This variable is obsolete")
+ (insert "This variable is obsolete")
(if (nth 2 obsolete)
- (princ (format " since %s" (nth 2 obsolete))))
- (princ (cond ((stringp use) (concat ";\n " use))
- (use (format-message ";\n use `%s' instead."
- (car obsolete)))
- (t ".")))
- (terpri))))
+ (insert (format " since %s" (nth 2 obsolete))))
+ (insert (cond ((stringp use) (concat "; " use))
+ (use (format-message "; use `%s' instead."
+ (car obsolete)))
+ (t "."))
+ "\n")
+ (fill-region-as-paragraph start (point))
+ (ensure-empty-lines))))
(add-hook 'help-fns-describe-variable-functions #'help-fns--var-alias)
(defun help-fns--var-alias (variable)