[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/m-buffer 2a056e6248 104/115: seq replaces the dependenc
From: |
ELPA Syncer |
Subject: |
[elpa] externals/m-buffer 2a056e6248 104/115: seq replaces the dependency on dash. |
Date: |
Tue, 19 Jul 2022 15:58:52 -0400 (EDT) |
branch: externals/m-buffer
commit 2a056e62487b3e346ef001237de8f3fd7cc56485
Author: Phillip Lord <phillip.lord@russet.org.uk>
Commit: Phillip Lord <phillip.lord@russet.org.uk>
seq replaces the dependency on dash.
Mostly, this change is a like-for-like replacement, with two exceptions:
seq.el is missing a tree-map function which is replaced by recursion;
and, `m-buffer-partition-by-marker' has been altered as it was making
implicit use of the order of evaluation of group-by which,
unfortunately, differs between dash and seq.
Version number has been bumped to Emacs-25 (since seq-24.el lacks the
`seqp' function). Travis has been updated to reflect this.
Moved to assess-discover for tests because it made life easier.
---
.travis.yml | 6 +--
Cask | 5 +--
Makefile | 23 +++++++---
m-buffer.el | 113 ++++++++++++++++++++++++++++----------------------
test/m-buffer-init.el | 4 --
test/m-buffer-test.el | 17 +++++---
6 files changed, 97 insertions(+), 71 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 7d3a37fab9..b2e055b082 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,11 +1,7 @@
language: generic
sudo: no
env:
- - EVM_EMACS=emacs-24.1-travis
- - EVM_EMACS=emacs-24.2-travis
- - EVM_EMACS=emacs-24.3-travis
- - EVM_EMACS=emacs-24.4-travis
- - EVM_EMACS=emacs-24.5-travis
+ - EVM_EMACS=emacs-25-pre-travis
install:
- curl -fsSkL https://gist.github.com/rejeep/ebcd57c3af83b049833b/raw >
travis.sh && source ./travis.sh
- evm install $EVM_EMACS --use --skip
diff --git a/Cask b/Cask
index 0f7622d8a9..45eec3810c 100644
--- a/Cask
+++ b/Cask
@@ -1,10 +1,9 @@
(source gnu)
-(source melpa-stable)
-(source marmalade)
+(source melpa)
(package-file "m-buffer.el")
(files "m-buffer*el" "m-buffer*els")
(development
(depends-on "load-relative")
- (depends-on "ert-runner"))
+ (depends-on "assess"))
diff --git a/Makefile b/Makefile
index d3e5cd2991..f915053a4e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,16 +1,29 @@
EMACS ?= emacs
CASK ?= cask
-all: install test
+-include makefile-local
+
+ifdef EMACS
+EMACS_ENV=EMACS=$(EMACS)
+endif
+
+
+all: test
install:
- cask install
+ $(EMACS_ENV) $(CASK) install
+
+just-test:
+ $(EMACS_ENV) $(CASK) emacs --batch -q \
+ --directory=. \
+ --load "assess-discover" \
+ --funcall assess-discover-run-and-exit-batch
+
+test: install just-test
-test: install
- cask exec ert-runner
doc-gen:
- cask exec emacs --debug --script dev/doc-gen.el -f doc-gen
+ $(EMACS_ENV) $(CASK) exec $(EMACS) --debug --script dev/doc-gen.el -f
doc-gen
clean:
find . -name "m-buffer*org" -not -name "m-buffer-doc.org" \
diff --git a/m-buffer.el b/m-buffer.el
index 2f50190712..7eefc1a361 100644
--- a/m-buffer.el
+++ b/m-buffer.el
@@ -7,7 +7,7 @@
;; Author: Phillip Lord <phillip.lord@russet.org.uk>
;; Maintainer: Phillip Lord <phillip.lord@russet.rg.uk>
;; Version: 0.14
-;; Package-Requires: ((dash "2.8.0")(emacs "24.3"))
+;; Package-Requires: ((emacs "25.1"))
;; The contents of this file are subject to the GPL License, Version 3.0.
@@ -63,8 +63,7 @@
;;; Code:
;; #+begin_src emacs-lisp
-
-(require 'dash)
+(require 'seq)
(require 'm-buffer-macro)
;; #+end_src
@@ -229,11 +228,11 @@ MATCH-WITH are these args. This is an internal function."
(let* (
;; split up into keyword and non keyword limits
(args
- (-take-while
+ (seq-take-while
(lambda (x) (not (keywordp x)))
match-with))
(pargs
- (-drop-while
+ (seq-drop-while
(lambda (x) (not (keywordp x)))
match-with))
;; sort actual actual parameters
@@ -324,10 +323,10 @@ args, assume they are of the form accepted by
(defun m-buffer-match-nth-group (n match-data)
"Fetch the Nth group from MATCH-DATA."
- (-map
+ (seq-map
(lambda (m)
(let ((drp
- (-drop (* 2 n) m)))
+ (seq-drop m (* 2 n))))
(list
(car drp) (cadr drp))))
match-data))
@@ -337,7 +336,7 @@ args, assume they are of the form accepted by
MATCH may be of any form accepted by `m-buffer-ensure-match'. Use
`m-buffer-nil-marker' after the markers have been finished with
or they will slow future use of the buffer until garbage collected."
- (-map
+ (seq-map
(lambda (m)
(nth
(* 2 n) m))
@@ -371,7 +370,7 @@ function. See `m-buffer-nil-marker' for details."
MATCH may be of any form accepted by `m-buffer-ensure-match'.
If `match-data' is passed markers will be set to nil after this
function. See `m-buffer-nil-marker' for details."
- (-map
+ (seq-map
(lambda (m)
(nth
(+ 1 (* 2 n))
@@ -435,9 +434,9 @@ Matches are equivalent if overall they match the same
area; subgroups are ignored.
See also `m-buffer-match-exact-subtract' which often
runs faster but has some restrictions."
- (-remove
+ (seq-remove
(lambda (o)
- (-any?
+ (seq-some
(lambda (p)
(m-buffer-match-equal o p))
n))
@@ -456,7 +455,7 @@ in M."
;; n-eaten contains the remaining elements of n that we haven't tested
;; for yet. We throw them away as we go
(let ((n-eaten n))
- (-remove
+ (seq-remove
(lambda (o)
(cond
;; n-eaten has been eaten. Check here or later "<" comparison
crashes.
@@ -469,7 +468,7 @@ in M."
((m-buffer-match-equal
(car n-eaten) o)
(progn
- (setq n-eaten (-drop 1 n-eaten))
+ (setq n-eaten (seq-drop n-eaten 1))
t))
;; we should discard also if n-eaten 1 is less than o because, both
;; are sorted, so we will never match
@@ -479,14 +478,14 @@ in M."
;; first half of match
(car o))
(progn
- (setq n-eaten (-drop 1 n-eaten))
+ (setq n-eaten (seq-drop n-eaten 1))
t))))
m))
m))
(defun m-buffer-in-match-p (matches position)
"Returns true is any of MATCHES contain POSITION."
- (-any?
+ (seq-some
(lambda (match)
(and
(<= (car match) position)
@@ -501,15 +500,24 @@ in M."
;; pairs of markers.
;; #+begin_src emacs-lisp
-(defun m-buffer--split-partition (partition)
- (let ((current nil))
- (lambda (n)
- (when
- (and partition
- (<= (car partition) n))
- (setq current (car partition))
- (setq partition (-drop 1 partition)))
- current)))
+(defun m-buffer--partition-by-marker(list partition)
+ "Given LIST, split at markers in PARTITION.
+
+This is the main implementation for `m-buffer-partition-by-marker',
+but assumes that partition starts with a very low value (or nil)."
+ (let* ((p-top (car-safe partition))
+ (p-val (car-safe (cdr-safe partition)))
+ (p-fn (lambda (n)
+ (or (not p-val)
+ (< n p-val)))))
+ (when list
+ (cons
+ (cons
+ p-top
+ (seq-take-while p-fn list))
+ (m-buffer--partition-by-marker
+ (seq-drop-while p-fn list)
+ (cdr partition))))))
(defun m-buffer-partition-by-marker (list partition)
"Given LIST of markers, split at markers in PARTITION.
@@ -520,7 +528,8 @@ buffer than the element from PARTITION, but before the next
element from PARTITION.
Both LIST and PARTITION must be sorted."
- (-group-by (m-buffer--split-partition partition) list))
+ ;; TODO!
+ (m-buffer--partition-by-marker list (cons nil partition)))
;; #+end_src
@@ -537,17 +546,19 @@ Both LIST and PARTITION must be sorted."
Markers slow buffer movement while they are pointing at a
specific location, until they have been garbage collected. Niling
them prevents this. See Info node `(elisp) Overview of Markers'."
- (-map
+ (seq-map
(lambda (marker)
- (set-marker marker nil))
- (-flatten markers)))
+ (if (seqp marker)
+ (m-buffer-nil-marker marker)
+ (set-marker marker nil)))
+ markers))
(defun m-buffer-marker-to-pos (markers &optional postnil)
"Transforms a list of MARKERS to a list of positions.
If the markers are no longer needed, set POSTNIL to true, or call
`m-buffer-nil-marker' manually after use to speed future buffer
movement. Or use `m-buffer-marker-to-pos-nil'."
- (-map
+ (seq-map
(lambda (marker)
(prog1
(marker-position marker)
@@ -564,12 +575,14 @@ See also `m-buffer-nil-markers'"
"Transforms a tree of markers to equivalent positions.
MARKER-TREE is the tree.
POSTNIL sets markers to nil afterwards."
- (-tree-map
+ (seq-map
(lambda (marker)
- (prog1
- (marker-position marker)
- (when postnil
- (set-marker marker nil))))
+ (if (seqp marker)
+ (m-buffer-marker-tree-to-pos marker postnil)
+ (prog1
+ (marker-position marker)
+ (when postnil
+ (set-marker marker nil)))))
marker-tree))
(defun m-buffer-marker-tree-to-pos-nil (marker-tree)
@@ -581,14 +594,16 @@ MARKER-TREE is the tree. Markers are niled afterwards."
"Return a clone of MARKER-TREE.
The optional argument TYPE specifies the insertion type. See
`copy-marker' for details."
- (-tree-map
+ (seq-map
(lambda (marker)
- (copy-marker marker type))
+ (if (seqp marker)
+ (m-buffer-marker-clone marker type)
+ (copy-marker marker type)))
marker-tree))
(defun m-buffer-pos-to-marker (buffer positions)
"In BUFFER translates a list of POSITIONS to markers."
- (-map
+ (seq-map
(lambda (pos)
(set-marker
(make-marker) pos buffer))
@@ -609,7 +624,7 @@ markers are part of MATCH-DATA, so niling them will
percolate backward.
See also `replace-match'."
(save-excursion
- (-map
+ (seq-map
(lambda (match)
(with-current-buffer
(marker-buffer (car match))
@@ -631,7 +646,7 @@ markers are part of MATCH_DATA, so niling them will
percolate backward."
(defun m-buffer-match-string (match-data &optional subexp)
"Return strings for MATCH-DATA optionally of group SUBEXP."
- (-map
+ (seq-map
(lambda (match)
(with-current-buffer
(marker-buffer (car match))
@@ -644,7 +659,7 @@ markers are part of MATCH_DATA, so niling them will
percolate backward."
(defun m-buffer-match-string-no-properties (match-data &optional subexp)
"Return strings for MATCH-DATA optionally of group SUBEXP.
Remove all properties from return."
- (-map
+ (seq-map
'substring-no-properties
(m-buffer-match-string
match-data subexp)))
@@ -664,19 +679,19 @@ Remove all properties from return."
(defun m-buffer-apply-join (fn match &rest more-match)
(let*
((args
- (-take-while
+ (seq-take-while
(lambda (x) (not (keywordp x)))
match))
(pargs
- (-drop-while
+ (seq-drop-while
(lambda (x) (not (keywordp x)))
match))
(more-keywords
- (-map
+ (seq-map
'car
- (-partition 2 more-match))))
+ (seq-partition more-match 2))))
(when
- (-first
+ (seq-find
(lambda (keyword)
(plist-member pargs keyword))
more-keywords)
@@ -841,7 +856,7 @@ further details."
Note empty lines do not contain any non-whitespace lines.
MATCH is of form BUFFER-OR-WINDOW MATCH-OPTIONS. See
`m-buffer-match' for further details."
- (-difference
+ (seq-difference
(apply 'm-buffer-match-line match)
(apply 'm-buffer-match-whitespace-line match)))
@@ -878,7 +893,7 @@ MATCH-DATA can be any list of lists with two elements (or
more)."
"Apply FN to the Nth group of MATCH-DATA.
FN should take two args, the start and stop of each region.
MATCH-DATA can be any list of lists with two elements (or more)."
- (-map
+ (seq-map
(lambda (x)
(apply fn x))
(m-buffer-match-nth-group n match-data)))
@@ -932,7 +947,7 @@ Info node `(elisp) Text Properties' for further details."
"To MATCH-DATA add FACE to the face property.
This is for use in buffers which do not have function `font-lock-mode'
enabled; otherwise use `m-buffer-overlay-font-lock-face-match'."
- (-map
+ (seq-map
(lambda (ovly)
(overlay-put ovly 'face face))
(m-buffer-overlay-match match-data)))
@@ -941,7 +956,7 @@ enabled; otherwise use
`m-buffer-overlay-font-lock-face-match'."
"To MATCH-DATA add FACE to the face property.
This is for use in buffers which have variable `font-lock-mode' enabled;
otherwise use `m-buffer-overlay-face-match'."
- (-map
+ (seq-map
(lambda (ovly)
(overlay-put ovly 'face face))
(m-buffer-overlay-match match-data)))
diff --git a/test/m-buffer-init.el b/test/m-buffer-init.el
index 524c2da3b7..4034d3817e 100644
--- a/test/m-buffer-init.el
+++ b/test/m-buffer-init.el
@@ -2,7 +2,3 @@
(directory-file-name
(file-name-directory load-file-name)))
-
-
-(message "load path is %s" load-path)
-
diff --git a/test/m-buffer-test.el b/test/m-buffer-test.el
index 7e00ee904a..3e6bba2f90 100644
--- a/test/m-buffer-test.el
+++ b/test/m-buffer-test.el
@@ -87,6 +87,13 @@
:widen 4 :case-fold-search 5 :numeric 6)))))
+(defun m-buffer--flatten (l)
+ (if (listp l)
+ (apply 'append
+ (seq-map
+ 'm-buffer--flatten l))
+ (list l)))
+
(ert-deftest m-buffer-matches ()
(should
(= 3
@@ -97,9 +104,9 @@
(current-buffer)
"^one$")))))
(should
- (-every?
+ (seq-every-p
'markerp
- (-flatten
+ (m-buffer--flatten
(m-buffer-wtb-of-file
"match-data.txt"
(m-buffer-match
@@ -108,7 +115,7 @@
(ert-deftest m-buffer-match-begin ()
(should
- (-every?
+ (seq-every-p
'markerp
(m-buffer-wtb-of-file
"match-data.txt"
@@ -140,7 +147,7 @@
(should
(m-buffer-wtb-of-file
"match-data.txt"
- (-all?
+ (seq-every-p
(lambda (marker)
(and
(marker-position marker)
@@ -149,7 +156,7 @@
(should
(m-buffer-wtb-of-file
"match-data.txt"
- (-all?
+ (seq-every-p
(lambda (marker)
(and
(not (marker-position marker))
- [elpa] externals/m-buffer 77067c0ff5 076/115: Version 0.9 Released., (continued)
- [elpa] externals/m-buffer 77067c0ff5 076/115: Version 0.9 Released., ELPA Syncer, 2022/07/19
- [elpa] externals/m-buffer 3136ab48a8 082/115: Docstring typo., ELPA Syncer, 2022/07/19
- [elpa] externals/m-buffer c0946dbe6c 085/115: Documentations updates., ELPA Syncer, 2022/07/19
- [elpa] externals/m-buffer ea281db21a 089/115: New function: m-buffer-partition-by-marker., ELPA Syncer, 2022/07/19
- [elpa] externals/m-buffer 3fd8848e40 091/115: m-buffer-at-narrowed-p added., ELPA Syncer, 2022/07/19
- [elpa] externals/m-buffer 3702262fbc 092/115: m-buffer was not stateless at all!, ELPA Syncer, 2022/07/19
- [elpa] externals/m-buffer 1f9cb91594 095/115: Generic language., ELPA Syncer, 2022/07/19
- [elpa] externals/m-buffer 3325bfcf6e 098/115: Prepare for next release., ELPA Syncer, 2022/07/19
- [elpa] externals/m-buffer 62751a56db 099/115: Fix hyperlink in travis-ci build., ELPA Syncer, 2022/07/19
- [elpa] externals/m-buffer 1ff021c5f6 100/115: v0.13 release., ELPA Syncer, 2022/07/19
- [elpa] externals/m-buffer 2a056e6248 104/115: seq replaces the dependency on dash.,
ELPA Syncer <=
- [elpa] externals/m-buffer 61d1ed99e5 103/115: Update email, ELPA Syncer, 2022/07/19
- [elpa] externals/m-buffer 1da2438bfb 105/115: Lentic doc update and generation, ELPA Syncer, 2022/07/19
- [elpa] externals/m-buffer 9c45387989 107/115: Update Cask file for lentic-doc changes, ELPA Syncer, 2022/07/19
- [elpa] externals/m-buffer 3bff1078c6 109/115: Add package task to Makefile, ELPA Syncer, 2022/07/19
- [elpa] externals/m-buffer a2b935896f 111/115: Support Emacs-24 series, ELPA Syncer, 2022/07/19
- [elpa] externals/m-buffer d2e35bf929 115/115: Adjust copyright headers for GNU ELPA, ELPA Syncer, 2022/07/19