mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 21:13:04 +00:00
Remove last use of flet
It is obsolete as of 24.3, and this particular use of flet in this place isn't much use anyway. * doc/yas-doc-helper.el (yas--document-symbol): Stop using flet. Fixes #752
This commit is contained in:
parent
8412d71e44
commit
c485d13995
@ -40,66 +40,58 @@
|
|||||||
tag content tag))
|
tag content tag))
|
||||||
|
|
||||||
(defun yas--document-symbol (symbol level)
|
(defun yas--document-symbol (symbol level)
|
||||||
(flet ((concat-lines (&rest lines)
|
(let* ((stars (make-string level ?*))
|
||||||
(mapconcat #'identity lines "\n")))
|
(args (and (fboundp symbol)
|
||||||
(let* ((stars (make-string level ?*))
|
(mapcar #'symbol-name (help-function-arglist symbol t))))
|
||||||
(args (and (fboundp symbol)
|
(heading (cond ((fboundp symbol)
|
||||||
(mapcar #'symbol-name (help-function-arglist symbol t))))
|
(format
|
||||||
(heading (cond ((fboundp symbol)
|
"%s =%s= (%s)" stars symbol
|
||||||
(format
|
(mapconcat (lambda (a)
|
||||||
"%s =%s= (%s)" stars symbol
|
(format (if (string-prefix-p "&" a)
|
||||||
(mapconcat (lambda (a)
|
"/%s/" "=%s=") a))
|
||||||
(format (if (string-prefix-p "&" a)
|
args " ")))
|
||||||
"/%s/" "=%s=") a))
|
(t
|
||||||
args " ")))
|
(format "%s =%s=\n" stars symbol))))
|
||||||
(t
|
(after-heading (format ":PROPERTIES:\n:CUSTOM_ID: %s\n:END:" symbol))
|
||||||
(format "%s =%s=\n" stars symbol))))
|
(body (or (cond ((fboundp symbol)
|
||||||
(after-heading
|
(let ((doc-synth (car-safe (get symbol 'function-documentation))))
|
||||||
(concat-lines ":PROPERTIES:"
|
(if (functionp doc-synth)
|
||||||
(format ":CUSTOM_ID: %s" symbol)
|
(funcall doc-synth nil)
|
||||||
":END:"))
|
(documentation symbol t))))
|
||||||
(body (or (cond ((fboundp symbol)
|
((boundp symbol)
|
||||||
(let ((doc-synth (car-safe (get symbol 'function-documentation))))
|
(documentation-property symbol 'variable-documentation t))
|
||||||
(if (functionp doc-synth)
|
(t
|
||||||
(funcall doc-synth nil)
|
(format "*WARNING*: no symbol named =%s=" symbol)))
|
||||||
(documentation symbol t))))
|
(format "*WARNING*: no doc for symbol =%s=" symbol)))
|
||||||
((boundp symbol)
|
(case-fold-search nil))
|
||||||
(documentation-property symbol 'variable-documentation t))
|
;; do some transformations on the body:
|
||||||
(t
|
;; ARGxxx becomes @<code>arg@</code>xxx
|
||||||
(format "*WARNING*: no symbol named =%s=" symbol)))
|
;; FOO becomes /foo/
|
||||||
(format "*WARNING*: no doc for symbol =%s=" symbol)))
|
;; `bar' becomes [[#bar][=bar=]]
|
||||||
(case-fold-search nil))
|
(setq body (replace-regexp-in-string
|
||||||
;; do some transformations on the body:
|
"\\<\\([A-Z][-A-Z0-9]+\\)\\(\\sw+\\)?\\>"
|
||||||
;; ARGxxx becomes @<code>arg@</code>xxx
|
#'(lambda (match)
|
||||||
;; FOO becomes /foo/
|
(let* ((match1 (match-string 1 match))
|
||||||
;; `bar' becomes [[#bar][=bar=]]
|
(prefix (downcase match1))
|
||||||
(setq body (replace-regexp-in-string
|
(suffix (match-string 2 match))
|
||||||
"\\<\\([A-Z][-A-Z0-9]+\\)\\(\\sw+\\)?\\>"
|
(fmt (cond
|
||||||
#'(lambda (match)
|
((member prefix args)
|
||||||
(let* ((match1 (match-string 1 match))
|
(yas--org-raw-html "code" "%s"))
|
||||||
(prefix (downcase match1))
|
((null suffix) "/%s/"))))
|
||||||
(suffix (match-string 2 match))
|
(if fmt (format fmt prefix)
|
||||||
(fmt (cond
|
match1)))
|
||||||
((member prefix args)
|
body t t 1)
|
||||||
(yas--org-raw-html "code" "%s"))
|
body (replace-regexp-in-string
|
||||||
((null suffix) "/%s/"))))
|
"`\\([a-z-]+\\)'"
|
||||||
(if fmt (format fmt prefix)
|
#'(lambda (match)
|
||||||
match1)))
|
(let* ((name (downcase (match-string 1 match)))
|
||||||
body t t 1)
|
(sym (intern name)))
|
||||||
body (replace-regexp-in-string
|
(if (memq sym yas--exported-syms)
|
||||||
"`\\([a-z-]+\\)'"
|
(format "[[#%s][=%s=]]" name name)
|
||||||
#'(lambda (match)
|
(format "=%s=" name))))
|
||||||
(let* ((name (downcase (match-string 1 match)))
|
body t))
|
||||||
(sym (intern name)))
|
;; output the paragraph
|
||||||
(if (memq sym yas--exported-syms)
|
(concat heading "\n" after-heading "\n" body)))
|
||||||
(format "[[#%s][=%s=]]" name name)
|
|
||||||
(format "=%s=" name))))
|
|
||||||
body t))
|
|
||||||
;; output the paragraph
|
|
||||||
;;
|
|
||||||
(concat-lines heading
|
|
||||||
after-heading
|
|
||||||
body))))
|
|
||||||
|
|
||||||
(defun yas--document-symbols (level &rest names-and-predicates)
|
(defun yas--document-symbols (level &rest names-and-predicates)
|
||||||
(let ((sym-lists (make-vector (length names-and-predicates) nil))
|
(let ((sym-lists (make-vector (length names-and-predicates) nil))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user