1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-22 05:31:01 -08:00

Make icomplete less blinky and more responsive

* lisp/icomplete.el (icomplete-pre-command-hook, icomplete-tidy):
Remove, update the callers
(https://lists.gnu.org/archive/html/emacs-devel/2021-06/msg00111.html).
(icomplete-compute-delay): Change the default to 150ms.
(icomplete-max-delay-chars): Change the default to 2.
This commit is contained in:
Dmitry Gutov 2021-06-05 03:56:33 +03:00
parent 7b50ed553f
commit 8d5b7f519f
2 changed files with 12 additions and 16 deletions

View file

@ -549,6 +549,16 @@ Icomplete, completions are rotated and selection kept at the top.
When used with Fido, completions scroll like a typical dropdown When used with Fido, completions scroll like a typical dropdown
widget. widget.
*** Default value of 'icomplete-compute-delay has been changed to 0.15 s.
*** Default value of 'icomplete-max-delay-chars' has been changed to 2.
*** Reduced blinking while completing the next completions set.
Icomplete doesn't hide the hint with the previously computed
completions anymore when compute delay is in effect, or the previous
computation has been aborted by input. Instead it shows the previous
completions until the new ones are ready.
--- ---
** Specific warnings can now be disabled from the warning buffer. ** Specific warnings can now be disabled from the warning buffer.
When a warning is displayed to the user, the resulting buffer now has When a warning is displayed to the user, the resulting buffer now has

View file

@ -115,7 +115,7 @@ Otherwise this should be a list of the completion tables (e.g.,
:type 'integer :type 'integer
:version "26.1") :version "26.1")
(defcustom icomplete-compute-delay .3 (defcustom icomplete-compute-delay .15
"Completions-computation stall, used only with large-number completions. "Completions-computation stall, used only with large-number completions.
See `icomplete-delay-completions-threshold'." See `icomplete-delay-completions-threshold'."
:type 'number) :type 'number)
@ -124,7 +124,7 @@ See `icomplete-delay-completions-threshold'."
"Pending-completions number over which to apply `icomplete-compute-delay'." "Pending-completions number over which to apply `icomplete-compute-delay'."
:type 'integer) :type 'integer)
(defcustom icomplete-max-delay-chars 3 (defcustom icomplete-max-delay-chars 2
"Maximum number of initial chars to apply `icomplete-compute-delay'." "Maximum number of initial chars to apply `icomplete-compute-delay'."
:type 'integer) :type 'integer)
@ -158,10 +158,6 @@ icompletion is occurring."
"Initial input in the minibuffer when icomplete-mode was activated. "Initial input in the minibuffer when icomplete-mode was activated.
Used to implement the option `icomplete-show-matches-on-no-input'.") Used to implement the option `icomplete-show-matches-on-no-input'.")
(defun icomplete-pre-command-hook ()
(let ((non-essential t))
(icomplete-tidy)))
(defun icomplete-post-command-hook () (defun icomplete-post-command-hook ()
(let ((non-essential t)) ;E.g. don't prompt for password! (let ((non-essential t)) ;E.g. don't prompt for password!
(icomplete-exhibit))) (icomplete-exhibit)))
@ -490,7 +486,6 @@ Usually run by inclusion in `minibuffer-setup-hook'."
(setq icomplete--scrolled-completions nil) (setq icomplete--scrolled-completions nil)
(use-local-map (make-composed-keymap icomplete-minibuffer-map (use-local-map (make-composed-keymap icomplete-minibuffer-map
(current-local-map))) (current-local-map)))
(add-hook 'pre-command-hook #'icomplete-pre-command-hook nil t)
(add-hook 'post-command-hook #'icomplete-post-command-hook nil t) (add-hook 'post-command-hook #'icomplete-post-command-hook nil t)
(run-hooks 'icomplete-minibuffer-setup-hook))) (run-hooks 'icomplete-minibuffer-setup-hook)))
@ -504,7 +499,6 @@ Usually run by inclusion in `minibuffer-setup-hook'."
(setq icomplete--in-region-buffer nil) (setq icomplete--in-region-buffer nil)
(delete-overlay icomplete-overlay) (delete-overlay icomplete-overlay)
(kill-local-variable 'completion-show-inline-help) (kill-local-variable 'completion-show-inline-help)
(remove-hook 'pre-command-hook 'icomplete-pre-command-hook t)
(remove-hook 'post-command-hook 'icomplete-post-command-hook t) (remove-hook 'post-command-hook 'icomplete-post-command-hook t)
(message nil))) (message nil)))
(when (and completion-in-region-mode (when (and completion-in-region-mode
@ -516,7 +510,6 @@ Usually run by inclusion in `minibuffer-setup-hook'."
(unless (memq icomplete-minibuffer-map (cdr tem)) (unless (memq icomplete-minibuffer-map (cdr tem))
(setcdr tem (make-composed-keymap icomplete-minibuffer-map (setcdr tem (make-composed-keymap icomplete-minibuffer-map
(cdr tem))))) (cdr tem)))))
(add-hook 'pre-command-hook 'icomplete-pre-command-hook nil t)
(add-hook 'post-command-hook 'icomplete-post-command-hook nil t))) (add-hook 'post-command-hook 'icomplete-post-command-hook nil t)))
(defun icomplete--sorted-completions () (defun icomplete--sorted-completions ()
@ -640,13 +633,6 @@ resized depends on `resize-mini-windows'."
;;;_* Completion ;;;_* Completion
;;;_ > icomplete-tidy ()
(defun icomplete-tidy ()
"Remove completions display (if any) prior to new user input.
Should be run in on the minibuffer `pre-command-hook'.
See `icomplete-mode' and `minibuffer-setup-hook'."
(delete-overlay icomplete-overlay))
;;;_ > icomplete-exhibit () ;;;_ > icomplete-exhibit ()
(defun icomplete-exhibit () (defun icomplete-exhibit ()
"Insert Icomplete completions display. "Insert Icomplete completions display.