[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/zones f29e616 04/43: no summary available
From: |
Stefan Monnier |
Subject: |
[elpa] externals/zones f29e616 04/43: no summary available |
Date: |
Sun, 28 Oct 2018 15:05:53 -0400 (EDT) |
branch: externals/zones
commit f29e616cb1c1c5c6118b67160287b729b04de1e3
Author: DrewAdams <address@hidden>
Commit: Alex Schroeder <address@hidden>
no summary available
---
zones.el | 39 ++++++++++++++++++++++++++++++++++-----
1 file changed, 34 insertions(+), 5 deletions(-)
diff --git a/zones.el b/zones.el
index 2df9e7a..205cd96 100644
--- a/zones.el
+++ b/zones.el
@@ -8,9 +8,9 @@
;; Created: Tue Aug 4 08:54:06 2015 (-0700)
;; Version: 2015.08.08
;; Package-Requires: ()
-;; Last-Updated: Sun Aug 9 15:42:17 2015 (-0700)
+;; Last-Updated: Fri Aug 14 09:17:21 2015 (-0700)
;; By: dradams
-;; Update #: 179
+;; Update #: 207
;; URL: http://www.emacswiki.org/zones.el
;; Doc URL: http://www.emacswiki.org/Zones
;; Keywords: region zone
@@ -52,6 +52,7 @@
;;
;; `zzz-buffer-of-markers', `zzz-car-<', `zzz-zone-complement',
;; `zzz-every', `zzz-max', `zzz-min', `zzz-ordered-zone',
+;; `zzz-remove-if', `zzz-remove-if-other-buffer-markers',
;; `zzz-set-union', `zzz-set-intersection', `zzz-some',
;; `zzz-two-zone-intersection', `zzz-two-zone-union',
;; `zzz-zone-intersection', `zzz-zone-intersection-1',
@@ -62,6 +63,10 @@
;;
;;; Change Log:
;;
+;; 2015/08/14 dadams
+;; Added: zzz-remove-if, zzz-remove-if-other-buffer-markers.
+;; zzz-zone-union:
+;; Added optional arg BUFFER. Filter with
zzz-remove-if-other-buffer-markers.
;; 2015/08/09 dadams
;; Added: zzz-zone-complement.
;; 2015/08/05 dadams
@@ -161,13 +166,16 @@ list) is the union of the EXTRA information of each zone:
,(zzz-max (cadr zone1) (cadr zone2))
,@(zzz-set-union (cddr zone1) (cddr zone2)))))
-(defun zzz-zone-union (zones)
+(defun zzz-zone-union (zones &optional buffer)
"Return the union of the zones in list ZONES.
Each element of ZONES is a list of two zone limits, possibly followed
by entra info: (LIMIT1 LIMIT2 . EXTRA), where EXTRA is a list.
The limits do not need to be in numerical order.
+Each limit can be a number or a marker, but zones with markers for
+buffers other than BUFFER (default: current buffer) are ignored.
+
The list value returned is sorted by the lower limit of each zone,
which is its car.
@@ -177,8 +185,9 @@ The resulting zones are then sorted by their cars.
`zzz-two-zone-union' is then applied recursively to combine
overlapping zones. This means also that any EXTRA info is combined
when zones are merged together."
- (let* ((flipped-zones (mapcar #'zzz-ordered-zone zones))
- (sorted-zones (sort flipped-zones #'zzz-car-<)))
+ (let* ((filtered-zones (zzz-remove-if-other-buffer-markers zones))
+ (flipped-zones (mapcar #'zzz-ordered-zone filtered-zones))
+ (sorted-zones (sort flipped-zones #'zzz-car-<)))
(zzz-zone-union-1 sorted-zones)))
(defun zzz-zone-union-1 (zones)
@@ -341,6 +350,26 @@ Return the first non-nil value returned by PREDICATE."
(setq res nil))
res))
+(defun zzz-remove-if-other-buffer-markers (zones &optional buffer)
+ "Return ZONES, but remove any that use markers for another buffer.
+BUFFER is the buffer to compare with (default: current buffer).
+This is a non-destructive operation: a (shallow) copy is returned."
+ (unless buffer (setq buffer (current-buffer)))
+ (let (m1 m2)
+ (zzz-remove-if
+ `(lambda (zone)
+ (setq m1 (car zone)
+ m2 (cadr zone))
+ (or (and (markerp m1) (not (eq ',buffer (marker-buffer m1))))
+ (and (markerp m2) (not (eq ',buffer (marker-buffer m2))))))
+ zones)))
+
+(defun zzz-remove-if (pred xs)
+ "A copy of list XS with no elements that satisfy predicate PRED."
+ (let ((result ()))
+ (dolist (x xs) (unless (funcall pred x) (push x result)))
+ (nreverse result)))
+
;;;;;;;;;;;;;;;;;;;;;;;;;;
(provide 'zones)
- [elpa] branch externals/zones created (now 2ebb425), Stefan Monnier, 2018/10/28
- [elpa] externals/zones a8512bd 05/43: no summary available, Stefan Monnier, 2018/10/28
- [elpa] externals/zones 642b1b2 02/43: no summary available, Stefan Monnier, 2018/10/28
- [elpa] externals/zones 86d73d1 03/43: no summary available, Stefan Monnier, 2018/10/28
- [elpa] externals/zones f29e616 04/43: no summary available,
Stefan Monnier <=
- [elpa] externals/zones e61ac2c 07/43: no summary available, Stefan Monnier, 2018/10/28
- [elpa] externals/zones f6a4c19 10/43: no summary available, Stefan Monnier, 2018/10/28
- [elpa] externals/zones e28169f 11/43: no summary available, Stefan Monnier, 2018/10/28
- [elpa] externals/zones 08146ae 14/43: no summary available, Stefan Monnier, 2018/10/28
- [elpa] externals/zones a8a4c72 16/43: no summary available, Stefan Monnier, 2018/10/28
- [elpa] externals/zones 3d5fa31 08/43: no summary available, Stefan Monnier, 2018/10/28
- [elpa] externals/zones be810ac 26/43: no summary available, Stefan Monnier, 2018/10/28
- [elpa] externals/zones eb696a2 13/43: no summary available, Stefan Monnier, 2018/10/28
- [elpa] externals/zones b7c13db 01/43: New library: zones of text - like multiple regions., Stefan Monnier, 2018/10/28
- [elpa] externals/zones 309a1af 19/43: no summary available, Stefan Monnier, 2018/10/28