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

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

[elpa] master c96626f 1/3: Add a workaround for sit-for conflict with fl


From: Dmitry Gutov
Subject: [elpa] master c96626f 1/3: Add a workaround for sit-for conflict with flyspell
Date: Thu, 22 Feb 2018 20:21:56 -0500 (EST)

branch: master
commit c96626f35c3a7886b49c34d5f2986c991dda29be
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>

    Add a workaround for sit-for conflict with flyspell
    
    Closes #760
---
 NEWS.md    |  4 ++++
 company.el | 13 +++++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/NEWS.md b/NEWS.md
index 2db3dcf..48aa592 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,5 +1,9 @@
 # History of user-visible changes
 
+## Next
+
+* Workaround for Emacs bug#23980 triggered in combination with flyspell.
+
 ## 2018-02-18 (0.9.5)
 
 * The most common case of tooltip flickering with asynchronous backends (and
diff --git a/company.el b/company.el
index 3e276d9..6b294f2 100644
--- a/company.el
+++ b/company.el
@@ -1240,8 +1240,12 @@ can retrieve meta-data for them."
            (when (eq res 'none)
              (push 'company-foo unread-command-events))
            (setq res candidates)))
-        (while (and (eq res 'none)
-                    (sit-for 0.5 t)))
+        (if (company--flyspell-workaround-p)
+            (while (and (eq res 'none)
+                        (not (input-pending-p)))
+              (sleep-for company-async-wait))
+          (while (and (eq res 'none)
+                      (sit-for 0.5 t))))
         (while (member (car unread-command-events)
                        '(company-foo (t . company-foo)))
           (pop unread-command-events))
@@ -1249,6 +1253,11 @@ can retrieve meta-data for them."
             (and (consp res) res)
           (setq res 'exited))))))
 
+(defun company--flyspell-workaround-p ()
+  ;; https://debbugs.gnu.org/23980
+  (and (bound-and-true-p flyspell-mode)
+       (version< emacs-version "27")))
+
 (defun company--preprocess-candidates (candidates)
   (cl-assert (cl-every #'stringp candidates))
   (unless (company-call-backend 'sorted)



reply via email to

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