[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master a154438: auto-correct: Fixed handle-support bug and bumped
From: |
Ian Dunn |
Subject: |
[elpa] master a154438: auto-correct: Fixed handle-support bug and bumped version |
Date: |
Thu, 19 Oct 2017 21:05:33 -0400 (EDT) |
branch: master
commit a1544380cbd2bf61024c2f08f29d27688134a548
Author: Ian Dunn <address@hidden>
Commit: Ian Dunn <address@hidden>
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.
---
packages/auto-correct/auto-correct.el | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/packages/auto-correct/auto-correct.el
b/packages/auto-correct/auto-correct.el
index 9b02cb6..d9e1039 100644
--- a/packages/auto-correct/auto-correct.el
+++ b/packages/auto-correct/auto-correct.el
@@ -5,7 +5,7 @@
;; Author: Ian Dunn <address@hidden>
;; Maintainer: Ian Dunn <address@hidden>
;; 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)))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] master a154438: auto-correct: Fixed handle-support bug and bumped version,
Ian Dunn <=