branch: master commit c485d13995b6c569ae680b8f155026e85ca7933c Author: Noam Postavsky <npost...@users.sourceforge.net> Commit: Noam Postavsky <npost...@users.sourceforge.net>
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 --- doc/yas-doc-helper.el | 112 +++++++++++++++++++++++--------------------------- 1 file changed, 52 insertions(+), 60 deletions(-) diff --git a/doc/yas-doc-helper.el b/doc/yas-doc-helper.el index 8459eb7..ffce751 100644 --- a/doc/yas-doc-helper.el +++ b/doc/yas-doc-helper.el @@ -40,66 +40,58 @@ tag content tag)) (defun yas--document-symbol (symbol level) - (flet ((concat-lines (&rest lines) - (mapconcat #'identity lines "\n"))) - (let* ((stars (make-string level ?*)) - (args (and (fboundp symbol) - (mapcar #'symbol-name (help-function-arglist symbol t)))) - (heading (cond ((fboundp symbol) - (format - "%s =%s= (%s)" stars symbol - (mapconcat (lambda (a) - (format (if (string-prefix-p "&" a) - "/%s/" "=%s=") a)) - args " "))) - (t - (format "%s =%s=\n" stars symbol)))) - (after-heading - (concat-lines ":PROPERTIES:" - (format ":CUSTOM_ID: %s" symbol) - ":END:")) - (body (or (cond ((fboundp symbol) - (let ((doc-synth (car-safe (get symbol 'function-documentation)))) - (if (functionp doc-synth) - (funcall doc-synth nil) - (documentation symbol t)))) - ((boundp symbol) - (documentation-property symbol 'variable-documentation t)) - (t - (format "*WARNING*: no symbol named =%s=" symbol))) - (format "*WARNING*: no doc for symbol =%s=" symbol))) - (case-fold-search nil)) - ;; do some transformations on the body: - ;; ARGxxx becomes @<code>arg@</code>xxx - ;; FOO becomes /foo/ - ;; `bar' becomes [[#bar][=bar=]] - (setq body (replace-regexp-in-string - "\\<\\([A-Z][-A-Z0-9]+\\)\\(\\sw+\\)?\\>" - #'(lambda (match) - (let* ((match1 (match-string 1 match)) - (prefix (downcase match1)) - (suffix (match-string 2 match)) - (fmt (cond - ((member prefix args) - (yas--org-raw-html "code" "%s")) - ((null suffix) "/%s/")))) - (if fmt (format fmt prefix) - match1))) - body t t 1) - body (replace-regexp-in-string - "`\\([a-z-]+\\)'" - #'(lambda (match) - (let* ((name (downcase (match-string 1 match))) - (sym (intern name))) - (if (memq sym yas--exported-syms) - (format "[[#%s][=%s=]]" name name) - (format "=%s=" name)))) - body t)) - ;; output the paragraph - ;; - (concat-lines heading - after-heading - body)))) + (let* ((stars (make-string level ?*)) + (args (and (fboundp symbol) + (mapcar #'symbol-name (help-function-arglist symbol t)))) + (heading (cond ((fboundp symbol) + (format + "%s =%s= (%s)" stars symbol + (mapconcat (lambda (a) + (format (if (string-prefix-p "&" a) + "/%s/" "=%s=") a)) + args " "))) + (t + (format "%s =%s=\n" stars symbol)))) + (after-heading (format ":PROPERTIES:\n:CUSTOM_ID: %s\n:END:" symbol)) + (body (or (cond ((fboundp symbol) + (let ((doc-synth (car-safe (get symbol 'function-documentation)))) + (if (functionp doc-synth) + (funcall doc-synth nil) + (documentation symbol t)))) + ((boundp symbol) + (documentation-property symbol 'variable-documentation t)) + (t + (format "*WARNING*: no symbol named =%s=" symbol))) + (format "*WARNING*: no doc for symbol =%s=" symbol))) + (case-fold-search nil)) + ;; do some transformations on the body: + ;; ARGxxx becomes @<code>arg@</code>xxx + ;; FOO becomes /foo/ + ;; `bar' becomes [[#bar][=bar=]] + (setq body (replace-regexp-in-string + "\\<\\([A-Z][-A-Z0-9]+\\)\\(\\sw+\\)?\\>" + #'(lambda (match) + (let* ((match1 (match-string 1 match)) + (prefix (downcase match1)) + (suffix (match-string 2 match)) + (fmt (cond + ((member prefix args) + (yas--org-raw-html "code" "%s")) + ((null suffix) "/%s/")))) + (if fmt (format fmt prefix) + match1))) + body t t 1) + body (replace-regexp-in-string + "`\\([a-z-]+\\)'" + #'(lambda (match) + (let* ((name (downcase (match-string 1 match))) + (sym (intern name))) + (if (memq sym yas--exported-syms) + (format "[[#%s][=%s=]]" name name) + (format "=%s=" name)))) + body t)) + ;; output the paragraph + (concat heading "\n" after-heading "\n" body))) (defun yas--document-symbols (level &rest names-and-predicates) (let ((sym-lists (make-vector (length names-and-predicates) nil))