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

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

[elpa] 46/52: Never delete the "added newline" twice


From: Dmitry Gutov
Subject: [elpa] 46/52: Never delete the "added newline" twice
Date: Tue, 01 Jul 2014 11:53:33 +0000

dgutov pushed a commit to branch master
in repository elpa.

commit 81e65de7876baca67ce6d9d2a9c5719ddf36312e
Author: Dmitry Gutov <address@hidden>
Date:   Fri Jun 27 06:14:27 2014 +0300

    Never delete the "added newline" twice
    
    Even when a hook or a backend method raises an error.
    
    Possibly related to #145.
---
 company.el |   55 ++++++++++++++++++++++++++++---------------------------
 1 files changed, 28 insertions(+), 27 deletions(-)

diff --git a/company.el b/company.el
index 7066817..485df72 100644
--- a/company.el
+++ b/company.el
@@ -1435,33 +1435,34 @@ from the rest of the back-ends in the group, if any, 
will be left at the end."
        ;; Only set unmodified when tick remained the same since insert,
        ;; and the buffer wasn't modified before.
        (set-buffer-modified-p nil))
-  (when company-prefix
-    (if (stringp result)
-        (progn
-          (company-call-backend 'pre-completion result)
-          (run-hook-with-args 'company-completion-finished-hook result)
-          (company-call-backend 'post-completion result))
-      (run-hook-with-args 'company-completion-cancelled-hook result)))
-  (setq company-added-newline nil
-        company-backend nil
-        company-prefix nil
-        company-candidates nil
-        company-candidates-length nil
-        company-candidates-cache nil
-        company-candidates-predicate nil
-        company-common nil
-        company-selection 0
-        company-selection-changed nil
-        company--manual-action nil
-        company--manual-prefix nil
-        company-lighter company-default-lighter
-        company--point-max nil
-        company-point nil)
-  (when company-timer
-    (cancel-timer company-timer))
-  (company-search-mode 0)
-  (company-call-frontends 'hide)
-  (company-enable-overriding-keymap nil)
+  (unwind-protect
+      (when company-prefix
+        (if (stringp result)
+            (progn
+              (company-call-backend 'pre-completion result)
+              (run-hook-with-args 'company-completion-finished-hook result)
+              (company-call-backend 'post-completion result))
+          (run-hook-with-args 'company-completion-cancelled-hook result)))
+    (setq company-added-newline nil
+          company-backend nil
+          company-prefix nil
+          company-candidates nil
+          company-candidates-length nil
+          company-candidates-cache nil
+          company-candidates-predicate nil
+          company-common nil
+          company-selection 0
+          company-selection-changed nil
+          company--manual-action nil
+          company--manual-prefix nil
+          company-lighter company-default-lighter
+          company--point-max nil
+          company-point nil)
+    (when company-timer
+      (cancel-timer company-timer))
+    (company-search-mode 0)
+    (company-call-frontends 'hide)
+    (company-enable-overriding-keymap nil))
   ;; Make return value explicit.
   nil)
 



reply via email to

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