branch: externals/auto-overlays
commit 3fa9ac14df2dcdef15b182a4e51335f6a947a68f
Author: Toby S. Cubitt <[email protected]>
Commit: Toby S. Cubitt <[email protected]>
Fix bugs caused by auto-overlays-in no longer sorting result list.
---
auto-overlay-flat.el | 32 ++++++++++++++++++--------------
auto-overlay-self.el | 9 +++++----
auto-overlays.el | 10 +++-------
3 files changed, 26 insertions(+), 25 deletions(-)
diff --git a/auto-overlay-flat.el b/auto-overlay-flat.el
index b5ff555..9d9eb44 100644
--- a/auto-overlay-flat.el
+++ b/auto-overlay-flat.el
@@ -90,10 +90,12 @@
;; if match is within existing overlay with same set-d and
definition-id...
(when (setq o-parent
(car ; FIXME: is this right?
- (auto-overlays-at-point
- (overlay-get o-match 'delim-start) ; FIXME: is this right?
- `(eq set-id ,(overlay-get o-match 'set-id))
- `(eq definition-id ,(overlay-get o-match 'definition-id)))))
+ (sort
+ (auto-overlays-at-point
+ (overlay-get o-match 'delim-start) ; FIXME: is this right?
+ `(eq set-id ,(overlay-get o-match 'set-id))
+ `(eq definition-id ,(overlay-get o-match 'definition-id)))
+ #'auto-overlay-<)))
;; if overlay can simply be re-matched with new end-match, do so
(let ((o-end (overlay-get o-parent 'end))
@@ -170,16 +172,18 @@
;; O-MATCH in buffer, with same set-id and definition-id as O-MATCH.
;; get sorted list of matching overlays after O-MATCH
- (let ((o-list (auto-overlays-in
- (overlay-start o-match) (point-max) ; FIXME: is start right?
- '(identity auto-overlay-match)
- `(eq set-id ,(overlay-get o-match 'set-id))
- `(eq definition-id ,(overlay-get o-match 'definition-id))
- (list (lambda (set-id definition-id regexp-id edge)
- (eq (auto-o-regexp-edge set-id definition-id regexp-id)
- edge))
- '(set-id definition-id regexp-id)
- (list edge)))))
+ (let ((o-list (sort
+ (auto-overlays-in
+ (overlay-start o-match) (point-max) ; FIXME: is start right?
+ '(identity auto-overlay-match)
+ `(eq set-id ,(overlay-get o-match 'set-id))
+ `(eq definition-id ,(overlay-get o-match 'definition-id))
+ (list (lambda (set-id definition-id regexp-id edge)
+ (eq (auto-o-regexp-edge set-id definition-id
regexp-id)
+ edge))
+ '(set-id definition-id regexp-id)
+ (list edge)))
+ #'auto-overlay-<)))
;; if searching for same EDGE as O-MATCH, first overlay in list is always
;; O-MATCH itself, so we drop it
(if (eq (auto-o-edge o-match) edge) (nth 1 o-list) (car o-list))))
diff --git a/auto-overlay-self.el b/auto-overlay-self.el
index a780d7c..d7d29b5 100644
--- a/auto-overlay-self.el
+++ b/auto-overlay-self.el
@@ -303,10 +303,11 @@
;; that end at start or start at end. This seems to give the
;; same results as the old version of `auto-o-self-list'
;; (above) in all circumstances.
- (auto-overlays-in
- (1- (overlay-get o-start 'delim-start)) (1+ end)
- `(eq set-id ,(overlay-get o-start 'set-id))
- `(eq definition-id ,(overlay-get o-start 'definition-id))))))
+ (sort (auto-overlays-in
+ (1- (overlay-get o-start 'delim-start)) (1+ end)
+ `(eq set-id ,(overlay-get o-start 'set-id))
+ `(eq definition-id ,(overlay-get o-start 'definition-id)))
+ #'auto-overlay-<))))
;;; auto-overlay-self.el ends here
diff --git a/auto-overlays.el b/auto-overlays.el
index 60a2b80..9e6d318 100644
--- a/auto-overlays.el
+++ b/auto-overlays.el
@@ -684,7 +684,7 @@ overlays that satisfy all property tests are returned."
(when (and (> (overlay-end o) point)
(= (overlay-start o) point))
(push o overlay-list)))
- (sort overlay-list #'auto-overlay-<)))
+ overlay-list))
@@ -1233,10 +1233,7 @@ The overlays can be loaded again later using
:all-overlays t
'auto-overlay-match
`(eq set-id ,set-id))
- (lambda (a b)
- (or (< (overlay-start a) (overlay-start b))
- (and (= (overlay-start a) (overlay-start b))
- (< (overlay-end a) (overlay-end b)))))))
+ #'auto-overlay-<))
;; write overlay data to temporary buffer
(mapc (lambda (o)
@@ -1758,8 +1755,7 @@ overlays were saved."
;; note: parentless overlays are possible if a suicide is in
;; progress, so need to check overlay has a parent first
'(identity parent)
- (list (lambda (parent)
- (not (overlay-get parent 'inactive)))
+ (list (lambda (parent) (not (overlay-get parent 'inactive)))
'parent)
(list (lambda (set-id definition-id regexp-id new-pri)
(let ((pri (cdr (assq