Ensure pcase doc shows `QPAT first among extensions
* lisp/emacs-lisp/pcase.el (pcase--make-docstring): Split extensions display into two phases, collection and display, separated by a reordering step that ensures backquote is the first.
This commit is contained in:
parent
07f8f9bc5a
commit
e6de5b3d51
1 changed files with 24 additions and 9 deletions
|
@ -199,15 +199,30 @@ Emacs Lisp manual for more information and examples."
|
||||||
(require 'help-fns)
|
(require 'help-fns)
|
||||||
(with-temp-buffer
|
(with-temp-buffer
|
||||||
(insert (or (cdr ud) main))
|
(insert (or (cdr ud) main))
|
||||||
(mapatoms
|
;; Presentation Note: For conceptual continuity, we guarantee
|
||||||
(lambda (symbol)
|
;; that backquote doc immediately follows main pcase doc.
|
||||||
|
;; (The order of the other extensions is unimportant.)
|
||||||
|
(let (more)
|
||||||
|
;; Collect all the extensions.
|
||||||
|
(mapatoms (lambda (symbol)
|
||||||
(let ((me (get symbol 'pcase-macroexpander)))
|
(let ((me (get symbol 'pcase-macroexpander)))
|
||||||
(when me
|
(when me
|
||||||
|
(push (cons symbol me)
|
||||||
|
more)))))
|
||||||
|
;; Ensure backquote is first.
|
||||||
|
(let ((x (assq '\` more)))
|
||||||
|
(setq more (cons x (delq x more))))
|
||||||
|
;; Do the output.
|
||||||
|
(while more
|
||||||
|
(let* ((pair (pop more))
|
||||||
|
(symbol (car pair))
|
||||||
|
(me (cdr pair))
|
||||||
|
(doc (documentation me 'raw)))
|
||||||
(insert "\n\n-- ")
|
(insert "\n\n-- ")
|
||||||
(let* ((doc (documentation me 'raw)))
|
|
||||||
(setq doc (help-fns--signature symbol doc me
|
(setq doc (help-fns--signature symbol doc me
|
||||||
(indirect-function me) nil))
|
(indirect-function me)
|
||||||
(insert "\n" (or doc "Not documented.")))))))
|
nil))
|
||||||
|
(insert "\n" (or doc "Not documented.")))))
|
||||||
(let ((combined-doc (buffer-string)))
|
(let ((combined-doc (buffer-string)))
|
||||||
(if ud (help-add-fundoc-usage combined-doc (car ud)) combined-doc)))))
|
(if ud (help-add-fundoc-usage combined-doc (car ud)) combined-doc)))))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue