diff options
| author | Eshel Yaron | 2025-03-16 09:45:25 +0100 |
|---|---|---|
| committer | Eshel Yaron | 2025-03-16 09:45:25 +0100 |
| commit | b6b4a080a3abb5a45b680e26f93dd17adbb75f69 (patch) | |
| tree | 3f74449bae626fb5c4513ab08a4b2cff46a133e6 | |
| parent | 91a9d021999d78109b01bad21d3439bc2e2875cd (diff) | |
| download | emacs-b6b4a080a3abb5a45b680e26f93dd17adbb75f69.tar.gz emacs-b6b4a080a3abb5a45b680e26f93dd17adbb75f69.zip | |
Only disable 'completion-preview-active-mode' when it is on
* lisp/completion-preview.el
(completion-preview--post-command): Avoid calling
'completion-preview-active-mode' to disable the mode when
already off, since it forces a costly redisplay. (Bug#76964)
| -rw-r--r-- | lisp/completion-preview.el | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/lisp/completion-preview.el b/lisp/completion-preview.el index 1c524985f05..ae1394d27b4 100644 --- a/lisp/completion-preview.el +++ b/lisp/completion-preview.el | |||
| @@ -437,13 +437,17 @@ point, otherwise hide it." | |||
| 437 | (cancel-timer completion-preview--timer) | 437 | (cancel-timer completion-preview--timer) |
| 438 | (setq completion-preview--timer nil)) | 438 | (setq completion-preview--timer nil)) |
| 439 | 439 | ||
| 440 | ;; If we're called after a command that itself updates the | 440 | (cond |
| 441 | ;; preview, don't do anything. | 441 | (internal-p |
| 442 | (unless internal-p | 442 | ;; `this-command' took care of updating the preview. Do nothing. |
| 443 | (if (and (completion-preview-require-certain-commands) | 443 | ) |
| 444 | (completion-preview-require-minimum-symbol-length)) | 444 | ((and (completion-preview-require-certain-commands) |
| 445 | (completion-preview--show) | 445 | (completion-preview-require-minimum-symbol-length)) |
| 446 | (completion-preview-active-mode -1))))) | 446 | ;; All conditions met. Show or update the preview. |
| 447 | (completion-preview--show)) | ||
| 448 | (completion-preview-active-mode | ||
| 449 | ;; The preview is shown, but it shouldn't be. Hide it. | ||
| 450 | (completion-preview-active-mode -1))))) | ||
| 447 | 451 | ||
| 448 | (defun completion-preview-insert () | 452 | (defun completion-preview-insert () |
| 449 | "Insert the completion candidate that the preview is showing." | 453 | "Insert the completion candidate that the preview is showing." |