aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThien-Thi Nguyen2018-05-21 16:57:49 +0200
committerThien-Thi Nguyen2018-05-27 10:36:34 +0200
commite6de5b3d51558ef861df68bcda2c4e91afe2d9ef (patch)
tree95d535bddbde125d3b5aa19c4036fb134053558c
parent07f8f9bc5a51f5aa94eb099f3e15fbe0c20ea1ea (diff)
downloademacs-e6de5b3d51558ef861df68bcda2c4e91afe2d9ef.tar.gz
emacs-e6de5b3d51558ef861df68bcda2c4e91afe2d9ef.zip
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.
-rw-r--r--lisp/emacs-lisp/pcase.el33
1 files changed, 24 insertions, 9 deletions
diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el
index ce148c9e1a9..6e8f08e699a 100644
--- a/lisp/emacs-lisp/pcase.el
+++ b/lisp/emacs-lisp/pcase.el
@@ -199,15 +199,30 @@ Emacs Lisp manual for more information and examples."
199 (require 'help-fns) 199 (require 'help-fns)
200 (with-temp-buffer 200 (with-temp-buffer
201 (insert (or (cdr ud) main)) 201 (insert (or (cdr ud) main))
202 (mapatoms 202 ;; Presentation Note: For conceptual continuity, we guarantee
203 (lambda (symbol) 203 ;; that backquote doc immediately follows main pcase doc.
204 (let ((me (get symbol 'pcase-macroexpander))) 204 ;; (The order of the other extensions is unimportant.)
205 (when me 205 (let (more)
206 (insert "\n\n-- ") 206 ;; Collect all the extensions.
207 (let* ((doc (documentation me 'raw))) 207 (mapatoms (lambda (symbol)
208 (setq doc (help-fns--signature symbol doc me 208 (let ((me (get symbol 'pcase-macroexpander)))
209 (indirect-function me) nil)) 209 (when me
210 (insert "\n" (or doc "Not documented."))))))) 210 (push (cons symbol me)
211 more)))))
212 ;; Ensure backquote is first.
213 (let ((x (assq '\` more)))
214 (setq more (cons x (delq x more))))
215 ;; Do the output.
216 (while more
217 (let* ((pair (pop more))
218 (symbol (car pair))
219 (me (cdr pair))
220 (doc (documentation me 'raw)))
221 (insert "\n\n-- ")
222 (setq doc (help-fns--signature symbol doc me
223 (indirect-function me)
224 nil))
225 (insert "\n" (or doc "Not documented.")))))
211 (let ((combined-doc (buffer-string))) 226 (let ((combined-doc (buffer-string)))
212 (if ud (help-add-fundoc-usage combined-doc (car ud)) combined-doc))))) 227 (if ud (help-add-fundoc-usage combined-doc (car ud)) combined-doc)))))
213 228