From 98720451918cb33a345021ce0f1541acbb4c918b Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Mon, 17 Apr 2023 18:46:52 +0200 Subject: add while-no-input call to capfs --- lisp/mastodon-toot.el | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index c2c391d..e7cf22c 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -996,7 +996,12 @@ If TAGS, we search for tags, else we search for handles." ;; only search when necessary: (completion-table-dynamic (lambda (_) - (mastodon-toot--fetch-completion-candidates start end))) + ;; Interruptible candidate computation + ;; suggestion from minad (d mendler), thanks! + (let ((result + (while-no-input + (mastodon-toot--fetch-completion-candidates start end)))) + (and (consp result) result)))) :exclusive 'no :annotation-function (lambda (candidate) @@ -1015,7 +1020,12 @@ If TAGS, we search for tags, else we search for handles." ;; only search when necessary: (completion-table-dynamic (lambda (_) - (mastodon-toot--fetch-completion-candidates start end :tags))) + ;; Interruptible candidate computation + ;; suggestion from minad (d mendler), thanks! + (let ((result + (while-no-input + (mastodon-toot--fetch-completion-candidates start end :tags)))) + (and (consp result) result)))) :exclusive 'no :annotation-function (lambda (candidate) -- cgit v1.2.3