minad / corfu

:desert_island: corfu.el - COmpletion in Region FUnction
GNU General Public License v3.0
1.15k stars 43 forks source link

Corfu not working with python-mode ``‘corfu--auto-complete-deferred’: (wrong-type-argument listp my-python-face)`` #340

Closed M1ndo closed 1 year ago

M1ndo commented 1 year ago

I've been using corfu with orderless + cape for the past weeks and its been working really well, suddenly after i updated some packages. Corfu doesn't wanna work anymore with python-mode no completion whatsoever, it works with other prog-modes and other modes. Using doom emacs on Emacs 29.0.90 my corfu config

Debugger entered--Lisp error: (wrong-type-argument listp my-python-face)
  corfu--make-buffer(" *corfu*")
  #f(compiled-function (pos off width lines &optional curr lo bar) #<bytecode 0x4e934e10d5c8f98>)(771 3 50 (#(" * CLD_CONTINUED    ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 16 ... 39 50 ...) #(" * CLD_DUMPED       ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 13 ... 39 50 ...) #(" * CLD_EXITED       ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 13 ... 39 50 ...) #(" * CLD_KILLED       ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 13 ... 39 50 ...) #(" * CLD_STOPPED      ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 14 ... 39 50 ...) #(" * CLD_TRAPPED      ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 14 ... 39 50 ...) #(" * DirEntry         ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 11 ... 42 50 ...) #(" * EX_CANTCREAT     ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 15 ... 39 50 ...) #(" * EX_CONFIG        ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 12 ... 39 50 ...) #(" * EX_DATAERR       ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 13 ... 39 50 ...)) 0 0 1)
  apply(#f(compiled-function (pos off width lines &optional curr lo bar) #<bytecode 0x4e934e10d5c8f98>) (771 3 50 (#(" * CLD_CONTINUED          ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 16 ... 39 50 ...) #(" * CLD_DUMPED             ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 13 ... 39 50 ...) #(" * CLD_EXITED             ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 13 ... 39 50 ...) #(" * CLD_KILLED             ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 13 ... 39 50 ...) #(" * CLD_STOPPED            ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 14 ... 39 50 ...) #(" * CLD_TRAPPED            ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 14 ... 39 50 ...) #(" * DirEntry               ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 11 ... 42 50 ...) #(" * EX_CANTCREAT           ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 15 ... 39 50 ...) #(" * EX_CONFIG              ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 12 ... 39 50 ...) #(" * EX_DATAERR             ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 13 ... 39 50 ...)) 0 0 1))
  #f(compiled-function (&rest args) #<bytecode 0x7d35fbe24244f59>)()
  #f(compiled-function (cl--cnm pos off width lines &optional curr lo bar) #<bytecode 0x7ef52e59ef0c6b1>)(#f(compiled-function (&rest args) #<bytecode 0x7d35fbe24244f59>) 771 3 50 (#(" * CLD_CONTINUED    ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 16 ... 39 50 ...) #(" * CLD_DUMPED       ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 13 ... 39 50 ...) #(" * CLD_EXITED       ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 13 ... 39 50 ...) #(" * CLD_KILLED       ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 13 ... 39 50 ...) #(" * CLD_STOPPED      ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 14 ... 39 50 ...) #(" * CLD_TRAPPED      ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 14 ... 39 50 ...) #(" * DirEntry         ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 11 ... 42 50 ...) #(" * EX_CANTCREAT     ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 15 ... 39 50 ...) #(" * EX_CONFIG        ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 12 ... 39 50 ...) #(" * EX_DATAERR       ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 13 ... 39 50 ...)) 0 0 1)
  apply(#f(compiled-function (cl--cnm pos off width lines &optional curr lo bar) #<bytecode 0x7ef52e59ef0c6b1>) #f(compiled-function (&rest args) #<bytecode 0x7d35fbe24244f59>) (771 3 50 (#(" * CLD_CONTINUED          ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 16 ... 39 50 ...) #(" * CLD_DUMPED             ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 13 ... 39 50 ...) #(" * CLD_EXITED             ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 13 ... 39 50 ...) #(" * CLD_KILLED             ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 13 ... 39 50 ...) #(" * CLD_STOPPED            ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 14 ... 39 50 ...) #(" * CLD_TRAPPED            ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 14 ... 39 50 ...) #(" * DirEntry               ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 11 ... 42 50 ...) #(" * EX_CANTCREAT           ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 15 ... 39 50 ...) #(" * EX_CONFIG              ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 12 ... 39 50 ...) #(" * EX_DATAERR             ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 13 ... 39 50 ...)) 0 0 1))
  #f(compiled-function (pos off width lines &optional curr lo bar) "Show popup at OFF columns before POS.\n\nShow LINES, a list of lines.  Highlight CURRth line as current\nselection.  Show a vertical scroll bar of size BAR + 1 from LOth line.\n\nIf `corfu-terminal-disable-on-gui' is non-nil and  `display-graphic-p'\nreturns non-nil then call FN instead, where FN should be the original\ndefinition in Corfu." #<bytecode -0x13a27643b1c461be>)(771 3 50 (#(" * CLD_CONTINUED    ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 16 ... 39 50 ...) #(" * CLD_DUMPED       ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 13 ... 39 50 ...) #(" * CLD_EXITED       ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 13 ... 39 50 ...) #(" * CLD_KILLED       ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 13 ... 39 50 ...) #(" * CLD_STOPPED      ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 14 ... 39 50 ...) #(" * CLD_TRAPPED      ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 14 ... 39 50 ...) #(" * DirEntry         ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 11 ... 42 50 ...) #(" * EX_CANTCREAT     ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 15 ... 39 50 ...) #(" * EX_CONFIG        ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 12 ... 39 50 ...) #(" * EX_DATAERR       ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 13 ... 39 50 ...)) 0 0 1)
  apply(#f(compiled-function (pos off width lines &optional curr lo bar) "Show popup at OFF columns before POS.\n\nShow LINES, a list of lines.  Highlight CURRth line as current\nselection.  Show a vertical scroll bar of size BAR + 1 from LOth line.\n\nIf `corfu-terminal-disable-on-gui' is non-nil and  `display-graphic-p'\nreturns non-nil then call FN instead, where FN should be the original\ndefinition in Corfu." #<bytecode -0x13a27643b1c461be>) (771 3 50 (#(" * CLD_CONTINUED          ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 16 ... 39 50 ...) #(" * CLD_DUMPED             ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 13 ... 39 50 ...) #(" * CLD_EXITED             ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 13 ... 39 50 ...) #(" * CLD_KILLED             ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 13 ... 39 50 ...) #(" * CLD_STOPPED            ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 14 ... 39 50 ...) #(" * CLD_TRAPPED            ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 14 ... 39 50 ...) #(" * DirEntry               ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 11 ... 42 50 ...) #(" * EX_CANTCREAT           ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 15 ... 39 50 ...) #(" * EX_CONFIG              ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 12 ... 39 50 ...) #(" * EX_DATAERR             ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 13 ... 39 50 ...)) 0 0 1))
  corfu--popup-show(771 3 50 (#(" * CLD_CONTINUED    ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 16 ... 39 50 ...) #(" * CLD_DUMPED       ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 13 ... 39 50 ...) #(" * CLD_EXITED       ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 13 ... 39 50 ...) #(" * CLD_KILLED       ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 13 ... 39 50 ...) #(" * CLD_STOPPED      ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 14 ... 39 50 ...) #(" * CLD_TRAPPED      ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 14 ... 39 50 ...) #(" * DirEntry         ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 11 ... 42 50 ...) #(" * EX_CANTCREAT     ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 15 ... 39 50 ...) #(" * EX_CONFIG        ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 12 ... 39 50 ...) #(" * EX_DATAERR       ..." 0 1 ... 1 2 ... 2 3 ... 3 4 ... 4 13 ... 39 50 ...)) 0 0 1)
  corfu--candidates-popup(#<marker at 771 in instman.py>)
  #f(compiled-function (&optional auto) #<bytecode 0x1769ffac81dded43>)(auto)
  apply(#f(compiled-function (&optional auto) #<bytecode 0x1769ffac81dded43>) auto)
  #f(compiled-function (&rest args) #<bytecode -0x1c6e755480c4a4e1>)(auto)
  apply(#f(compiled-function (&rest args) #<bytecode -0x1c6e755480c4a4e1>) auto)
  #f(compiled-function (&rest args) #<bytecode -0x491f0a56d62e94>)(auto)
  apply(#f(compiled-function (&rest args) #<bytecode -0x491f0a56d62e94>) auto)
  corfu--exhibit(auto)
  corfu--auto-complete-deferred((#<window 7 on instman.py> #<buffer instman.py> 56475 773))
  apply(corfu--auto-complete-deferred (#<window 7 on instman.py> #<buffer instman.py> 56475 773))
  timer-event-handler([t 25746 9494 132345 nil corfu--auto-complete-deferred ((#<window 7 on instman.py> #<buffer instman.py> 56475 773)) nil 626000 nil])
minad commented 1 year ago

Hi, please narrow down the problem first to a minimal configuration starting from emacs -Q. Thanks!

M1ndo commented 1 year ago

Hi, please narrow down the problem first to a minimal configuration starting from emacs -Q. Thanks!

Hi, Apologies for the previous messy report, i've been debugging this and turns out recently i remapped the default face with a custom one only for python-mode. However still this should work but it doesn't and its something has to do with corfu-popup

(defface my-python-face '((t (:inherit default :family "Iosevka Term" :size 11)))
  "Face for Python mode."
  :group 'basic-faces)
(add-hook 'python-mode-hook
          (lambda ()
            (setq-local face-remapping-alist '((default . my-python-face)))))
minad commented 1 year ago

It seems your remapping is incompatible with Corfu's assumptions. You can try instead ((default my-python-face)).

M1ndo commented 1 year ago

It seems your remapping is incompatible with Corfu's assumptions. You can try instead ((default my-python-face)).

Thanks, it worked really well.