-
-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issues with updating the display of the list of candidates #226
Comments
Can you reproduce this in Emacs 28? It could also be due to gtk, is this pgtk (which is unstable according to its maintainer)? The bug here seems to be that input events get lost, which should not happen. I don't investigate Emacs 29 issues currently since there is too much churn to keep up with it right now. I get Emacs 29 reports every week, yours is the Please reopen if you also observe this on Emacs 28. |
Makes sense, thank you for providing your rationale. Will reopen this issue once the next version of Emacs is out. I was using pgtk indeed. Really great for performance, but I guess it has some conflicts with vertico. Some information for the future: I set a
I suspect fixing handling this might fix the issue, but I lack the context and the elisp expertise to fix this myself. Until then, I will revert to Emacs 28, because vertico runs my life. |
It is not about conflicts between vertico and pgtk. Pgtk is just not yet stable. It has bugs and in this case it seems to lose input events. You could ask the pgtk maintainer about this. I've read that there are no performance benefits of pgtk on x11 and only moderate benefits on Wayland. |
There is no need to handle the t return value. If while-no-input terminates with t due to input, the new input should then also run the vertico--exhibit post-command-hook such that the update happens then. But Vertico should not get stuck. |
Thank you for the clarification on the design of Emacs 29 is correctly calling In the screencast, I am typing the string "not" very fast. Screencast: https://webm.red/ds8i.webm (defun vertico--exhibit ()
"Exhibit completion UI."
(let* ((buffer-undo-list t) ;; Overlays affect point position and undo list!
(pt (max 0 (- (point) (minibuffer-prompt-end))))
(content (minibuffer-contents)))
(message "in vertico--exhibit, processing %S, input-pending-p: %S" content (input-pending-p))
(unless (or (input-pending-p) (equal vertico--input (cons content pt)))
(vertico--update-candidates pt content))
(vertico--prompt-selection)
(vertico--display-count)
(vertico--display-candidates (vertico--arrange-candidates))))
(defun vertico--update-candidates (pt content)
"Preprocess candidates given PT and CONTENT."
;; Redisplay the minibuffer such that the input becomes immediately
;; visible before the expensive candidate recomputation is performed (Issue #89).
;; Do not redisplay during initialization, since this leads to flicker.
(message "in vertico--update-candidates, processing %S" content)
(when (consp vertico--input) (redisplay))
(let ((metadata (completion-metadata (substring content 0 pt)
minibuffer-completion-table
minibuffer-completion-predicate)))
(pcase
(let ((vertico--metadata metadata))
;; If Tramp is used, do not compute the candidates in an interruptible fashion,
;; since this will break the Tramp password and user name prompts (See #23).
(if (and (eq 'file (vertico--metadata-get 'category))
(or (vertico--remote-p content) (vertico--remote-p default-directory)))
(vertico--recompute-candidates pt content)
(let ((non-essential t))
(while-no-input (vertico--recompute-candidates pt content)))))
('nil (abort-recursive-edit))
('t (message "interrupted while-no-input!"))
(`(,base ,total ,def-missing ,index ,candidates ,groups ,all-groups ,hl)
(setq vertico--input (cons content pt)
vertico--index index
vertico--base base
vertico--total total
vertico--highlight-function hl
vertico--groups groups
vertico--all-groups all-groups
vertico--candidates candidates
vertico--default-missing def-missing
vertico--metadata metadata)
;; If the current index is nil, compute new index. Select the prompt:
;; * If there are no candidates
;; * If the default is missing from the candidate list.
;; * For matching content, as long as the full content after the boundary is empty,
;; including content after point.
(unless vertico--index
(setq vertico--lock-candidate nil
vertico--index
(if (or vertico--default-missing
(= 0 vertico--total)
(and (= (length base) (length content))
(test-completion content minibuffer-completion-table
minibuffer-completion-predicate)))
-1 0)))))))
|
Okay, so is this a regression in pgtk, Emacs 29? If yes, you may open a bug report via On the other hand, (defmacro my-while-no-input (&rest body)
(declare (debug t) (indent 0))
(let ((catch-sym (make-symbol "input")))
`(with-local-quit
(catch ',catch-sym
(let ((throw-on-input ',catch-sym)
val)
(setq val (progn ,@body))
(cond
((eq quit-flag throw-on-input)
(setq quit-flag nil)
t)
(quit-flag
nil)
(t val))))))) The other alternative would be to introduce a timer which makes sure that the update is enforced after a certain time if no actual input arrived in time. This has been suggested before in other situations, but I would prefer if we can stick to the simpler logic, which we have now. Note that the Emacs builtin icomplete.el package is necessarily affected of the same issue since it also uses |
I just want to clarify, I understand that pgtk is not stable, I'm trying to help them fix the bug so that it becomes stable! I greatly value the time you're spending on this issue! This is weird behavior by Emacs indeed. The macro you posted did not solve the issue. Here is a minimal reproduction (require 'cl-lib)
(defun my-hook ()
(message "%S, %S" (minibuffer-contents)
(while-no-input
(cl-loop for i from 0 below 1000000
summing i))))
(minibuffer-with-setup-hook (lambda ()
(add-hook 'post-command-hook
'my-hook
nil t))
(read-from-minibuffer "Text: ")) I have reported this as a bug, will update this issue when it's relevant. |
Very good then! I am happy to help where I can. But I don't have much free time for such things unfortunately. I am also using Emacs, not only developing packages, therefore I am always lagging a bit behind (for example I migrated to 28 just around the time where the first release candidate was tagged) 😄 |
Tracking the bug here: https://lists.gnu.org/archive/html/bug-gnu-emacs/2022-05/msg00844.html with identifier You are doing a lot already! I'll take care of this myself as much as I can. |
Hello,
I am having a problem with vertico not updating the list of candidates when I type keys in the minibuffer. The list of candidates is updated when I navigate through the list of candidates using C-n or C-p, but not before that. This occurs semi-consistently, probably due to a problem with debouncing or throttling logic if it exists?
I've included a screencast for a demo. I included the lossage at the end of the video. I am on the latest version of vertico on MELPA, the source code says 0.23. I am on the emacs master branch.
The issue might be happening when
vertico/vertico.el
Line 427 in cc5f542
Screencast: https://webm.red/t6j6.webm
The text was updated successfully, but these errors were encountered: