emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/mct 29015a1699 37/64: Fix performance issues by avoidin


From: ELPA Syncer
Subject: [elpa] externals/mct 29015a1699 37/64: Fix performance issues by avoiding recursion
Date: Thu, 30 Dec 2021 23:57:59 -0500 (EST)

branch: externals/mct
commit 29015a169944e71eee846c496d8ba11d3d4678cc
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>

    Fix performance issues by avoiding recursion
---
 mct.el | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/mct.el b/mct.el
index d0e5f59a31..1ecad71fa5 100644
--- a/mct.el
+++ b/mct.el
@@ -1138,11 +1138,13 @@ region.")
 (defun mct--region-live-completions (&rest _)
   "Update the *Completions* buffer.
 Meant to be added to `after-change-functions'."
-  (while-no-input
-    (condition-case nil
-        (save-match-data
-          (mct--show-completions))
-      (quit (keyboard-quit)))))
+  (let ((buf (window-buffer (mct--get-completion-window))))
+    (when (and mct--region-buf (not (eq (current-buffer) buf)))
+      (while-no-input
+        (condition-case nil
+            (save-match-data
+              (mct--show-completions))
+          (quit (keyboard-quit)))))))
 
 (defun mct--region-live-update ()
   "Hook up `mct--region-live-completions'."
@@ -1172,12 +1174,6 @@ Meant to be added to `after-change-functions'."
     ;; Teardown
     (remove-hook 'after-change-functions #'mct--region-live-completions t)))
 
-;; FIXME 2021-12-05: Something affects performance.  In a clean
-;; *scratch* buffer, type "def TAB" and select "defalias".  It expands
-;; right away.  Try the same in a larger elisp file like this one and
-;; the text expansion is considerably slower.  Try it on modus-themes.el
-;; and you might as well prepare dinner while waiting.
-
 (defun mct-choose-completion-in-region ()
   "Choose candidate at point and quit completion in region.
 This is the counterpart of `mct-choose-completion-exit' when the



reply via email to

[Prev in Thread] Current Thread [Next in Thread]