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

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

[elpa] externals/guess-language d9933d3 075/101: Keep switching typo-mod


From: Stefan Monnier
Subject: [elpa] externals/guess-language d9933d3 075/101: Keep switching typo-mode.
Date: Sat, 23 Feb 2019 10:34:46 -0500 (EST)

branch: externals/guess-language
commit d9933d3d51eeb86047cced4ffaf1387db7591682
Author: Titus von der Malsburg <address@hidden>
Commit: Titus von der Malsburg <address@hidden>

    Keep switching typo-mode.
    
    For the sake of backward compatibility.
---
 README.org        |  9 ---------
 guess-language.el | 10 ++++++----
 2 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/README.org b/README.org
index fbc0ecd..9de769c 100644
--- a/README.org
+++ b/README.org
@@ -86,15 +86,6 @@ Languages that are currently supported by 
guess-language-mode:
 | Spanish    | ~es~           | spanish                   |                    
       |
 | Swedish    | ~sv~           | svenska                   |                    
       |
 
-*** Typo mode
-
-By default guess-language only switches the Ispell dictionary used by Flyspell 
(`ispell-change-dictionary`).  However, guess-language can also switch the 
language settings used by type-mode.  To activate this add the following to 
your configuration:
-
-#+BEGIN_SRC elisp
-(add-hook 'guess-language-after-detection-functions 
'guess-language-switch-typo-mode-function)
-#+END_SRC
-
-
 *** Custom functions
 
 While changing the spell-checker’s dictionary is the main purpose of 
guess-language, there are other things that a user might want to do when a new 
language is detected, for instance, a user might want to change the input 
method.  Things like that can be easily achieved by adding custom functions to 
the hook `guess-language-after-detection-functions`.  Functions on this hook 
take three arguments:
diff --git a/guess-language.el b/guess-language.el
index 3c3f6c2..f7c23e6 100644
--- a/guess-language.el
+++ b/guess-language.el
@@ -105,7 +105,8 @@ value is nil."
   :type '(alist :key-type symbol :value-type list)
   :group 'guess-language)
 
-(defcustom guess-language-after-detection-functions (list 
#'guess-language-switch-flyspell-function)
+(defcustom guess-language-after-detection-functions (list 
#'guess-language-switch-flyspell-function
+                                                          
#'guess-language-switch-typo-mode-function)
   "Hook run when a new language is detected.
 
 This hook is abnormal in that its functions take arguments,
@@ -215,9 +216,10 @@ which LANG was detected."
 LANG is the ISO 639-1 code of the language (as a
 symbol).  BEGINNING and END are the endpoints of the region in
 which LANG was detected."
-  (let* ((typo-lang (cl-caddr (assq lang guess-language-langcodes))))
-    (when typo-lang
-      (typo-change-language typo-lang))))
+  (when (boundp 'typo-mode)
+    (let* ((typo-lang (cl-caddr (assq lang guess-language-langcodes))))
+      (when typo-lang
+        (typo-change-language typo-lang)))))
 
 ;;;###autoload
 (define-minor-mode guess-language-mode



reply via email to

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