Closed vadim-zyamalov closed 2 years ago
Looks like your :company-kind
is not returning a function, but something else. What completion backend are you using here? Try M-x trace-function kind-icon-margin-formatter[Ret]
, attempt a completion, and show the trace output.
If no mention of company-kind there, you can also evaluate this (e.g. in the *scratch*
buffer):
(advice-add 'kind-icon-margin-formatter :before
(defalias 'my/kimf-msg
(lambda (metadata)
(message "Got Company kind %S" (kind-icon--metadata-get
metadata "company-kind")))))
try a complete, and check your message output.
I use lsp-mode
as a backend.
The result of trace-function
is
1 -> (kind-icon-margin-formatter (metadata)) 1 <- kind-icon-margin-formatter: !non-local\ exit!
When I try to eval the chunk you provided I receive the following (in *Messages*
buffer)
the function `kind-icon--metadata-get' is not known to be defined.
But when I enter trace-function [RET]
this function is presented.
If I explicidly trace kind-icon--metadata-get
1 -> (kind-icon-margin-formatter (metadata)) | 2 -> (kind-icon--metadata-get (metadata) "company-kind") | 2 <- kind-icon--metadata-get: nil 1 <- kind-icon-margin-formatter: !non-local\ exit!
P.S. My init.el
. Maybe there is some packages conflict...
init.zip
This is strange. Does company show icons?
The non-local exit is the real problem; there is a bug somewhere. Normally emacs swallows errors from post-command hooks. Here is a way to allow the error to get reported:
(advice-add 'corfu--post-command :around
(lambda (func)
(condition-case err
(funcall func)
((debug error) (signal (car err) (cdr err))))))
Eval that, and M-x toggle-debug-on-error
, try completion, and let me know what the traceback says.
Sure! That's in SCRATCH buffer
Debugger entered--Lisp error: (invalid-function (kind-func (kind-icon--metadata-get metadata "company-kind")))
(kind-func (kind-icon--metadata-get metadata "company-kind"))()
kind-icon-margin-formatter((metadata))
run-hook-with-args-until-success(kind-icon-margin-formatter (metadata))
corfu--affixate((#("user-uid" 0 3 (face orderless-match-face-0)) #("user-ptrp" 0 3 (face orderless-match-face-0)) #("user-error" 0 3 (face orderless-match-face-0)) #("use-package" 0 3 (face orderless-match-face-0)) #("use-region-p" 0 3 (face orderless-match-face-0)) #("use-local-map" 0 3 (face orderless-match-face-0)) #("user-real-uid" 0 3 (face orderless-match-face-0)) #("use-global-map" 0 3 (face orderless-match-face-0)) #("user-full-name" 0 3 (face orderless-match-face-0)) #("user-login-name" 0 3 (face orderless-match-face-0))))
corfu--candidates-popup(#<marker at 341 in *scratch*>)
corfu--update()
#f(compiled-function () #<bytecode 0x22f7161>)()
funcall(#f(compiled-function () #<bytecode 0x22f7161>))
(condition-case err (funcall func) ((debug error) (signal (car err) (cdr err))))
(closure (t) (func) (condition-case err (funcall func) ((debug error) (signal (car err) (cdr err)))))(#f(compiled-function () #<bytecode 0x22f7161>))
apply((closure (t) (func) (condition-case err (funcall func) ((debug error) (signal (car err) (cdr err))))) #f(compiled-function () #<bytecode 0x22f7161>) nil)
corfu--post-command()
And that's in Python file (with lsp-pyright):
Debugger entered--Lisp error: (invalid-function (kind-func (kind-icon--metadata-get metadata "company-kind")))
(kind-func (kind-icon--metadata-get metadata "company-kind"))()
kind-icon-margin-formatter((metadata (category . lsp-capf) (display-sort-function . identity) (cycle-sort-function . identity)))
run-hook-with-args-until-success(kind-icon-margin-formatter (metadata (category . lsp-capf) (display-sort-function . identity) (cycle-sort-function . identity)))
corfu--affixate((#("def" 0 1 (face ... match-data ... lsp-completion-prefix "de" lsp-completion-markers ... lsp-completion-start-point 794 lsp-sort-text "07.9999.def" lsp-completion-item #<hash-table equal 4/4 0x29f92bd>) 1 3 (match-data ... lsp-completion-prefix "de" lsp-completion-markers ... lsp-completion-start-point 794 lsp-sort-text "07.9999.def" lsp-completion-item #<hash-table equal 4/4 0x29f92bd>)) #("del" 0 1 (face ... match-data ... lsp-completion-prefix "de" lsp-completion-markers ... lsp-completion-start-point 794 lsp-sort-text "07.9999.del" lsp-completion-item #<hash-table equal 4/4 0x29f9315>) 1 3 (match-data ... lsp-completion-prefix "de" lsp-completion-markers ... lsp-completion-start-point 794 lsp-sort-text "07.9999.del" lsp-completion-item #<hash-table equal 4/4 0x29f9315>)) #("delattr" 0 1 (face ... match-data ... lsp-completion-prefix "de" lsp-completion-markers ... lsp-completion-start-point 794 lsp-sort-text "09.9999.delattr" lsp-completion-item #<hash-table equal 5/6 0x2bb3441>) 1 7 (match-data ... lsp-completion-prefix "de" lsp-completion-markers ... lsp-completion-start-point 794 lsp-sort-text "09.9999.delattr" lsp-completion-item #<hash-table equal 5/6 0x2bb3441>)) #("detect_scanners" 0 1 (face ... match-data ... lsp-completion-prefix "de" lsp-completion-markers ... lsp-completion-start-point 794 lsp-sort-text "09.9999.detect_scanners" lsp-completion-item #<hash-table equal 5/6 0x2b731a5>) 1 15 (match-data ... lsp-completion-prefix "de" lsp-completion-markers ... lsp-completion-start-point 794 lsp-sort-text "09.9999.detect_scanners" lsp-completion-item #<hash-table equal 5/6 0x2b731a5>)) #("defpath" 0 1 (face ... match-data ... lsp-completion-prefix "de" lsp-completion-markers ... lsp-completion-start-point 794 lsp-sort-text "12.9999.defpath" lsp-completion-item #<hash-table equal 8/10 0x2bbc529>) 1 7 (match-data ... lsp-completion-prefix "de" lsp-completion-markers ... lsp-completion-start-point 794 lsp-sort-text "12.9999.defpath" lsp-completion-item #<hash-table equal 8/10 0x2bbc529>)) #("device_encoding" 0 1 (face ... match-data ... lsp-completion-prefix "de" lsp-completion-markers ... lsp-completion-start-point 794 lsp-sort-text "12.9999.device_encoding" lsp-completion-item #<hash-table equal 8/10 0x267c2f9>) 1 15 (match-data ... lsp-completion-prefix "de" lsp-completion-markers ... lsp-completion-start-point 794 lsp-sort-text "12.9999.device_encoding" lsp-completion-item #<hash-table equal 8/10 0x267c2f9>)) #("devnull" 0 1 (face ... match-data ... lsp-completion-prefix "de" lsp-completion-markers ... lsp-completion-start-point 794 lsp-sort-text "12.9999.devnull" lsp-completion-item #<hash-table equal 8/10 0x2bbc801>) 1 7 (match-data ... lsp-completion-prefix "de" lsp-completion-markers ... lsp-completion-start-point 794 lsp-sort-text "12.9999.devnull" lsp-completion-item #<hash-table equal 8/10 0x2bbc801>)) #("DeprecationWarning" 0 1 (face ... match-data ... lsp-completion-prefix "de" lsp-completion-markers ... lsp-completion-start-point 794 lsp-sort-text "09.9999.DeprecationWarning" lsp-completion-item #<hash-table equal 5/6 0x29f0225>) 1 18 (match-data ... lsp-completion-prefix "de" lsp-completion-markers ... lsp-completion-start-point 794 lsp-sort-text "09.9999.DeprecationWarning" lsp-completion-item #<hash-table equal 5/6 0x29f0225>)) #("DefaultDict" 0 1 (face ... match-data ... lsp-completion-prefix "de" lsp-completion-markers ... lsp-completion-start-point 794 lsp-sort-text "12.9999.DefaultDict" lsp-completion-item #<hash-table equal 8/10 0x29f936d>) 1 11 (match-data ... lsp-completion-prefix "de" lsp-completion-markers ... lsp-completion-start-point 794 lsp-sort-text "12.9999.DefaultDict" lsp-completion-item #<hash-table equal 8/10 0x29f936d>)) #("Deque" 0 1 (face ... match-data ... lsp-completion-prefix "de" lsp-completion-markers ... lsp-completion-start-point 794 lsp-sort-text "12.9999.Deque" lsp-completion-item #<hash-table equal 8/10 0x2bbf309>) 1 5 (match-data ... lsp-completion-prefix "de" lsp-completion-markers ... lsp-completion-start-point 794 lsp-sort-text "12.9999.Deque" lsp-completion-item #<hash-table equal 8/10 0x2bbf309>))))
corfu--candidates-popup(#<marker at 794 in part1.py>)
corfu--update()
#f(compiled-function () #<bytecode 0x22fed75>)()
funcall(#f(compiled-function () #<bytecode 0x22fed75>))
(condition-case err (funcall func) ((debug error) (signal (car err) (cdr err))))
(closure (t) (func) (condition-case err (funcall func) ((debug error) (signal (car err) (cdr err)))))(#f(compiled-function () #<bytecode 0x22fed75>))
apply((closure (t) (func) (condition-case err (funcall func) ((debug error) (signal (car err) (cdr err))))) #f(compiled-function () #<bytecode 0x22fed75>) nil)
corfu--post-command()
BTW, company shows icons, but i think that are its own icons (there is a folder with VS icons in its repo).
Something is wrong with the let-form in the margin-formatter. Check this line in your version to make sure it looks the same. You can M-x find-library kind-icon to see.
One other idea: C-h f if-let
and see where your if-let
is from. Should read if-let is a Lisp macro in ‘subr-x.el’.
.
I've tried both. Everything is as it should be. I even wiped everything off and installed all packages again. But corfu sub-frame is not shown, however it starts, because I'm able to select completions with my hotkeys and insert them.
I've tried it also on my Debian laptop, same result.
Can you reproduce this from emacs -Q, loading just corfu, kind-icon, and lsp-mode? Also, what package is if-let from? I forgot to require subr-x
, so I suspect your init loads another. You could also test this by editing the very top of kind-icon to read:
(eval-when-compile
(require 'subr-x))
(require 'svg-lib nil 'noerror)
...
Then M-x emacs-lisp-byte-compile-and-load
.
I forgot to require subr-x, so I suspect your init loads another. You could also test this by editing the very top of kind-icon to read:
(eval-when-compile (require 'subr-x)) (require 'svg-lib nil 'noerror) ...
Then
M-x emacs-lisp-byte-compile-and-load
.
Bingo!
Thank you for your help!
Great, must be one of your other packages hard-codes the old if-let syntax (which was for only one binding). Fixed in 6e0e0c5.
Hello! I have a problem with
kind-icon
.I've installed it using margin-formatters. When I try to invoke
corfu
I receive the following errorThe
corfu
is not visible but it works as it pastes completion variants.Emacs 27.2 on Win10.
kind-icon
andcorfu
are installed viastraight.el
. Freshly reinstalled 10 minutes ago.