]> code.delx.au - gnu-emacs-elpa/commitdiff
company-post-command: Handle being called after quitting
authorDmitry Gutov <dgutov@yandex.ru>
Sun, 28 Sep 2014 03:10:22 +0000 (07:10 +0400)
committerDmitry Gutov <dgutov@yandex.ru>
Sun, 28 Sep 2014 03:10:22 +0000 (07:10 +0400)
Fixes #190

company.el

index 8cb12e30caa8a21859c409dee22dfc3c804eaeca..079a05584d74517b135563bba8f2eba0c4b45082 100644 (file)
@@ -1279,7 +1279,8 @@ from the rest of the back-ends in the group, if any, will be left at the end."
        (eq pos (point))
        (when (company-auto-begin)
          (company-input-noop)
-         (company-post-command))))
+         (let ((this-command 'company-idle-begin))
+           (company-post-command)))))
 
 (defun company-auto-begin ()
   (and company-mode
@@ -1518,6 +1519,13 @@ from the rest of the back-ends in the group, if any, will be left at the end."
   (company-uninstall-map))
 
 (defun company-post-command ()
+  (when (null this-command)
+    ;; Happens when the user presses `C-g' while inside
+    ;; `flyspell-post-command-hook', for example.
+    ;; Or any other `post-command-hook' function that can call `sit-for',
+    ;; or any quittable timer function.
+    (company-abort)
+    (setq this-command 'company-abort))
   (unless (company-keep this-command)
     (condition-case err
         (progn