Skip to content

Commit ec846c6

Browse files
committed
Consistently access metadata via corfu--metadata-get
1 parent 21e9a5c commit ec846c6

File tree

4 files changed

+7
-13
lines changed

4 files changed

+7
-13
lines changed

corfu.el

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,9 +1123,8 @@ A scroll bar is displayed from LO to LO+BAR."
11231123

11241124
(cl-defgeneric corfu--affixate (cands)
11251125
"Annotate CANDS with annotation function."
1126-
(let* ((extras (nth 4 completion-in-region--data))
1127-
(dep (plist-get extras :company-deprecated))
1128-
(mf (let ((completion-extra-properties extras))
1126+
(let* ((dep (corfu--metadata-get 'company-deprecated))
1127+
(mf (let ((completion-extra-properties (nth 4 completion-in-region--data)))
11291128
(run-hook-with-args-until-success 'corfu-margin-formatters corfu--metadata))))
11301129
(setq cands
11311130
(if-let ((aff (corfu--metadata-get 'affixation-function)))

extensions/corfu-echo.el

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ subsequent delay."
8686
(funcall (if corfu-echo--message #'cdr #'car)
8787
corfu-echo-delay)
8888
corfu-echo-delay))
89-
(extra (nth 4 completion-in-region--data))
90-
(fun (plist-get extra :company-docsig))
89+
(fun (corfu--metadata-get 'company-docsig))
9190
(cand (and (>= corfu--index 0)
9291
(nth corfu--index corfu--candidates))))
9392
(if (<= delay 0)

extensions/corfu-info.el

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ If called with a prefix ARG, the buffer is persistent."
7474
(when (< corfu--index 0)
7575
(user-error "No candidate selected"))
7676
(let ((cand (nth corfu--index corfu--candidates)))
77-
(if-let ((extra (nth 4 completion-in-region--data))
78-
(fun (plist-get extra :company-doc-buffer))
77+
(if-let ((fun (corfu--metadata-get 'company-doc-buffer))
7978
(res (funcall fun cand)))
8079
(set-window-start (corfu-info--display-buffer
8180
(get-buffer (or (car-safe res) res))
@@ -92,8 +91,7 @@ If called with a prefix ARG, the buffer is persistent."
9291
(when (< corfu--index 0)
9392
(user-error "No candidate selected"))
9493
(let ((cand (nth corfu--index corfu--candidates)))
95-
(if-let ((extra (nth 4 completion-in-region--data))
96-
(fun (plist-get extra :company-location))
94+
(if-let ((fun (corfu--metadata-get 'company-location))
9795
;; BUG: company-location may throw errors if location is not found
9896
(loc (ignore-errors (funcall fun cand))))
9997
(with-selected-window

extensions/corfu-popupinfo.el

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,7 @@ all values are in pixels relative to the origin. See
182182
(let ((old-buffers (buffer-list)) (buffer nil))
183183
(unwind-protect
184184
(when-let
185-
((extra (nth 4 completion-in-region--data))
186-
(fun (plist-get extra :company-location))
185+
((fun (corfu--metadata-get 'company-location))
187186
;; BUG: company-location may throw errors if location is not found
188187
(loc (ignore-errors (funcall fun candidate)))
189188
((setq buffer
@@ -218,8 +217,7 @@ all values are in pixels relative to the origin. See
218217

219218
(defun corfu-popupinfo--get-documentation (candidate)
220219
"Get the documentation for CANDIDATE."
221-
(when-let ((extra (nth 4 completion-in-region--data))
222-
(fun (plist-get extra :company-doc-buffer))
220+
(when-let ((fun (corfu--metadata-get 'company-doc-buffer))
223221
(res (save-excursion
224222
(let ((inhibit-message t)
225223
(message-log-max nil)

0 commit comments

Comments
 (0)