galeo / corfu-doc

Documentation popup for Corfu
GNU General Public License v3.0
64 stars 4 forks source link

Strange behavior when trying to complete after using corfu-quit #20

Closed qwekjh closed 1 year ago

qwekjh commented 2 years ago

I noticed a behavior I cannot explain, which I will try to demonstrate below:

In the *scratch* buffer, I type y-[completion-at-point]:

image

Now, I will quit this completion with corfu-quit, and then try to complete at point (invoke completion-at-point) again, but now there is no corfu popup:

image

Repeating this process (of completing and quitting) would yield the above results, alternating between the two.

I do not have any special configuration (only the add-hook form from the README).

Why does this happen?

The reason I post this question here is because it happens only when corfu-doc-mode is enabled.

galeo commented 2 years ago

Could you provide an operation video? Can the candidates popup be displayed normally when corfu-doc is turned off?

Please give me instructions from Emacs -Q, your configuration etc. It should be a minimal reproducible example, a way that I can reproduce your error.

qwekjh commented 2 years ago

Could you provide an operation video? Can the candidates popup be displayed normally when corfu-doc is turned off?

Yes, candidates popup is displayed normally when corfu-doc is turned off.

Please give me instructions from Emacs -Q, your configuration etc. It should be a minimal reproducible example, a way that I can reproduce your error.

Well, I have done some testing, and I have some strange discoveries. I use straight.el in my configuration, but I also tested it with package.el:

;;; Basic configuration, before attempting to reproduce the behavior.
;;; Testing either package.el or straight.el per emacs -Q session.

;; package.el

(progn
  (require 'package)
  (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
  (package-initialize)
  (package-refresh-contents)
  (package-install 'corfu)
  (package-install 'corfu-doc)
  (package-install 'orderless)
  (setq completion-styles '(orderless))
  (setq tab-always-indent 'complete)
  (setq corfu-auto-prefix 2)
  (global-corfu-mode)
  (corfu-doc-mode))

;; straight.el

(progn
  ;; straight.el's bootstrap script
  (defvar bootstrap-version)
  (let ((bootstrap-file
     (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
    (bootstrap-version 5))
    (unless (file-exists-p bootstrap-file)
      (with-current-buffer
          (url-retrieve-synchronously
           "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
           'silent 'inhibit-cookies)
    (goto-char (point-max))
    (eval-print-last-sexp)))
    (load bootstrap-file nil 'nomessage))
  (straight-use-package 'corfu)
  (straight-use-package 'corfu-doc)
  (straight-use-package 'orderless)
  (setq completion-styles '(orderless))
  (setq tab-always-indent 'complete)
  (setq corfu-auto-prefix 2)
  (global-corfu-mode)
  (corfu-doc-mode))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; The test itself, typing "(y-" and then alternating between `completion-at-point' and `corfu-quit' calls.

I have tested these configurations on 2 machines (Windows 10 host and Linux (Fedora 35) VM).

package.el


With package.el, on both machines all is normal:

normal

straight.el

With straight.el, each machine behaves differently:

Windows 10 host


windows_straight

Linux (Fedora 35) VM


fedora_straight

Other than the blank corfu-doc popup in the second invocation (which I don't know why it happens, it also happens when using package.el, but it is not the issue discussed here), all is normal.


Again, all is normal when corfu-doc is turned off.

Is my provided configuration OK? Can I provide any additional information?

galeo commented 2 years ago

Is my provided configuration OK? Can I provide any additional information?

Maybe it's enough. But I don't use straight.el, I don't know the difference between it and package.el. Since using package.el is normal, maybe it has something to do with using straight.el on windows. I don't have a windows machine to test the configuration you provided. You can try to explore more, or someone else can help with the test.

galeo commented 1 year ago

Close this issue, please use the new corfu-docframe, which is an extension of corfu.