branch: externals/minuet
commit 6a07b00d113224a3ddf044becddc180b7f173f8d
Author: Milan Glacier <d...@milanglacier.com>
Commit: Milan Glacier <d...@milanglacier.com>

    refactor: update auto suggestion triggering condition.
---
 minuet.el | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/minuet.el b/minuet.el
index 79253c578d..610195a507 100644
--- a/minuet.el
+++ b/minuet.el
@@ -980,11 +980,23 @@ to be called when completion items arrive."
     "Setup auto-suggestion with `post-command-hook'."
     (add-hook 'post-command-hook #'minuet--maybe-show-suggestion nil t))
 
+(defun minuet--is-minuet-command ()
+    "Return t if current command is a minuet command."
+    (and this-command
+         (symbolp this-command)
+         (string-match-p "^minuet" (symbol-name this-command))
+         (message "minuet command executed")))
+
+(defun minuet--is-not-on-throttle ()
+    "Return t if current time since last time is larger than the throttle 
delay."
+    (or (null minuet--last-auto-suggestion-time)
+        (> (float-time (time-since minuet--last-auto-suggestion-time))
+           minuet-auto-suggestion-throttle-delay)))
+
 (defun minuet--maybe-show-suggestion ()
     "Show suggestion with debouncing and throttling."
-    (when (or (null minuet--last-auto-suggestion-time)
-              (> (float-time (time-since minuet--last-auto-suggestion-time))
-                 minuet-auto-suggestion-throttle-delay))
+    (when (and (minuet--is-not-on-throttle)
+               (not (minuet--is-minuet-command)))
         (when minuet--debounce-timer
             (cancel-timer minuet--debounce-timer))
         (setq minuet--debounce-timer

Reply via email to