From cd7d906485a0a5d0fbedad171685159645147650 Mon Sep 17 00:00:00 2001 From: Matt Beshara Date: Wed, 28 Dec 2022 17:44:07 +1100 Subject: [PATCH] =?UTF-8?q?Always=20filter=20overlays=20returned=20from=20?= =?UTF-8?q?=E2=80=98symbol-overlay-get-list=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- symbol-overlay.el | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/symbol-overlay.el b/symbol-overlay.el index ff14ee5..fa6512d 100644 --- a/symbol-overlay.el +++ b/symbol-overlay.el @@ -236,20 +236,19 @@ You can re-bind the commands to any keys you prefer.") If SYMBOL is non-nil, get the overlays that belong to it. DIR is an integer. If EXCLUDE is non-nil, get all overlays excluding those belong to SYMBOL." - (if (= dir 0) - (overlays-in (point-min) (point-max)) - (let ((overlays (cond ((< dir 0) (overlays-in (point-min) (point))) - ((> dir 0) (overlays-in (point) (point-max)))))) - (seq-filter - (lambda (ov) - (let ((value (overlay-get ov 'symbol)) - (end (overlay-end ov))) - (and value - (or (> dir 0) (< end (point))) - (or (not symbol) - (if (string= value symbol) (not exclude) - (and exclude (not (string= value "")))))))) - overlays)))) + (let ((overlays (cond ((= dir 0) (overlays-in (point-min) (point-max))) + ((< dir 0) (overlays-in (point-min) (point))) + ((> dir 0) (overlays-in (point) (point-max)))))) + (seq-filter + (lambda (ov) + (let ((value (overlay-get ov 'symbol)) + (end (overlay-end ov))) + (and value + (or (>= dir 0) (< end (point))) + (or (not symbol) + (if (string= value symbol) (not exclude) + (and exclude (not (string= value "")))))))) + overlays))) (defun symbol-overlay-get-symbol (&optional noerror) "Get the symbol at point.