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

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

[elpa] externals/capf-autosuggest abd71ab 29/63: Don't leak overlays whe


From: ELPA Syncer
Subject: [elpa] externals/capf-autosuggest abd71ab 29/63: Don't leak overlays when killing all local variables
Date: Wed, 27 Oct 2021 14:57:58 -0400 (EDT)

branch: externals/capf-autosuggest
commit abd71ab7e6b888c5cf7eefc1da0a7c5839b64026
Author: jakanakaevangeli <jakanakaevangeli@chiru.no>
Commit: jakanakaevangeli <jakanakaevangeli@chiru.no>

    Don't leak overlays when killing all local variables
---
 capf-autosuggest.el | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/capf-autosuggest.el b/capf-autosuggest.el
index 6d34f54..add3dd4 100644
--- a/capf-autosuggest.el
+++ b/capf-autosuggest.el
@@ -190,7 +190,11 @@ Otherwise, return nil."
   (if capf-autosuggest-mode
       (progn
         (setq capf-autosuggest--overlay (make-overlay (point) (point) nil t t))
-        (add-hook 'post-command-hook #'capf-autosuggest--post-h nil t))
+        (add-hook 'post-command-hook #'capf-autosuggest--post-h nil t)
+        (add-hook 'change-major-mode-hook
+                  #'capf-autosuggest-active-mode-deactivate nil t))
+    (remove-hook 'change-major-mode-hook
+                 #'capf-autosuggest-active-mode-deactivate t)
     (remove-hook 'post-command-hook #'capf-autosuggest--post-h t)
     (capf-autosuggest-active-mode -1)))
 
@@ -306,6 +310,10 @@ inactive."
   (unless capf-autosuggest-active-mode
     (delete-overlay capf-autosuggest--overlay)))
 
+(defun capf-autosuggest-active-mode-deactivate ()
+  "Deactivate `capf-autosuggest-active-mode'."
+  (capf-autosuggest-active-mode -1))
+
 ;;;###autoload
 (defun capf-autosuggest-comint-capf ()
   "Completion-at-point function for comint input history.



reply via email to

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