[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/dash 8c22267 3/3: Merge pull request #164 from phillord
From: |
Phillip Lord |
Subject: |
[elpa] externals/dash 8c22267 3/3: Merge pull request #164 from phillord/fix/compiler-and-check-copyright |
Date: |
Tue, 06 Oct 2015 08:18:50 +0000 |
branch: externals/dash
commit 8c22267566062312a58dec85848271e71b572b06
Merge: 0c5c694 cf70af3
Author: Magnar Sveen <address@hidden>
Commit: Magnar Sveen <address@hidden>
Merge pull request #164 from phillord/fix/compiler-and-check-copyright
Fix check_copyright; Silence compiler-warnings
---
.gitignore | 3 +++
dash.el | 31 ++++++++++++++-----------------
dev/examples-to-docs.el | 27 ++++++++++++++++++++++++++-
dev/examples-to-info.el | 27 ++++++++++++++++++++++++++-
dev/examples-to-tests.el | 26 +++++++++++++++++++++++++-
dev/examples.el | 23 ++++++++++++++++++++++-
6 files changed, 116 insertions(+), 21 deletions(-)
diff --git a/.gitignore b/.gitignore
index 900d012..4ec8ea2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,4 @@
/dash.elc
+/dash-functional.elc
+/dash-autoloads.el
+/dash-pkg.el
diff --git a/dash.el b/dash.el
index 81e12f9..7df2fb0 100644
--- a/dash.el
+++ b/dash.el
@@ -347,7 +347,7 @@ See also: `-map-when', `-replace-first'"
(defmacro --map-first (pred rep list)
"Anaphoric form of `-map-first'."
- `(-map-first (lambda (it) ,pred) (lambda (it) ,rep) ,list))
+ `(-map-first (lambda (it) ,pred) (lambda (it) (ignore it) ,rep) ,list))
(defun -map-last (pred rep list)
"Replace first item in LIST satisfying PRED with result of REP called on
this item.
@@ -357,7 +357,7 @@ See also: `-map-when', `-replace-last'"
(defmacro --map-last (pred rep list)
"Anaphoric form of `-map-last'."
- `(-map-last (lambda (it) ,pred) (lambda (it) ,rep) ,list))
+ `(-map-last (lambda (it) ,pred) (lambda (it) (ignore it) ,rep) ,list))
(defun -replace (old new list)
"Replace all OLD items in LIST with NEW.
@@ -828,8 +828,7 @@ This function can be thought of as a generalization of
"Private: Used by -partition-all-in-steps and -partition-in-steps."
(when (< step 1)
(error "Step must be a positive number, or you're looking at some juicy
infinite loops."))
- (let ((result nil)
- (len 0))
+ (let ((result nil))
(while list
(!cons (-take n list) result)
(setq list (-drop step list)))
@@ -1054,11 +1053,9 @@ element of LIST paired with the unmodified element of
LIST."
(defun dash--table-carry (lists restore-lists &optional re)
"Helper for `-table' and `-table-flat'.
-If a list overflows, carry to the right and reset the list.
-
-Return how many lists were re-seted."
- (while (and (not (car lists))
- (not (equal lists '(nil))))
+If a list overflows, carry to the right and reset the list."
+ (while (not (or (car lists)
+ (equal lists '(nil))))
(setcar lists (car restore-lists))
(pop (cadr lists))
(!cdr lists)
@@ -1081,6 +1078,7 @@ order. The dimension of the result is (length lists).
See also: `-table-flat'"
(let ((restore-lists (copy-sequence lists))
(last-list (last lists))
+ ;; FIXME: Why not just use (make-list (length lists) nil)?
(re (--map nil (number-sequence 1 (length lists)))))
(while (car last-list)
(let ((item (apply fn (-map 'car lists))))
@@ -1135,8 +1133,7 @@ element ELEM, in ascending order."
(defun -find-indices (pred list)
"Return the indices of all elements in LIST satisfying the
predicate PRED, in ascending order."
- (let ((i 0))
- (apply 'append (--map-indexed (when (funcall pred it) (list it-index))
list))))
+ (apply 'append (--map-indexed (when (funcall pred it) (list it-index))
list)))
(defmacro --find-indices (form list)
"Anaphoric version of `-find-indices'."
@@ -1765,6 +1762,12 @@ body."
(indent 1))
`(--if-let ,val (progn ,@body)))
+(defvar -compare-fn nil
+ "Tests for equality use this function or `equal' if this is nil.
+It should only be set using dynamic scope with a let, like:
+
+ (let ((-compare-fn #'=)) (-union numbers1 numbers2 numbers3)")
+
(defun -distinct (list)
"Return a new list with all duplicates removed.
The test for equality is done with `equal',
@@ -1808,12 +1811,6 @@ The test for equality is done with `equal',
or with `-compare-fn' if that's non-nil."
(--filter (not (-contains? list2 it)) list))
-(defvar -compare-fn nil
- "Tests for equality use this function or `equal' if this is nil.
-It should only be set using dynamic scope with a let, like:
-
- (let ((-compare-fn =)) (-union numbers1 numbers2 numbers3)")
-
(defun -contains? (list element)
"Return non-nil if LIST contains ELEMENT.
diff --git a/dev/examples-to-docs.el b/dev/examples-to-docs.el
index f40ce5b..46c66f5 100644
--- a/dev/examples-to-docs.el
+++ b/dev/examples-to-docs.el
@@ -1,3 +1,26 @@
+;;; examples-to-docs.el --- Extract dash.el's doc from examples.el
+
+;; Copyright (C) 2015 Free Software Foundation, Inc.
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; FIXME: Lots of duplication with examples-to-info.el.
+
+;;; Code:
+
(require 'dash)
(require 'dash-functional)
(require 'help-fns)
@@ -110,7 +133,7 @@ FUNCTION may reference an elisp function, alias, macro or a
subr."
(format "%S %S"
command-name signature)))))
(defun s-replace (old new s)
- "Replaces OLD with NEW in S."
+ "Replace OLD with NEW in S."
(replace-regexp-in-string (regexp-quote old) new s t t))
(defun function-summary (function)
@@ -151,3 +174,5 @@ FUNCTION may reference an elisp function, alias, macro or a
subr."
(insert (mapconcat 'function-to-md functions "\n"))
(simplify-quotes))))
+
+;;; examples-to-docs.el ends here
diff --git a/dev/examples-to-info.el b/dev/examples-to-info.el
index 1e6f4b2..534de11 100644
--- a/dev/examples-to-info.el
+++ b/dev/examples-to-info.el
@@ -1,3 +1,26 @@
+;;; examples-to-info.el --- Extract dash.el's Info from examples.el
+
+;; Copyright (C) 2015 Free Software Foundation, Inc.
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; FIXME: Lots of duplication with examples-to-docs.el.
+
+;;; Code:
+
(require 'dash)
(require 'dash-functional)
(require 'help-fns)
@@ -122,7 +145,7 @@ FUNCTION may reference an elisp function, alias, macro or a
subr."
(format "%S %S"
command-name signature)))))
(defun s-replace (old new s)
- "Replaces OLD with NEW in S."
+ "Replace OLD with NEW in S."
(replace-regexp-in-string (regexp-quote old) new s t t))
(defun function-summary (function)
@@ -176,3 +199,5 @@ FUNCTION may reference an elisp function, alias, macro or a
subr."
(insert (mapconcat 'function-to-info functions "\n"))
(simplify-quotes))))
+
+;;; examples-to-info.el ends here
diff --git a/dev/examples-to-tests.el b/dev/examples-to-tests.el
index 2447065..f2ecf52 100644
--- a/dev/examples-to-tests.el
+++ b/dev/examples-to-tests.el
@@ -1,3 +1,26 @@
+;;; examples-to-tests.el --- Extract dash.el's tests from examples.el
+
+;; Copyright (C) 2015 Free Software Foundation, Inc.
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; FIXME: Lots of duplication with examples-to-info.el.
+
+;;; Code:
+
(require 'ert)
(defun example-to-should (actual sym expected)
@@ -8,7 +31,7 @@
((eq sym '!!>)
`(should-error (eval ',actual) :type ',expected))
(t
- (error "invalid test case: %S" `(,actual ,sym ,expected)))))
+ (error "Invalid test case: %S" `(,actual ,sym ,expected)))))
(defmacro defexamples (cmd &rest examples)
@@ -23,3 +46,4 @@
(defun def-example-group (&rest _)) ; ignore
(provide 'examples-to-tests)
+;;; examples-to-tests.el ends here
diff --git a/dev/examples.el b/dev/examples.el
index bb36698..22ea314 100644
--- a/dev/examples.el
+++ b/dev/examples.el
@@ -1,8 +1,27 @@
-;; -*- lexical-binding: t -*-
+;;; examples.el --- Examples/tests for dash.el's API -*- lexical-binding: t
-*-
+
+;; Copyright (C) 2015 Free Software Foundation, Inc.
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
;; Only the first three examples per function are shown in the docs,
;; so make those good.
+;;; Code:
+
(require 'dash)
(defun even? (num) (= 0 (% num 2)))
@@ -1100,3 +1119,5 @@ new list."
;; Local Variables:
;; eval: (font-lock-add-keywords nil '(("defexamples\\|def-example-group\\| =>
\\| !!> \\| ~>" (0 'font-lock-keyword-face))
("(defexamples[[:blank:]]+\\(.*\\)" (1 'font-lock-function-name-face))))
;; End:
+
+;;; examples.el ends here