emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/dash c38b06f 291/316: Port some recent manual changes t


From: ELPA Syncer
Subject: [elpa] externals/dash c38b06f 291/316: Port some recent manual changes to README
Date: Mon, 15 Feb 2021 15:58:19 -0500 (EST)

branch: externals/dash
commit c38b06fe24af520000ddf50d7838a47c02224433
Author: Basil L. Contovounesios <contovob@tcd.ie>
Commit: Basil L. Contovounesios <contovob@tcd.ie>

    Port some recent manual changes to README
    
    * dev/examples-to-docs.el (dash--replace-all): New function.
    (create-docs-file): Don't modify functions for more idempotency.
    Simplify with dash--replace-all and relative file names.
    (simplify-quotes, goto-and-remove, goto-and-replace-all): Remove; no
    longer used.
---
 dev/examples-to-docs.el | 59 ++++++++++++-------------------------------------
 1 file changed, 14 insertions(+), 45 deletions(-)

diff --git a/dev/examples-to-docs.el b/dev/examples-to-docs.el
index 345abd4..430b46f 100644
--- a/dev/examples-to-docs.el
+++ b/dev/examples-to-docs.el
@@ -170,54 +170,23 @@ Based on `describe-function-1'."
           (signature (cadr function)))
       (format "* [%s](#%s) `%s`" command-name (github-id command-name 
signature) signature))))
 
-(defun simplify-quotes ()
+(defun dash--replace-all (old new)
+  "Replace occurrences of OLD with NEW in current buffer."
   (goto-char (point-min))
-  (while (re-search-forward (rx (or "'nil" "(quote nil)")) nil t)
-    (replace-match "'()" t t))
-  (goto-char (point-min))
-  (while (search-forward "(quote " nil t)
-    (forward-char -7)
-    (let ((p (point)))
-      (forward-sexp 1)
-      (delete-char -1)
-      (goto-char p)
-      (delete-char 7)
-      (insert "'")))
-  (goto-char (point-min))
-  (while (search-forward "(function " nil t)
-    (forward-char -10)
-    (let ((p (point)))
-      (forward-sexp 1)
-      (delete-char -1)
-      (goto-char p)
-      (delete-char 10)
-      (insert "#'"))))
-
-(defun goto-and-remove (s)
-  (goto-char (point-min))
-  (search-forward s)
-  (delete-char (- (length s))))
-
-(defun goto-and-replace-all (s replacement)
-  (while (progn (goto-char (point-min)) (search-forward s nil t))
-    (delete-char (- (length s)))
-    (insert replacement)))
+  (while (search-forward old nil t)
+    (replace-match new t t)))
 
 (defun create-docs-file ()
-  (let ((functions (nreverse functions)))
-    (with-temp-file "./README.md"
-      (insert-file-contents "./readme-template.md")
-
-      (goto-and-remove "[[ function-list ]]")
-      (insert (mapconcat 'function-summary functions "\n"))
-
-      (goto-and-remove "[[ function-docs ]]")
-      (insert (mapconcat 'function-to-md functions "\n"))
-
+  (let ((functions (reverse functions)))
+    (with-temp-file "README.md"
+      (insert-file-contents "readme-template.md")
       (dolist (pkg '(dash dash-functional))
-        (goto-and-replace-all (format "[[ %s-version ]]" pkg)
-                              (lm-version (format "%s.el" pkg))))
-
-      (simplify-quotes))))
+        (dash--replace-all (format "[[ %s-version ]]" pkg)
+                           (lm-version (format "%s.el" pkg))))
+      (dash--replace-all "[[ function-list ]]"
+                         (mapconcat #'function-summary functions "\n"))
+      (dash--replace-all "[[ function-docs ]]"
+                         (mapconcat #'function-to-md functions "\n"))
+      (dash--replace-all "'nil" "'()"))))
 
 ;;; examples-to-docs.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]