summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mendler <mail@daniel-mendler.de>2025-01-03 21:29:38 +0100
committerDaniel Mendler <mail@daniel-mendler.de>2025-01-03 21:29:38 +0100
commitec846c6aa373931508cc078b49a3a8ba8265c453 (patch)
treeb06586b3e561a12ce063b451fe3b06461334e35b
parent21e9a5cc87f6643818293959096451c2f9701800 (diff)
Consistently access metadata via corfu--metadata-get
-rw-r--r--corfu.el5
-rw-r--r--extensions/corfu-echo.el3
-rw-r--r--extensions/corfu-info.el6
-rw-r--r--extensions/corfu-popupinfo.el6
4 files changed, 7 insertions, 13 deletions
diff --git a/corfu.el b/corfu.el
index 9cb30fe..b4d053b 100644
--- a/corfu.el
+++ b/corfu.el
@@ -1123,9 +1123,8 @@ A scroll bar is displayed from LO to LO+BAR."
(cl-defgeneric corfu--affixate (cands)
"Annotate CANDS with annotation function."
- (let* ((extras (nth 4 completion-in-region--data))
- (dep (plist-get extras :company-deprecated))
- (mf (let ((completion-extra-properties extras))
+ (let* ((dep (corfu--metadata-get 'company-deprecated))
+ (mf (let ((completion-extra-properties (nth 4 completion-in-region--data)))
(run-hook-with-args-until-success 'corfu-margin-formatters corfu--metadata))))
(setq cands
(if-let ((aff (corfu--metadata-get 'affixation-function)))
diff --git a/extensions/corfu-echo.el b/extensions/corfu-echo.el
index fb83262..75de848 100644
--- a/extensions/corfu-echo.el
+++ b/extensions/corfu-echo.el
@@ -86,8 +86,7 @@ subsequent delay."
(funcall (if corfu-echo--message #'cdr #'car)
corfu-echo-delay)
corfu-echo-delay))
- (extra (nth 4 completion-in-region--data))
- (fun (plist-get extra :company-docsig))
+ (fun (corfu--metadata-get 'company-docsig))
(cand (and (>= corfu--index 0)
(nth corfu--index corfu--candidates))))
(if (<= delay 0)
diff --git a/extensions/corfu-info.el b/extensions/corfu-info.el
index e2f72d2..a46e03d 100644
--- a/extensions/corfu-info.el
+++ b/extensions/corfu-info.el
@@ -74,8 +74,7 @@ If called with a prefix ARG, the buffer is persistent."
(when (< corfu--index 0)
(user-error "No candidate selected"))
(let ((cand (nth corfu--index corfu--candidates)))
- (if-let ((extra (nth 4 completion-in-region--data))
- (fun (plist-get extra :company-doc-buffer))
+ (if-let ((fun (corfu--metadata-get 'company-doc-buffer))
(res (funcall fun cand)))
(set-window-start (corfu-info--display-buffer
(get-buffer (or (car-safe res) res))
@@ -92,8 +91,7 @@ If called with a prefix ARG, the buffer is persistent."
(when (< corfu--index 0)
(user-error "No candidate selected"))
(let ((cand (nth corfu--index corfu--candidates)))
- (if-let ((extra (nth 4 completion-in-region--data))
- (fun (plist-get extra :company-location))
+ (if-let ((fun (corfu--metadata-get 'company-location))
;; BUG: company-location may throw errors if location is not found
(loc (ignore-errors (funcall fun cand))))
(with-selected-window
diff --git a/extensions/corfu-popupinfo.el b/extensions/corfu-popupinfo.el
index cc87054..4105f13 100644
--- a/extensions/corfu-popupinfo.el
+++ b/extensions/corfu-popupinfo.el
@@ -182,8 +182,7 @@ all values are in pixels relative to the origin. See
(let ((old-buffers (buffer-list)) (buffer nil))
(unwind-protect
(when-let
- ((extra (nth 4 completion-in-region--data))
- (fun (plist-get extra :company-location))
+ ((fun (corfu--metadata-get 'company-location))
;; BUG: company-location may throw errors if location is not found
(loc (ignore-errors (funcall fun candidate)))
((setq buffer
@@ -218,8 +217,7 @@ all values are in pixels relative to the origin. See
(defun corfu-popupinfo--get-documentation (candidate)
"Get the documentation for CANDIDATE."
- (when-let ((extra (nth 4 completion-in-region--data))
- (fun (plist-get extra :company-doc-buffer))
+ (when-let ((fun (corfu--metadata-get 'company-doc-buffer))
(res (save-excursion
(let ((inhibit-message t)
(message-log-max nil)