From 47114ca4622c3d8235be1a0fa958797fea0223db Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" Date: Sat, 30 Jan 2021 21:22:53 +0000 Subject: [PATCH] Make manual generation more consistent with README * dev/examples-to-info.el (format-docstring): Remove unneeded with-output-to-string. (create-info-file): * dash-template.texi (Top, Functions): Rename function-nodes to function-list. --- dash-template.texi | 4 ++-- dev/examples-to-info.el | 50 ++++++++++++++++++++--------------------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/dash-template.texi b/dash-template.texi index 3b498cc..ae33650 100644 --- a/dash-template.texi +++ b/dash-template.texi @@ -68,7 +68,7 @@ Installation Functions -@c [[ function-nodes ]] +@c [[ function-list ]] Development @@ -205,7 +205,7 @@ example, which demonstrates the utility of both versions. @end lisp @menu -@c [[ function-nodes ]] +@c [[ function-list ]] @end menu @c [[ function-docs ]] diff --git a/dev/examples-to-info.el b/dev/examples-to-info.el index 74da4e0..4ff86fc 100644 --- a/dev/examples-to-info.el +++ b/dev/examples-to-info.el @@ -86,30 +86,30 @@ Based on `describe-function-1'." (defun format-docstring (docstring) (let ((case-fold-search nil)) - (with-output-to-string - (with-current-buffer standard-output - (insert docstring) - ;; Escape literal ?@. - (dash--replace-all "@" "@@") - (goto-char (point-min)) - (while (re-search-forward - (rx (| (group bow (in "A-Z") (* (in "A-Z" ?-)) (* num) eow) - (: ?` (group (+ (not (in ?\s)))) ?\') - (: "..." (? (group eol))))) - nil t) - (cond ((match-beginning 1) - ;; Downcase metavariable reference. - (downcase-region (match-beginning 1) (match-end 1)) - (replace-match "@var{\\1}" t)) - ((match-beginning 2) - ;; `quoted' symbol. - (replace-match (if (assq (intern (match-string 2)) functions) - "@code{\\2} (@pxref{\\2})" - "@code{\\2}") - t)) - ;; Ellipses. - ((match-beginning 3) (replace-match "@enddots{}" t t)) - ((replace-match "@dots{}" t t)))))))) + (with-temp-buffer + (insert docstring) + ;; Escape literal ?@. + (dash--replace-all "@" "@@") + (goto-char (point-min)) + (while (re-search-forward + (rx (| (group bow (in "A-Z") (* (in "A-Z" ?-)) (* num) eow) + (: ?` (group (+ (not (in ?\s)))) ?\') + (: "..." (? (group eol))))) + nil t) + (cond ((match-beginning 1) + ;; Downcase metavariable reference. + (downcase-region (match-beginning 1) (match-end 1)) + (replace-match "@var{\\1}" t)) + ((match-beginning 2) + ;; `quoted' symbol. + (replace-match (if (assq (intern (match-string 2)) functions) + "@code{\\2} (@pxref{\\2})" + "@code{\\2}") + t)) + ;; Ellipses. + ((match-beginning 3) (replace-match "@enddots{}" t t)) + ((replace-match "@dots{}" t t)))) + (buffer-string)))) (defun function-to-info (function) (pcase function @@ -145,7 +145,7 @@ Based on `describe-function-1'." (lm-version (format "%s.el" pkg)))) (dash--replace-all - "@c [[ function-nodes ]]" + "@c [[ function-list ]]" (mapconcat (lambda (s) (concat "* " s "::")) (-filter (lambda (s) (and (stringp s)