diff options
| author | Daniel Mendler <mail@daniel-mendler.de> | 2024-11-26 10:42:28 +0100 |
|---|---|---|
| committer | Daniel Mendler <mail@daniel-mendler.de> | 2024-11-26 10:42:28 +0100 |
| commit | 94d573f314bac164b3cfc08a2cbc7d248009cf41 (patch) | |
| tree | 30826b2a10f187edf05323bf191066c838a47d80 /corfu.el | |
| parent | eaf3d9cbb647705efa5fe70de108776622319d96 (diff) | |
Use when instead of if
Diffstat (limited to 'corfu.el')
| -rw-r--r-- | corfu.el | 28 |
1 files changed, 14 insertions, 14 deletions
@@ -992,20 +992,20 @@ See `completion-in-region' for the arguments BEG, END, TABLE, PRED." (defun corfu--auto-post-command () "Post command hook which initiates auto completion." (cancel-timer corfu--auto-timer) - (if (and (not completion-in-region-mode) - (not defining-kbd-macro) - (not buffer-read-only) - (corfu--match-symbol-p corfu-auto-commands this-command) - (corfu--popup-support-p)) - (if (<= corfu-auto-delay 0) - (corfu--auto-complete-deferred) - ;; Do not use `timer-set-idle-time' since this leads to - ;; unpredictable pauses, in particular with `flyspell-mode'. - (timer-set-time corfu--auto-timer - (timer-relative-time nil corfu-auto-delay)) - (timer-set-function corfu--auto-timer #'corfu--auto-complete-deferred - (list (corfu--auto-tick))) - (timer-activate corfu--auto-timer)))) + (when (and (not completion-in-region-mode) + (not defining-kbd-macro) + (not buffer-read-only) + (corfu--match-symbol-p corfu-auto-commands this-command) + (corfu--popup-support-p)) + (if (<= corfu-auto-delay 0) + (corfu--auto-complete-deferred) + ;; Do not use `timer-set-idle-time' since this leads to + ;; unpredictable pauses, in particular with `flyspell-mode'. + (timer-set-time corfu--auto-timer + (timer-relative-time nil corfu-auto-delay)) + (timer-set-function corfu--auto-timer #'corfu--auto-complete-deferred + (list (corfu--auto-tick))) + (timer-activate corfu--auto-timer)))) (defun corfu--auto-tick () "Return the current tick/status of the buffer. |
