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

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

[elpa] externals/dash 3b08355 113/316: Use version from dash.el file whe


From: ELPA Syncer
Subject: [elpa] externals/dash 3b08355 113/316: Use version from dash.el file when generating readme.
Date: Mon, 15 Feb 2021 15:57:38 -0500 (EST)

branch: externals/dash
commit 3b08355b94949a8e3a39d5949cf993922a447ac2
Author: Matus Goljer <matus.goljer@gmail.com>
Commit: Matus Goljer <matus.goljer@gmail.com>

    Use version from dash.el file when generating readme.
---
 dev/examples-to-docs.el | 13 +++++++++++++
 readme-template.md      |  4 ++--
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/dev/examples-to-docs.el b/dev/examples-to-docs.el
index e5ab510..bc1f65f 100644
--- a/dev/examples-to-docs.el
+++ b/dev/examples-to-docs.el
@@ -24,11 +24,17 @@
 (require 'dash)
 (require 'dash-functional)
 (require 'help-fns)
+(require 'package)
 
 (setq text-quoting-style 'grave)
 
 (defvar functions '())
 
+(defun dash-get-package-version ()
+  "Get version of dash package."
+  (with-current-buffer (find-file-noselect "dash.el")
+    (mapconcat 'number-to-string (package-desc-version (package-buffer-info)) 
version-separator)))
+
 (defun example-to-string (example)
   (-let* (((actual sym expected) example)
       (comment
@@ -164,6 +170,11 @@ FUNCTION may reference an elisp function, alias, macro or 
a subr."
   (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)))
+
 (defun create-docs-file ()
   (let ((functions (nreverse functions)))
     (with-temp-file "./README.md"
@@ -175,6 +186,8 @@ FUNCTION may reference an elisp function, alias, macro or a 
subr."
       (goto-and-remove "[[ function-docs ]]")
       (insert (mapconcat 'function-to-md functions "\n"))
 
+      (goto-and-replace-all "[[ version ]]" (dash-get-package-version))
+
       (simplify-quotes))))
 
 ;;; examples-to-docs.el ends here
diff --git a/readme-template.md b/readme-template.md
index 333b5c2..9643a46 100644
--- a/readme-template.md
+++ b/readme-template.md
@@ -19,11 +19,11 @@ If you want the function combinators, then also:
 
 Add this to the big comment block at the top:
 
-    ;; Package-Requires: ((dash "2.14.1"))
+    ;; Package-Requires: ((dash "[[ version ]]"))
 
 To get function combinators:
 
-    ;; Package-Requires: ((dash "2.14.1") (dash-functional "1.2.0") (emacs 
"24"))
+    ;; Package-Requires: ((dash "[[ version ]]") (dash-functional "1.2.0") 
(emacs "24"))
 
 ## Upcoming breaking change!
 



reply via email to

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