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

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

[elpa] externals/auto-correct fb9950c 07/11: auto-correct: Fixed handle-


From: Stefan Monnier
Subject: [elpa] externals/auto-correct fb9950c 07/11: auto-correct: Fixed handle-support bug and bumped version
Date: Tue, 1 Dec 2020 15:17:29 -0500 (EST)

branch: externals/auto-correct
commit fb9950c38f7e73bbb9a27caca206a66ce2bd6d13
Author: Ian Dunn <dunni@gnu.org>
Commit: Ian Dunn <dunni@gnu.org>

    auto-correct: Fixed handle-support bug and bumped version
    
    * packages/auto-correct/auto-correct.el (auto-correct--support-function): 
New
      helper function.
      (auto-correct-handle-support): Use it, and use the correct hook variable.
---
 auto-correct.el | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/auto-correct.el b/auto-correct.el
index 9b02cb6..d9e1039 100644
--- a/auto-correct.el
+++ b/auto-correct.el
@@ -5,7 +5,7 @@
 ;; Author: Ian Dunn <dunni@gnu.org>
 ;; Maintainer: Ian Dunn <dunni@gnu.org>
 ;; Keywords: editing
-;; Version: 1.1.1
+;; Version: 1.1.2
 
 ;; This file is part of GNU Emacs.
 
@@ -184,6 +184,11 @@ the command `auto-correct-toggle-ispell-local'.
              'append
              #'equal)
 
+(defsubst auto-correct--support-function (base-function)
+  "Return a function that calls BASE-FUNCTION with `auto-correct-mode' as its 
argument."
+  `(lambda ()
+     (funcall (quote ,base-function) auto-correct-mode)))
+
 (defun auto-correct-handle-support (activate support-fun)
   "Helper function to add or remove auto-correct support for a package.
 
@@ -191,8 +196,8 @@ If ACTIVATE is non-nil, add support, otherwise remove it.
 SUPPORT-FUN is a function that takes a single argument: a boolean
 indicating whether to activate or deactivate support."
   (if activate
-      (add-hook 'auto-correct-hook support-fun)
-    (remove-hook 'auto-correct-hook support-fun))
+      (add-hook 'auto-correct-mode-hook (auto-correct--support-function 
support-fun))
+    (remove-hook 'auto-correct-mode-hook (auto-correct--support-function 
support-fun)))
   ;; If `auto-correct-mode' is enabled, activate or deactivate support.
   (when auto-correct-mode
     (funcall support-fun activate)))



reply via email to

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