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

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

[elpa] externals/auto-correct f9c542b 08/11: auto-correct: Defer loading


From: Stefan Monnier
Subject: [elpa] externals/auto-correct f9c542b 08/11: auto-correct: Defer loading of flyspell support until after flyspell has been enabled
Date: Tue, 1 Dec 2020 15:17:29 -0500 (EST)

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

    auto-correct: Defer loading of flyspell support until after flyspell has 
been enabled
    
    * packages/auto-correct/auto-correct.el: Bump version
      (auto-correct-defer-flyspell-support):
      (auto-correct-set-enable-flyspell-support): New functions.
      (auto-correct-enable-flyspell-support): Use them for customization 
setting.
---
 auto-correct.el | 34 +++++++++++++++++++++++++++-------
 1 file changed, 27 insertions(+), 7 deletions(-)

diff --git a/auto-correct.el b/auto-correct.el
index d9e1039..3d65f15 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.2
+;; Version: 1.1.3
 
 ;; This file is part of GNU Emacs.
 
@@ -234,15 +234,32 @@ Activation means adding `auto-correct-flyspell-insert' to
                     #'auto-correct-flyspell-insert)
     (remove-function flyspell-insert-function #'auto-correct-flyspell-insert)))
 
+;; Silence the byte-compiler; this will be enabled shortly
+(defvar auto-correct-enable-flyspell-support)
+
+(defun auto-correct-defer-flyspell-support ()
+  ;; Don't fully activate flyspell support until after it's loaded.
+  (with-eval-after-load 'flyspell
+    (auto-correct-handle-support
+     auto-correct-enable-flyspell-support
+     'auto-correct--activate-flyspell-support)))
+
+(defun auto-correct-set-enable-flyspell-support (sym val)
+  (set sym val)
+  (auto-correct-defer-flyspell-support))
+
 (defcustom auto-correct-enable-flyspell-support t
-  "Whether to automatically correct corrections made in flyspell."
+  "Whether to automatically correct corrections made in flyspell.
+
+Support will not be enabled until after flyspell has been loaded.
+
+Use the following to set this manually to NEW-VALUE:
+
+(setq auto-correct-enable-flyspell-support NEW-VALUE)
+(auto-correct-defer-flyspell-support)"
   :group 'auto-correct
   :type 'boolean
-  :set (lambda (sym val)
-         (set sym val)
-         (auto-correct-handle-support
-          val
-          'auto-correct--activate-flyspell-support)))
+  :set 'auto-correct-set-enable-flyspell-support)
 
 ;; Ispell support
 
@@ -293,6 +310,9 @@ the result as a correction."
                   #'auto-correct--ispell-handler)
     (advice-remove 'ispell-command-loop #'auto-correct--ispell-handler)))
 
+;; We don't defer ispell support because adding advice will work even if the
+;; feature hasn't been loaded yet.
+
 (defcustom auto-correct-enable-ispell-support t
   "Whether to automatically correct corrections made in Ispell."
   :group 'auto-correct



reply via email to

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