[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/dash dc6f46c 098/439: Simplify docs-generation using da
From: |
Phillip Lord |
Subject: |
[elpa] externals/dash dc6f46c 098/439: Simplify docs-generation using dash. |
Date: |
Tue, 04 Aug 2015 20:26:51 +0000 |
branch: externals/dash
commit dc6f46cff33db7f08cd41b00279e6109f204ff27
Author: Magnar Sveen <address@hidden>
Commit: Magnar Sveen <address@hidden>
Simplify docs-generation using dash.
---
examples-to-docs.el | 34 +++++++++++-----------------------
1 files changed, 11 insertions(+), 23 deletions(-)
diff --git a/examples-to-docs.el b/examples-to-docs.el
index 63e7e22..3be657f 100644
--- a/examples-to-docs.el
+++ b/examples-to-docs.el
@@ -1,17 +1,15 @@
+(require 'dash)
+
(defvar functions '())
(defun example-to-string (example)
(let ((actual (car example))
(expected (cadr (cdr example))))
- (replace-regexp-in-string
- "\r" "\\r"
- (replace-regexp-in-string
- "\t" "\\t"
- (replace-regexp-in-string
- "\n" "\\n"
- (replace-regexp-in-string
- "\\\\\\?" "?"
- (format "%S ;; => %S" actual expected)) t t) t t) t t)))
+ (--> (format "%S ;; => %S" actual expected)
+ (replace-regexp-in-string "\\\\\\?" "?" it)
+ (replace-regexp-in-string "\n" "\\n" it t t)
+ (replace-regexp-in-string "\t" "\\t" it t t)
+ (replace-regexp-in-string "\r" "\\r" it t t))))
(defun examples-to-strings (examples)
(let (result)
@@ -42,9 +40,9 @@
(defun quote-docstring (docstring)
(let (case-fold-search)
- (setq docstring (replace-regexp-in-string "\\b\\([A-Z][A-Z-]*[0-9]*\\)\\b"
'quote-and-downcase docstring t))
- (setq docstring (replace-regexp-in-string "`\\([^ ]+\\)'" "`\\1`"
docstring t)))
- docstring)
+ (--> docstring
+ (replace-regexp-in-string "\\b\\([A-Z][A-Z-]*[0-9]*\\)\\b"
'quote-and-downcase it t)
+ (replace-regexp-in-string "`\\([^ ]+\\)'" "`\\1`" it t))))
(defun function-to-md (function)
(let ((command-name (car function))
@@ -55,7 +53,7 @@
command-name
signature
docstring
- (mapconcat 'identity (three-first examples) "\n"))))
+ (mapconcat 'identity (-take 3 examples) "\n"))))
(defun docs--chop-suffix (suffix s)
"Remove SUFFIX if it is at end of S."
@@ -106,13 +104,3 @@
(insert (mapconcat 'function-to-md functions "\n"))
(simplify-quotes))))
-
-(defun three-first (list)
- (let (first)
- (when (car list)
- (setq first (cons (car list) first))
- (when (cadr list)
- (setq first (cons (cadr list) first))
- (when (car (cddr list))
- (setq first (cons (car (cddr list)) first)))))
- (nreverse first)))
- [elpa] externals/dash 9ff9fd0 085/439: Move functions that are not strictly list related last., (continued)
- [elpa] externals/dash 9ff9fd0 085/439: Move functions that are not strictly list related last., Phillip Lord, 2015/08/04
- [elpa] externals/dash 38cc9e7 088/439: Simplify -interleave with -none?, Phillip Lord, 2015/08/04
- [elpa] externals/dash 4b5e24b 087/439: Docs: move -any? -all? -none? and -each up., Phillip Lord, 2015/08/04
- [elpa] externals/dash 0e5c69b 089/439: Docs: more concise example for anaphoric functions., Phillip Lord, 2015/08/04
- [elpa] externals/dash f8d74ff 091/439: Docs: update example text to match example code., Phillip Lord, 2015/08/04
- [elpa] externals/dash b0da7b2 093/439: Declare macros before using them., Phillip Lord, 2015/08/04
- [elpa] externals/dash 6931d8a 094/439: Remove Melpa from installation while waiting for it to be included., Phillip Lord, 2015/08/04
- [elpa] externals/dash 0c55a4b 090/439: 1.0.0, Phillip Lord, 2015/08/04
- [elpa] externals/dash 0bd26ac 096/439: Add aliases for -p instead of ?, Phillip Lord, 2015/08/04
- [elpa] externals/dash a2941cd 097/439: Typo, Phillip Lord, 2015/08/04
- [elpa] externals/dash dc6f46c 098/439: Simplify docs-generation using dash.,
Phillip Lord <=
- [elpa] externals/dash f1c8453 083/439: Rename to dash., Phillip Lord, 2015/08/04
- [elpa] externals/dash eacb6f2 092/439: Docs: Better generation of github urls., Phillip Lord, 2015/08/04
- [elpa] externals/dash 12ed9f6 100/439: Add destructive operations !cons og !cdr, Phillip Lord, 2015/08/04
- [elpa] externals/dash 79b56cc 101/439: Use --each, !cons and !cdr to simplify implementations., Phillip Lord, 2015/08/04
- [elpa] externals/dash 81a3247 104/439: Let -each and -each-while take multiple forms., Phillip Lord, 2015/08/04
- [elpa] externals/dash ba60707 103/439: Use --each-while to simplify implementations., Phillip Lord, 2015/08/04
- [elpa] externals/dash eb50d17 106/439: Add Melpa back in., Phillip Lord, 2015/08/04
- [elpa] externals/dash 4fedd2e 099/439: Add -partition and -partition-all, Phillip Lord, 2015/08/04
- [elpa] externals/dash 38eed45 095/439: Add rainbow-dash, Phillip Lord, 2015/08/04
- [elpa] externals/dash 49512b9 107/439: Simplify -take and -drop with --dotimes, Phillip Lord, 2015/08/04