diff options
| author | Daniel Mendler <mail@daniel-mendler.de> | 2024-01-03 15:01:08 +0100 |
|---|---|---|
| committer | Daniel Mendler <mail@daniel-mendler.de> | 2024-01-03 15:01:56 +0100 |
| commit | adfccae7be2dff68ecbded1b47d5029e4e86dc00 (patch) | |
| tree | 96ad428ef99cd8a04f7029b7b3fbc15843188c7c /extensions | |
| parent | 61a20a50369de2cae77d649269d3c047fbbc27ec (diff) | |
Store extra properties in completion-in-region--data
Diffstat (limited to 'extensions')
| -rw-r--r-- | extensions/corfu-echo.el | 3 | ||||
| -rw-r--r-- | extensions/corfu-info.el | 10 | ||||
| -rw-r--r-- | extensions/corfu-popupinfo.el | 6 |
3 files changed, 12 insertions, 7 deletions
diff --git a/extensions/corfu-echo.el b/extensions/corfu-echo.el index d93d819..3053fe5 100644 --- a/extensions/corfu-echo.el +++ b/extensions/corfu-echo.el @@ -85,7 +85,8 @@ subsequent delay." (funcall (if corfu-echo--message #'cdr #'car) corfu-echo-delay) corfu-echo-delay)) - (fun (plist-get corfu--extra :company-docsig)) + (extra (nth 4 completion-in-region--data)) + (fun (plist-get extra :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 d0f483e..4f13037 100644 --- a/extensions/corfu-info.el +++ b/extensions/corfu-info.el @@ -74,7 +74,8 @@ 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 ((fun (plist-get corfu--extra :company-doc-buffer)) + (if-let ((extra (nth 4 completion-in-region--data)) + (fun (plist-get extra :company-doc-buffer)) (res (funcall fun cand))) (set-window-start (corfu-info--display-buffer (get-buffer (or (car-safe res) res)) @@ -91,9 +92,10 @@ 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))) - ;; BUG: company-location may throw errors if location is not found - (if-let ((fun (ignore-errors (plist-get corfu--extra :company-location))) - (loc (funcall fun cand))) + (if-let ((extra (nth 4 completion-in-region--data)) + (fun (plist-get extra :company-location)) + ;; BUG: company-location may throw errors if location is not found + (loc (ignore-errors (funcall fun cand)))) (with-selected-window (corfu-info--display-buffer (or (and (bufferp (car loc)) (car loc)) diff --git a/extensions/corfu-popupinfo.el b/extensions/corfu-popupinfo.el index 2b8b2d6..3aa4f55 100644 --- a/extensions/corfu-popupinfo.el +++ b/extensions/corfu-popupinfo.el @@ -179,7 +179,8 @@ all values are in pixels relative to the origin. See (let ((old-buffers (buffer-list)) (buffer nil)) (unwind-protect (when-let - ((fun (plist-get corfu--extra :company-location)) + ((extra (nth 4 completion-in-region--data)) + (fun (plist-get extra :company-location)) ;; BUG: company-location may throw errors if location is not found (loc (ignore-errors (funcall fun candidate))) ((setq buffer @@ -214,7 +215,8 @@ all values are in pixels relative to the origin. See (defun corfu-popupinfo--get-documentation (candidate) "Get the documentation for CANDIDATE." - (when-let ((fun (plist-get corfu--extra :company-doc-buffer)) + (when-let ((extra (nth 4 completion-in-region--data)) + (fun (plist-get extra :company-doc-buffer)) (res (save-excursion (let ((inhibit-message t) (message-log-max nil) |
