branch: externals/capf-autosuggest
commit abd71ab7e6b888c5cf7eefc1da0a7c5839b64026
Author: jakanakaevangeli <[email protected]>
Commit: jakanakaevangeli <[email protected]>
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.