diff options
| author | Daniel Mendler <mail@daniel-mendler.de> | 2024-07-10 10:43:34 +0200 |
|---|---|---|
| committer | Daniel Mendler <mail@daniel-mendler.de> | 2024-07-10 10:43:34 +0200 |
| commit | bedd0fa5bec33a853b4f9ef140f463a586eee5bc (patch) | |
| tree | 8b03fe983e05cd834fb5d9d0126c73d671aa8be6 | |
| parent | 03558e1935156e2ca5181b5706ffb0177faa6148 (diff) | |
corfu-popupinfo: Compare candidates with equal-including-properties (Fix #476)
| -rw-r--r-- | corfu.el | 18 | ||||
| -rw-r--r-- | extensions/corfu-popupinfo.el | 3 |
2 files changed, 13 insertions, 8 deletions
@@ -590,6 +590,16 @@ FRAME is the existing frame." (eq t (compare-strings word 0 len it 0 len completion-ignore-case)))))) +(defalias 'corfu--equal-including-properties + ;; bug#6581: `equal-including-properties' uses `eq' to compare + ;; properties until 29.1. Approximate by comparing + ;; `text-properties-at' position 0. + (static-if (< emacs-major-version 29) + (lambda (x y) + (and (equal x y) + (equal (text-properties-at 0 x) (text-properties-at 0 y)))) + #'equal-including-properties)) + (defun corfu--delete-dups (list) "Delete `equal-including-properties' consecutive duplicates from LIST." (let ((beg list)) @@ -602,13 +612,7 @@ FRAME is the existing frame." (while (not (eq beg end)) (let ((dup beg)) (while (not (eq (cdr dup) end)) - ;; bug#6581: `equal-including-properties' uses `eq' to compare - ;; properties until 29.1. Approximate by comparing - ;; `text-properties-at' position 0. - (if (static-if (< emacs-major-version 29) - (equal (text-properties-at 0 (car beg)) - (text-properties-at 0 (cadr dup))) - (equal-including-properties (car beg) (cadr dup))) + (if (corfu--equal-including-properties (car beg) (cadr dup)) (setcdr dup (cddr dup)) (pop dup)))) (pop beg))))) diff --git a/extensions/corfu-popupinfo.el b/extensions/corfu-popupinfo.el index 3a09911..2d33672 100644 --- a/extensions/corfu-popupinfo.el +++ b/extensions/corfu-popupinfo.el @@ -345,7 +345,8 @@ form (X Y WIDTH HEIGHT DIR)." (when (and (corfu-popupinfo--visible-p corfu--frame)) (let* ((cand-changed (not (and (corfu-popupinfo--visible-p) - (equal candidate corfu-popupinfo--candidate)))) + (corfu--equal-including-properties + candidate corfu-popupinfo--candidate)))) (new-coords (frame-edges corfu--frame 'inner-edges)) (coords-changed (not (equal new-coords corfu-popupinfo--coordinates)))) (when cand-changed |
