[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master fd2e8a7: Use a separate function to document defined patte
From: |
Michael Heerdegen |
Subject: |
[elpa] master fd2e8a7: Use a separate function to document defined pattern types |
Date: |
Mon, 2 Oct 2017 12:05:46 -0400 (EDT) |
branch: master
commit fd2e8a7cdffa788dcf43bee6e14f47ea2d17384d
Author: Michael Heerdegen <address@hidden>
Commit: Michael Heerdegen <address@hidden>
Use a separate function to document defined pattern types
---
packages/el-search/el-search.el | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/packages/el-search/el-search.el b/packages/el-search/el-search.el
index ed7aae9..7625b8c 100644
--- a/packages/el-search/el-search.el
+++ b/packages/el-search/el-search.el
@@ -682,12 +682,20 @@ not be inside a string or comment."
Keys are pattern names (i.e. symbols) and values the associated
expander functions.")
+(defun el-search-defined-patterns ()
+ "Return a list of defined el-search patterns."
+ (mapcar #'car el-search--pcase-macros))
+
+(put 'el-search-defined-patterns 'function-documentation
+ '(el-search--make-docstring 'el-search-defined-patterns))
+
(defun el-search--make-docstring (name)
;; Code mainly from `pcase--make-docstring'
(let* ((main (documentation (symbol-function name) 'raw))
(ud (help-split-fundoc main name)))
(with-temp-buffer
- (insert (or (cdr ud) main))
+ (insert (or (cdr ud) main)
+ "\n\nThe following additional pattern types are currently
defined:")
(mapc
(pcase-lambda (`(,symbol . ,fun))
(unless (string-match-p "\\`[-_]\\|--" (symbol-name symbol)) ;Let's
consider these "internal"
@@ -1925,8 +1933,9 @@ details.
PATTERN is an \"el-search\" pattern - which means, either a
`pcase' pattern or complying with one of the additional pattern
-types defined with `el-search-defpattern'. The following
-additional pattern types are currently defined:"
+types defined with `el-search-defpattern'.
+
+See `el-search-defined-patterns' for a list of defined patterns."
(declare (interactive-only el-search-forward))
(interactive (el-search-pattern--interactive))
(cond
@@ -1949,8 +1958,6 @@ additional pattern types are currently defined:"
(lambda (search) (setf (alist-get 'is-single-buffer
(el-search-object-properties search)) t))
'from-here))))
-(put 'el-search-pattern 'function-documentation '(el-search--make-docstring
'el-search-pattern))
-
(defun el-search-from-beginning (&optional restart-search)
"Go to the first of this buffer's matches.
With prefix arg, restart the current search."
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] master fd2e8a7: Use a separate function to document defined pattern types,
Michael Heerdegen <=