summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mendler <mail@daniel-mendler.de>2024-11-26 10:42:28 +0100
committerDaniel Mendler <mail@daniel-mendler.de>2024-11-26 10:42:28 +0100
commit94d573f314bac164b3cfc08a2cbc7d248009cf41 (patch)
tree30826b2a10f187edf05323bf191066c838a47d80
parenteaf3d9cbb647705efa5fe70de108776622319d96 (diff)
Use when instead of if
-rw-r--r--corfu.el28
1 files changed, 14 insertions, 14 deletions
diff --git a/corfu.el b/corfu.el
index 67dc2e2..3081cd1 100644
--- a/corfu.el
+++ b/corfu.el
@@ -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.