summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mendler <mail@daniel-mendler.de>2023-04-13 10:13:13 +0200
committerDaniel Mendler <mail@daniel-mendler.de>2023-04-13 10:13:13 +0200
commit8d3bc554664d1a86265c15bd45cebbbacd6aa0ed (patch)
tree9ad086959363d8804be86f1fd15f13d32a0e886f
parentb2a04531b37c8190d3aeb385cf197b19c3eccf0b (diff)
Improve cape--cached-table
-rw-r--r--cape.el15
1 files changed, 7 insertions, 8 deletions
diff --git a/cape.el b/cape.el
index 9f1ed7d..f897f62 100644
--- a/cape.el
+++ b/cape.el
@@ -233,19 +233,18 @@ became invalid."
(lambda (str pred action)
;; Bail out early for `metadata' and `boundaries'. This is a pointless
;; move because of caching, but we do it anyway in the hope that the
- ;; resulting profiler output looks less confusing, since the weight of the
- ;; expensive FUN computation is moved to the `all-completions' action.
- ;; Computing `all-completions' must surely be most expensive, so nobody
- ;; will suspect a thing.
+ ;; profiler report looks less confusing, since the weight of the expensive
+ ;; FUN computation is moved to the `all-completions' action. Computing
+ ;; `all-completions' must surely be most expensive, so nobody will suspect
+ ;; a thing.
(unless (or (eq action 'metadata) (eq (car-safe action) 'boundaries))
(let ((new-input (buffer-substring-no-properties beg end)))
(when (or (eq input 'init)
(not (or (string-match-p "\\s-" new-input) ;; Support Orderless
(funcall valid input new-input))))
- ;; We have to make sure that the completion table is interruptible.
- ;; An interruption should not happen between the setqs.
- (setq table (funcall fun new-input)
- input new-input)))
+ (let ((new-table (funcall fun new-input))
+ (throw-on-input nil)) ;; No interrupt during state update
+ (setq table new-table input new-input))))
(complete-with-action action table str pred)))))
;;;; Capfs