summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-12-21 13:29:45 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-12-21 13:29:45 -0700
commit47c6d198fd822195397ae971be3fdfc4b2d9ca9a (patch)
tree42ed5cb90cfc0b2224d36ff98d7b10398cc255bb
parentb6e13db2672d45fdc4e580e93f84c46c9c421a6c (diff)
parent6aa057d568b87209e69ffbc66a2396ad73a39d4e (diff)
Update upstream source from tag '2.23'
Update to upstream version '2.23' with Debian dir 00419081b0d735f60146ef2b74b44500059de00f
-rw-r--r--ChangeLog199
-rw-r--r--seq-25.el48
-rw-r--r--seq-pkg.el2
-rw-r--r--seq.el2
4 files changed, 38 insertions, 213 deletions
diff --git a/ChangeLog b/ChangeLog
deleted file mode 100644
index 43f0cfe..0000000
--- a/ChangeLog
+++ /dev/null
@@ -1,199 +0,0 @@
-2020-09-04 Stefan Kangas <stefankangas@gmail.com>
-
- ; Sync seq.el with Emacs master and bump version to 2.22
-
-2017-05-04 Nicolas Petton <nicolas@petton.fr>
-
- Update seq.el to 2.20
-
-2016-12-16 Nicolas Petton <nicolas@petton.fr>
-
- Backport the latest changes to seq.el from Emacs master
-
- * packages/seq/seq-24.el:
- * packages/seq/seq-25.el (seq-into): Do not convert the sequence if not
- needed.
- * packages/seq/tests/seq-tests.el: Add a regression test.
-
-2016-12-15 Nicolas Petton <nicolas@petton.fr>
-
- Backport seq-mapn fix from Emacs master
-
- * packages/seq/seq-24.el (seq-mapn):
- * packages/seq/seq-25.el (seq-mapn): Fix for circular lists.
- * packages/seq/tests/seq-tests.el: Add a regression test.
-
-2016-11-16 Nicolas Petton <nicolas@petton.fr>
-
- Do not use map.el in seq-tests.el
-
- * packages/seq/tests/seq-tests.el: Do not use map.el. map.el was
- introduced in Emacs 25.1, but seq.el is also available in GNU ELPA for
- Emacs 24.5.
-
-2016-10-25 Nicolas Petton <nicolas@petton.fr>
-
- Fix seq-random-elt docstring
-
- * packages/seq/seq-24.el:
- * packages/seq/seq-25.el (seq-random-elt): Fix the docstring.
-
-2016-10-25 Nicolas Petton <nicolas@petton.fr>
-
- Backport seq.el changes from Emacs master
-
- * packages/seq/seq-24.el:
- * packages/seq/seq-25.el (seq-random-elt): New function.
- * packages/seq/seq.el: Bump version to 2.19.
- * packages/seq/tests/seq-tests.el: Add tests for seq-random-elt.
-
-2016-09-02 Clément Pit--Claudel <clement.pitclaudel@live.com>
-
- ; Fix documentation of seq-subseq
-
-2016-08-28 Nicolas Petton <nicolas@petton.fr>
-
- * packages/seq/seq-24.el: Rename seq-p to seqp
-
-2016-06-12 Nicolas Petton <nicolas@petton.fr>
-
- Update seq.el to 2.16
-
- * packages/seq/seq-24.el:
- * packages/seq/seq-25.el: Better implementation of seq-drop for lists.
- * packages/seq/seq.el: Bump version number.
-
-2016-04-22 Stefan Monnier <monnier@iro.umontreal.ca>
-
- * seq-24.el (seq-concatenate,seq-into,seq--make-bindings): Use _
-
- rather than t as catch-all for pcase.
-
-2016-03-31 Nicolas Petton <nicolas@petton.fr>
-
- Update seq to version 2.15
-
- * packages/seq/seq-25.el: Require cl-lib.
- * packages/seq/seq.el: Bump version number.
-
-2016-03-29 Nicolas Petton <nicolas@petton.fr>
-
- Update seq.el to version 2.14
-
- * packages/seq/seq.el: Bump version number.
- * packages/seq/seq-24.el (seq-sort-by): New function.
- * packages/seq/seq-25.el (seq-sort-by): New function.
- * packages/seq/tests/seq-tests.el: Add a test for seq-sort-by.
-
-2016-03-25 Nicolas Petton <nicolas@petton.fr>
-
- * packages/seq/seq-25.el: Better declarations for seq--when-emacs-25-p
-
-2016-03-25 Nicolas Petton <nicolas@petton.fr>
-
- Split seq.el into separate files for different versions of Emacs
-
- All functions in seq-25.el are wrapped in a `seq--when-emacs-25-p' to
- make sure that the byte compiler won't emit warnings or errors when the
- file is byte compiled in Emacs < 25.
-
- * packages/seq/seq-24.el:
- * packages/seq/seq-25.el: New files.
- * packages/seq/seq.el: Load seq-VERSION.el based on the version of
- Emacs.
- * packages/seq/test/seq.el-test.el: Backport a test from seq.el in Emacs
- master.
-
-2015-11-30 Stefan Monnier <monnier@iro.umontreal.ca>
-
- * packages/seq: Don't define it as a :core package
-
- Revert the removal of packages/seq/seq.el since it's different from the
- one in lisp/emacs-lisp.
- * .gitignore: Remove packages/seq.
- * externals-list: Remove "seq" entry.
-
-2015-11-29 Stefan Monnier <monnier@iro.umontreal.ca>
-
- * externals-list: Add seq and python as :core packages
-
- * .gitignore: Add packages/{seq,python}.
- * packages/seq: Remove.
-
-2015-10-20 Nicolas Petton <nicolas@petton.fr>
-
- Update seq.el to version 1.11
-
- * packages/seq/seq.el:
- * packages/seq/tests/seq-tests.el: Update.
-
-2015-09-18 Nicolas Petton <nicolas@petton.fr>
-
- Update seq.el to version 1.9
-
- * packages/seq/seq.el: Update to version 1.9.
- * packages/seq/tests/seq-tests.el: Update to version 1.9.
-
-2015-07-09 Nicolas Petton <nicolas@petton.fr>
-
- Update seq.el to version 1.8
-
- * packages/seq/seq.el: Update to version 1.8.
- * packages/seq/tests/seq-tests.el: Update to version 1.8.
-
-2015-05-15 Nicolas Petton <nicolas@petton.fr>
-
- Update seq.el to version 1.7
-
- * packages/seq/seq.el: Update to version 1.7.
- * packages/seq/tests/seq-tests.el: Update to version 1.7.
-
-2015-04-27 Nicolas Petton <nicolas@petton.fr>
-
- * packages/seq/seq.el: Update seq.el to version 1.5.
-
-2015-04-15 Nicolas Petton <nicolas@petton.fr>
-
- seq.el update
-
- * packages/seq/seq.el: Update seq.el to version 1.4
- * packages/seq/tests/seq-tests.el: Update seq.el to version 1.4
-
-2015-03-25 Nicolas Petton <nicolas@petton.fr>
-
- Rephrases a comment in seq.el about the order of the arguments
-
- * packages/seq/seq.el: Better comment about the order of the arguments
-
-2015-03-09 Nicolas Petton <nicolas@petton.fr>
-
- Update seq.el to version 1.3
-
- * packages/seq/seq.el: update to version 1.3
- * packages/seq/tests/seq-tests.el: update to version 1.3
-
-2015-02-11 Nicolas Petton <nicolas@petton.fr>
-
- Update seq.el to version 1.2
-
- * package/seq/seq.el: Update to version 1.2
- * packages/seq/tests/seq-tests.el: Update to version 1.2
-
-2015-02-09 Nicolas Petton <nicolas@petton.fr>
-
- Update seq.el to version 1.1.1
-
- * package/seq/seq.el: Update to version 1.1.1
- * packages/seq/tests/seq-tests.el: Update to version 1.1.1
-
-2015-02-06 Nicolas Petton <nicolas@petton.fr>
-
- Update seq.el to version 1.1
-
- * packages/seq/seq.el: Update to version 1.1
- * packages/seq/tests/seq-tests.el: Update to version 1.1
-
-2015-01-14 Nicolas Petton <nicolas@petton.fr>
-
- packages/seq: New package
-
diff --git a/seq-25.el b/seq-25.el
index d3f8277..30379ca 100644
--- a/seq-25.el
+++ b/seq-25.el
@@ -1,6 +1,6 @@
;;; seq-25.el --- seq.el implementation for Emacs 25.x -*- lexical-binding: t -*-
-;; Copyright (C) 2014-2020 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2021 Free Software Foundation, Inc.
;; Author: Nicolas Petton <nicolas@petton.fr>
;; Keywords: sequences
@@ -60,7 +60,7 @@
(seq--when-emacs-25-p
- (eval-when-compile (require 'cl-generic))
+(eval-when-compile (require 'cl-generic))
;; We used to use some sequence functions from cl-lib, but this
;; dependency was swapped around so that it will be easier to make
@@ -97,6 +97,14 @@ name to be bound to the rest of SEQUENCE."
(declare (indent 2) (debug (sexp form body)))
`(pcase-let ((,(seq--make-pcase-patterns args) ,sequence))
,@body))
+
+(defmacro seq-setq (args sequence)
+ "Assign to the variables in ARGS the elements of SEQUENCE.
+
+ARGS can also include the `&rest' marker followed by a variable
+name to be bound to the rest of SEQUENCE."
+ (declare (debug (sexp form)))
+ `(pcase-setq ,(seq--make-pcase-patterns args) ,sequence))
;;; Basic seq functions that have to be implemented by new sequence types
@@ -138,9 +146,10 @@ Unlike `seq-map', FUNCTION takes two arguments: the element of
the sequence, and its index within the sequence."
(let ((index 0))
(seq-do (lambda (elt)
- (funcall function elt index)
- (setq index (1+ index)))
- sequence)))
+ (funcall function elt index)
+ (setq index (1+ index)))
+ sequence))
+ nil)
(cl-defgeneric seqp (object)
"Return non-nil if OBJECT is a sequence, nil otherwise."
@@ -318,7 +327,7 @@ list."
(_ (error "Not a sequence type name: %S" type))))
(cl-defgeneric seq-filter (pred sequence)
- "Return a list of all the elements for which (PRED element) is non-nil in SEQUENCE."
+ "Return a list of all elements for which (PRED element) is non-nil in SEQUENCE."
(let ((exclude (make-symbol "exclude")))
(delq exclude (seq-map (lambda (elt)
(if (funcall pred elt)
@@ -335,9 +344,11 @@ list."
"Reduce the function FUNCTION across SEQUENCE, starting with INITIAL-VALUE.
Return the result of calling FUNCTION with INITIAL-VALUE and the
-first element of SEQUENCE, then calling FUNCTION with that result and
-the second element of SEQUENCE, then with that result and the third
-element of SEQUENCE, etc.
+first element of SEQUENCE, then calling FUNCTION with that result
+and the second element of SEQUENCE, then with that result and the
+third element of SEQUENCE, etc. FUNCTION will be called with
+INITIAL-VALUE (and then the accumulated value) as the first
+argument, and the elements from SEQUENCE as the second argument.
If SEQUENCE is empty, return INITIAL-VALUE and FUNCTION is not called."
(if (seq-empty-p sequence)
@@ -386,10 +397,11 @@ found or not."
(setq count (+ 1 count))))
count))
+;; Can't use `with-suppressed-warnings' as that was added in 27.1.
(cl-defgeneric seq-contains (sequence elt &optional testfn)
- (declare (obsolete seq-contains-p "27.1"))
"Return the first element in SEQUENCE that is equal to ELT.
Equality is defined by TESTFN if non-nil or by `equal' if nil."
+ (declare (obsolete seq-contains-p "27.1"))
(seq-some (lambda (e)
(when (funcall (or testfn #'equal) elt e)
e))
@@ -405,7 +417,8 @@ Equality is defined by TESTFN if non-nil or by `equal' if nil."
nil))
(cl-defgeneric seq-set-equal-p (sequence1 sequence2 &optional testfn)
- "Return non-nil if SEQUENCE1 and SEQUENCE2 contain the same elements, regardless of order.
+ "Return non-nil if SEQUENCE1 and SEQUENCE2 contain the same elements.
+This does not depend on the order of the elements.
Equality is defined by TESTFN if non-nil or by `equal' if nil."
(and (seq-every-p (lambda (item1) (seq-contains-p sequence2 item1 testfn)) sequence1)
(seq-every-p (lambda (item2) (seq-contains-p sequence1 item2 testfn)) sequence2)))
@@ -437,7 +450,7 @@ The result is a sequence of type TYPE, or a list if TYPE is nil."
(seq-map function sequence)))
(cl-defgeneric seq-partition (sequence n)
- "Return a list of the elements of SEQUENCE grouped into sub-sequences of length N.
+ "Return list of elements of SEQUENCE grouped into sub-sequences of length N.
The last sequence may contain less than N elements. If N is a
negative integer or 0, nil is returned."
(unless (< n 1)
@@ -447,6 +460,17 @@ negative integer or 0, nil is returned."
(setq sequence (seq-drop sequence n)))
(nreverse result))))
+(cl-defgeneric seq-union (sequence1 sequence2 &optional testfn)
+ "Return a list of all elements that appear in either SEQUENCE1 or SEQUENCE2.
+Equality is defined by TESTFN if non-nil or by `equal' if nil."
+ (let* ((accum (lambda (acc elt)
+ (if (seq-contains-p acc elt testfn)
+ acc
+ (cons elt acc))))
+ (result (seq-reduce accum sequence2
+ (seq-reduce accum sequence1 '()))))
+ (nreverse result)))
+
(cl-defgeneric seq-intersection (sequence1 sequence2 &optional testfn)
"Return a list of the elements that appear in both SEQUENCE1 and SEQUENCE2.
Equality is defined by TESTFN if non-nil or by `equal' if nil."
diff --git a/seq-pkg.el b/seq-pkg.el
index 8a0cffb..2904c8a 100644
--- a/seq-pkg.el
+++ b/seq-pkg.el
@@ -1,2 +1,2 @@
;; Generated package description from seq.el -*- no-byte-compile: t -*-
-(define-package "seq" "2.22" "Sequence manipulation functions" 'nil :url "http://elpa.gnu.org/packages/seq.html" :keywords '("sequences") :authors '(("Nicolas Petton" . "nicolas@petton.fr")) :maintainer '(nil . "emacs-devel@gnu.org"))
+(define-package "seq" "2.23" "Sequence manipulation functions" 'nil :url "https://elpa.gnu.org/packages/seq.html" :authors '(("Nicolas Petton" . "nicolas@petton.fr")) :maintainer '(nil . "emacs-devel@gnu.org") :keywords '("sequences"))
diff --git a/seq.el b/seq.el
index d02e25a..41db04b 100644
--- a/seq.el
+++ b/seq.el
@@ -4,7 +4,7 @@
;; Author: Nicolas Petton <nicolas@petton.fr>
;; Keywords: sequences
-;; Version: 2.22
+;; Version: 2.23
;; Package: seq
;; Maintainer: emacs-devel@gnu.org