summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-12-21 13:29:44 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-12-21 13:29:44 -0700
commit6aa057d568b87209e69ffbc66a2396ad73a39d4e (patch)
tree339cb835aaff624b145ae722487cf4bbe95ae0d5
parentff8d10f3d2534ab7c91af3d7ede7353d65d0f3a1 (diff)
New upstream version 2.23
-rw-r--r--ChangeLog195
-rw-r--r--seq-24.el4
-rw-r--r--seq-25.el225
-rw-r--r--seq-pkg.el4
-rw-r--r--seq.el6
5 files changed, 167 insertions, 267 deletions
diff --git a/ChangeLog b/ChangeLog
deleted file mode 100644
index 07f4988..0000000
--- a/ChangeLog
+++ /dev/null
@@ -1,195 +0,0 @@
-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-24.el b/seq-24.el
index d7ea729..3ca0964 100644
--- a/seq-24.el
+++ b/seq-24.el
@@ -1,6 +1,6 @@
;;; seq-24.el --- seq.el implementation for Emacs 24.x -*- lexical-binding: t -*-
-;; Copyright (C) 2014-2016 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2020 Free Software Foundation, Inc.
;; Author: Nicolas Petton <nicolas@petton.fr>
;; Keywords: sequences
@@ -20,7 +20,7 @@
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
+;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
diff --git a/seq-25.el b/seq-25.el
index d26bde6..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-2016 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2021 Free Software Foundation, Inc.
;; Author: Nicolas Petton <nicolas@petton.fr>
;; Keywords: sequences
@@ -20,7 +20,7 @@
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
+;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
@@ -60,8 +60,11 @@
(seq--when-emacs-25-p
-(require 'cl-generic)
-(require 'cl-lib) ;; for cl-subseq
+(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
+;; seq.el preloaded in the future. See also Bug#39761#26.
(defmacro seq-doseq (spec &rest body)
"Loop over a sequence.
@@ -94,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
@@ -114,6 +125,14 @@ name to be bound to the rest of SEQUENCE."
"Return the number of elements of SEQUENCE."
(length sequence))
+(defun seq-first (sequence)
+ "Return the first element of SEQUENCE."
+ (seq-elt sequence 0))
+
+(defun seq-rest (sequence)
+ "Return a sequence of the elements of SEQUENCE except the first one."
+ (seq-drop sequence 1))
+
(cl-defgeneric seq-do (function sequence)
"Apply FUNCTION to each element of SEQUENCE, presumably for side effects.
Return SEQUENCE."
@@ -121,9 +140,20 @@ Return SEQUENCE."
(defalias 'seq-each #'seq-do)
-(cl-defgeneric seqp (sequence)
- "Return non-nil if SEQUENCE is a sequence, nil otherwise."
- (sequencep sequence))
+(defun seq-do-indexed (function sequence)
+ "Apply FUNCTION to each element of SEQUENCE and return nil.
+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))
+ nil)
+
+(cl-defgeneric seqp (object)
+ "Return non-nil if OBJECT is a sequence, nil otherwise."
+ (sequencep object))
(cl-defgeneric seq-copy (sequence)
"Return a shallow copy of SEQUENCE."
@@ -137,7 +167,27 @@ If END is omitted, it defaults to the length of the sequence. If
START or END is negative, it counts from the end. Signal an
error if START or END are outside of the sequence (i.e too large
if positive or too small if negative)."
- (cl-subseq sequence start end))
+ (cond
+ ((or (stringp sequence) (vectorp sequence)) (substring sequence start end))
+ ((listp sequence)
+ (let (len
+ (errtext (format "Bad bounding indices: %s, %s" start end)))
+ (and end (< end 0) (setq end (+ end (setq len (length sequence)))))
+ (if (< start 0) (setq start (+ start (or len (setq len (length sequence))))))
+ (unless (>= start 0)
+ (error "%s" errtext))
+ (when (> start 0)
+ (setq sequence (nthcdr (1- start) sequence))
+ (or sequence (error "%s" errtext))
+ (setq sequence (cdr sequence)))
+ (if end
+ (let ((res nil))
+ (while (and (>= (setq end (1- end)) start) sequence)
+ (push (pop sequence) res))
+ (or (= (1+ end) start) (error "%s" errtext))
+ (nreverse res))
+ (copy-sequence sequence))))
+ (t (error "Unsupported sequence: %s" sequence))))
(cl-defgeneric seq-map (function sequence)
@@ -159,6 +209,7 @@ the sequence, and its index within the sequence."
(setq index (1+ index))))
sequence)))
+
;; faster implementation for sequences (sequencep)
(cl-defmethod seq-map (function (sequence sequence))
(mapcar function sequence))
@@ -219,6 +270,9 @@ The result is a sequence of the same type as SEQUENCE."
(let ((result (seq-sort pred (append sequence nil))))
(seq-into result (type-of sequence))))
+(cl-defmethod seq-sort (pred (list list))
+ (sort (seq-copy list) pred))
+
(defun seq-sort-by (function pred sequence)
"Sort SEQUENCE using PRED as a comparison function.
Elements of SEQUENCE are transformed by FUNCTION before being
@@ -229,9 +283,6 @@ sorted. FUNCTION must be a function of one argument."
(funcall function b)))
sequence))
-(cl-defmethod seq-sort (pred (list list))
- (sort (seq-copy list) pred))
-
(cl-defgeneric seq-reverse (sequence)
"Return a sequence with elements of SEQUENCE in reverse order."
(let ((result '()))
@@ -249,7 +300,11 @@ sorted. FUNCTION must be a function of one argument."
TYPE must be one of following symbols: vector, string or list.
\n(fn TYPE SEQUENCE...)"
- (apply #'cl-concatenate type (seq-map #'seq-into-sequence sequences)))
+ (pcase type
+ ('vector (apply #'vconcat sequences))
+ ('string (apply #'concat sequences))
+ ('list (apply #'append (append sequences '(nil))))
+ (_ (error "Not a sequence type name: %S" type))))
(cl-defgeneric seq-into-sequence (sequence)
"Convert SEQUENCE into a sequence.
@@ -272,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)
@@ -289,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)
@@ -310,7 +367,8 @@ If SEQUENCE is empty, return INITIAL-VALUE and FUNCTION is not called."
t))
(cl-defgeneric seq-some (pred sequence)
- "Return the first value for which if (PRED element) is non-nil for in SEQUENCE."
+ "Return non-nil if PRED is satisfied for at least one element of SEQUENCE.
+If so, return the first non-nil value returned by PRED."
(catch 'seq--break
(seq-doseq (elt sequence)
(let ((result (funcall pred elt)))
@@ -339,18 +397,31 @@ 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)
"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)
- (funcall (or testfn #'equal) elt e))
+ (when (funcall (or testfn #'equal) elt e)
+ e))
sequence))
+(cl-defgeneric seq-contains-p (sequence elt &optional testfn)
+ "Return non-nil if SEQUENCE contains an element equal to ELT.
+Equality is defined by TESTFN if non-nil or by `equal' if nil."
+ (catch 'seq--break
+ (seq-doseq (e sequence)
+ (when (funcall (or testfn #'equal) e elt)
+ (throw 'seq--break t)))
+ 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 sequence2 item1 testfn)) sequence1)
- (seq-every-p (lambda (item2) (seq-contains sequence1 item2 testfn)) sequence2)))
+ (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)))
(cl-defgeneric seq-position (sequence elt &optional testfn)
"Return the index of the first element in SEQUENCE that is equal to ELT.
@@ -368,7 +439,7 @@ Equality is defined by TESTFN if non-nil or by `equal' if nil."
TESTFN is used to compare elements, or `equal' if TESTFN is nil."
(let ((result '()))
(seq-doseq (elt sequence)
- (unless (seq-contains result elt testfn)
+ (unless (seq-contains-p result elt testfn)
(setq result (cons elt result))))
(nreverse result)))
@@ -379,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)
@@ -389,11 +460,22 @@ 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."
(seq-reduce (lambda (acc elt)
- (if (seq-contains sequence2 elt testfn)
+ (if (seq-contains-p sequence2 elt testfn)
(cons elt acc)
acc))
(seq-reverse sequence1)
@@ -403,9 +485,9 @@ Equality is defined by TESTFN if non-nil or by `equal' if nil."
"Return a list of the elements that appear in SEQUENCE1 but not in SEQUENCE2.
Equality is defined by TESTFN if non-nil or by `equal' if nil."
(seq-reduce (lambda (acc elt)
- (if (not (seq-contains sequence2 elt testfn))
- (cons elt acc)
- acc))
+ (if (seq-contains-p sequence2 elt testfn)
+ acc
+ (cons elt acc)))
(seq-reverse sequence1)
'()))
@@ -443,6 +525,47 @@ SEQUENCE must be a sequence of numbers or markers."
(setq n (+ 1 n)))
n))
+(defun seq--make-pcase-bindings (args)
+ "Return a list of bindings of the variables in ARGS to the elements of a sequence."
+ (let ((bindings '())
+ (index 0)
+ (rest-marker nil))
+ (seq-doseq (name args)
+ (unless rest-marker
+ (pcase name
+ (`&rest
+ (progn (push `(app (pcase--flip seq-drop ,index)
+ ,(seq--elt-safe args (1+ index)))
+ bindings)
+ (setq rest-marker t)))
+ (_
+ (push `(app (pcase--flip seq--elt-safe ,index) ,name) bindings))))
+ (setq index (1+ index)))
+ bindings))
+
+(defun seq--make-pcase-patterns (args)
+ "Return a list of `(seq ...)' pcase patterns from the argument list ARGS."
+ (cons 'seq
+ (seq-map (lambda (elt)
+ (if (seqp elt)
+ (seq--make-pcase-patterns elt)
+ elt))
+ args)))
+
+;; TODO: make public?
+(defun seq--elt-safe (sequence n)
+ "Return element of SEQUENCE at the index N.
+If no element is found, return nil."
+ (ignore-errors (seq-elt sequence n)))
+
+(cl-defgeneric seq-random-elt (sequence)
+ "Return a random element from SEQUENCE.
+Signal an error if SEQUENCE is empty."
+ (if (seq-empty-p sequence)
+ (error "Sequence cannot be empty")
+ (seq-elt sequence (random (seq-length sequence)))))
+
+
;;; Optimized implementations for lists
(cl-defmethod seq-drop ((list list) n)
@@ -466,8 +589,8 @@ SEQUENCE must be a sequence of numbers or markers."
(cl-defmethod seq-empty-p ((list list))
"Optimized implementation of `seq-empty-p' for lists."
(null list))
-
+
(defun seq--into-list (sequence)
"Concatenate the elements of SEQUENCE into a list."
(if (listp sequence)
@@ -486,45 +609,17 @@ SEQUENCE must be a sequence of numbers or markers."
sequence
(concat sequence)))
-(defun seq--make-pcase-bindings (args)
- "Return a list of bindings of the variables in ARGS to the elements of a sequence."
- (let ((bindings '())
- (index 0)
- (rest-marker nil))
- (seq-doseq (name args)
- (unless rest-marker
- (pcase name
- (`&rest
- (progn (push `(app (pcase--flip seq-drop ,index)
- ,(seq--elt-safe args (1+ index)))
- bindings)
- (setq rest-marker t)))
- (_
- (push `(app (pcase--flip seq--elt-safe ,index) ,name) bindings))))
- (setq index (1+ index)))
- bindings))
-
-(defun seq--make-pcase-patterns (args)
- "Return a list of `(seq ...)' pcase patterns from the argument list ARGS."
- (cons 'seq
- (seq-map (lambda (elt)
- (if (seqp elt)
- (seq--make-pcase-patterns elt)
- elt))
- args)))
+(defun seq--activate-font-lock-keywords ()
+ "Activate font-lock keywords for some symbols defined in seq."
+ (font-lock-add-keywords 'emacs-lisp-mode
+ '("\\<seq-doseq\\>" "\\<seq-let\\>")))
-;; TODO: make public?
-(defun seq--elt-safe (sequence n)
- "Return element of SEQUENCE at the index N.
-If no element is found, return nil."
- (ignore-errors (seq-elt sequence n))))
+(unless (fboundp 'elisp--font-lock-flush-elisp-buffers)
+ ;; In Emacs≥25, (via elisp--font-lock-flush-elisp-buffers and a few others)
+ ;; we automatically highlight macros.
+ (add-hook 'emacs-lisp-mode-hook #'seq--activate-font-lock-keywords))
-(cl-defgeneric seq-random-elt (sequence)
- "Return a random element from SEQUENCE.
-Signal an error if SEQUENCE is empty."
- (if (seq-empty-p sequence)
- (error "Sequence cannot be empty")
- (seq-elt sequence (random (seq-length sequence)))))
+) ; end seq--when-emacs-25-p
(provide 'seq-25)
;;; seq-25.el ends here
diff --git a/seq-pkg.el b/seq-pkg.el
index 0ce3587..2904c8a 100644
--- a/seq-pkg.el
+++ b/seq-pkg.el
@@ -1,2 +1,2 @@
-;; Generated package description from seq.el
-(define-package "seq" "2.20" "Sequence manipulation functions" 'nil :url "http://elpa.gnu.org/packages/seq.html" :keywords '("sequences"))
+;; Generated package description from seq.el -*- no-byte-compile: t -*-
+(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 83d4392..41db04b 100644
--- a/seq.el
+++ b/seq.el
@@ -1,10 +1,10 @@
;;; seq.el --- Sequence manipulation functions -*- lexical-binding: t -*-
-;; Copyright (C) 2014-2016 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2020 Free Software Foundation, Inc.
;; Author: Nicolas Petton <nicolas@petton.fr>
;; Keywords: sequences
-;; Version: 2.20
+;; Version: 2.23
;; Package: seq
;; Maintainer: emacs-devel@gnu.org
@@ -22,7 +22,7 @@
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
+;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary: