branch: elpa/symbol-overlay commit 5274b7ee77653eefdfc192962b34857e4fbc514e Author: ksqsf <i...@ksqsf.moe> Commit: ksqsf <i...@ksqsf.moe>
Fix and optimize symbol-overlay-get-list. --- symbol-overlay.el | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/symbol-overlay.el b/symbol-overlay.el index 747cb0d3fe..faad64b7d9 100644 --- a/symbol-overlay.el +++ b/symbol-overlay.el @@ -236,16 +236,16 @@ 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." - (let ((overlays (overlays-in (point-min) (point-max)))) - (if (= dir 0) - overlays + (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)) - (start (overlay-start ov))) + (end (overlay-end ov))) (and value - (if (> dir 0) (<= (point) start) - (> (point) start)) + (if (< dir 0) (< end (point)) t) (or (not symbol) (if (string= value symbol) (not exclude) (and exclude (not (string= value ""))))))))