[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/dash ba80875 109/426: Nice indentation for --each, --ea
From: |
Phillip Lord |
Subject: |
[elpa] externals/dash ba80875 109/426: Nice indentation for --each, --each-while and --dotimes |
Date: |
Tue, 04 Aug 2015 19:37:02 +0000 |
branch: externals/dash
commit ba808759d5a29b7151900366afc7a988bcea6452
Author: Magnar Sveen <address@hidden>
Commit: Magnar Sveen <address@hidden>
Nice indentation for --each, --each-while and --dotimes
---
dash.el | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/dash.el b/dash.el
index a3f6855..8eed84a 100644
--- a/dash.el
+++ b/dash.el
@@ -44,6 +44,8 @@
,@body)
(!cdr ,l)))))
+(put '--each 'lisp-indent-function 1)
+
(defun -each (list fn)
"Calls FN with every item in LIST. Returns nil, used for side-effects only."
(--each list (funcall fn it)))
@@ -59,6 +61,8 @@
(if (not ,pred) (setq ,c nil) ,@body))
(!cdr ,l)))))
+(put '--each-while 'lisp-indent-function 2)
+
(defun -each-while (list pred fn)
"Calls FN with every item in LIST while (PRED item) is non-nil.
Returns nil, used for side-effects only."
@@ -71,6 +75,8 @@ Returns nil, used for side-effects only."
,@body
(setq it (1+ it)))))
+(put '--dotimes 'lisp-indent-function 1)
+
(defun -dotimes (num fn)
"Repeatedly calls FN (presumably for side-effects) passing in integers from
0 through n-1."
(--dotimes num (funcall fn it)))
@@ -182,7 +188,8 @@ Thus function FN should return a collection."
"Anaphoric form of `-first'."
(let ((n (make-symbol "needle")))
`(let (,n)
- (--each-while ,list (not ,n) (when ,form (setq ,n it)))
+ (--each-while ,list (not ,n)
+ (when ,form (setq ,n it)))
,n)))
(defun -first (fn list)
@@ -247,9 +254,10 @@ Alias: `-every?'"
(defun -take (n list)
"Returns a new list of the first N items in LIST, or all items if there are
fewer than N."
(let (result)
- (--dotimes n (when list
- (!cons (car list) result)
- (!cdr list)))
+ (--dotimes n
+ (when list
+ (!cons (car list) result)
+ (!cdr list)))
(nreverse result)))
(defun -drop (n list)
- [elpa] externals/dash dc6f46c 098/426: Simplify docs-generation using dash., (continued)
- [elpa] externals/dash dc6f46c 098/426: Simplify docs-generation using dash., Phillip Lord, 2015/08/04
- [elpa] externals/dash b0da7b2 093/426: Declare macros before using them., Phillip Lord, 2015/08/04
- [elpa] externals/dash 4fedd2e 099/426: Add -partition and -partition-all, Phillip Lord, 2015/08/04
- [elpa] externals/dash 79b56cc 101/426: Use --each, !cons and !cdr to simplify implementations., Phillip Lord, 2015/08/04
- [elpa] externals/dash a08fc14 102/426: Add -each-while, Phillip Lord, 2015/08/04
- [elpa] externals/dash 49512b9 107/426: Simplify -take and -drop with --dotimes, Phillip Lord, 2015/08/04
- [elpa] externals/dash ed47814 105/426: Add -dotimes, Phillip Lord, 2015/08/04
- [elpa] externals/dash eb50d17 106/426: Add Melpa back in., Phillip Lord, 2015/08/04
- [elpa] externals/dash 0e5c69b 089/426: Docs: more concise example for anaphoric functions., Phillip Lord, 2015/08/04
- [elpa] externals/dash 03370ea 108/426: Simplify examples-to-docs and examples-to-tests with dash, Phillip Lord, 2015/08/04
- [elpa] externals/dash ba80875 109/426: Nice indentation for --each, --each-while and --dotimes,
Phillip Lord <=
- [elpa] externals/dash f1c8453 083/426: Rename to dash., Phillip Lord, 2015/08/04
- [elpa] externals/dash 51ddc13 110/426: Nice indentation for threading macros., Phillip Lord, 2015/08/04
- [elpa] externals/dash ba60707 103/426: Use --each-while to simplify implementations., Phillip Lord, 2015/08/04
- [elpa] externals/dash c56925a 111/426: Add font-lock for new functions and the `it` token., Phillip Lord, 2015/08/04
- [elpa] externals/dash a081c72 114/426: Fix tests., Phillip Lord, 2015/08/04
- [elpa] externals/dash a336d78 112/426: Add -only-some?, Phillip Lord, 2015/08/04
- [elpa] externals/dash 81a3247 104/426: Let -each and -each-while take multiple forms., Phillip Lord, 2015/08/04
- [elpa] externals/dash d857f73 118/426: Merge pull request #3 from rejeep/join-alias, Phillip Lord, 2015/08/04
- [elpa] externals/dash 9faa422 115/426: Add -partition-by, Phillip Lord, 2015/08/04
- [elpa] externals/dash f034c16 119/426: Add -union (thanks to @Fuco1), Phillip Lord, 2015/08/04