From 8d5b7f519f18ed73f26adff275e3bd580bacf36c Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Sat, 5 Jun 2021 03:56:33 +0300 Subject: [PATCH] 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. --- etc/NEWS | 10 ++++++++++ lisp/icomplete.el | 18 ++---------------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index d10fc5f2a1d..e782603f0b2 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -549,6 +549,16 @@ Icomplete, completions are rotated and selection kept at the top. When used with Fido, completions scroll like a typical dropdown 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. When a warning is displayed to the user, the resulting buffer now has diff --git a/lisp/icomplete.el b/lisp/icomplete.el index 99896a48223..03a191cb0b6 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el @@ -115,7 +115,7 @@ Otherwise this should be a list of the completion tables (e.g., :type 'integer :version "26.1") -(defcustom icomplete-compute-delay .3 +(defcustom icomplete-compute-delay .15 "Completions-computation stall, used only with large-number completions. See `icomplete-delay-completions-threshold'." :type 'number) @@ -124,7 +124,7 @@ See `icomplete-delay-completions-threshold'." "Pending-completions number over which to apply `icomplete-compute-delay'." :type 'integer) -(defcustom icomplete-max-delay-chars 3 +(defcustom icomplete-max-delay-chars 2 "Maximum number of initial chars to apply `icomplete-compute-delay'." :type 'integer) @@ -158,10 +158,6 @@ icompletion is occurring." "Initial input in the minibuffer when icomplete-mode was activated. 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 () (let ((non-essential t)) ;E.g. don't prompt for password! (icomplete-exhibit))) @@ -490,7 +486,6 @@ Usually run by inclusion in `minibuffer-setup-hook'." (setq icomplete--scrolled-completions nil) (use-local-map (make-composed-keymap icomplete-minibuffer-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) (run-hooks 'icomplete-minibuffer-setup-hook))) @@ -504,7 +499,6 @@ Usually run by inclusion in `minibuffer-setup-hook'." (setq icomplete--in-region-buffer nil) (delete-overlay icomplete-overlay) (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) (message nil))) (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)) (setcdr tem (make-composed-keymap icomplete-minibuffer-map (cdr tem))))) - (add-hook 'pre-command-hook 'icomplete-pre-command-hook nil t) (add-hook 'post-command-hook 'icomplete-post-command-hook nil t))) (defun icomplete--sorted-completions () @@ -640,13 +633,6 @@ resized depends on `resize-mini-windows'." ;;;_* 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 () (defun icomplete-exhibit () "Insert Icomplete completions display. -- 2.39.2