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

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

[elpa] externals/guess-language c369ef5 063/101: Type-mode is not a depe


From: Stefan Monnier
Subject: [elpa] externals/guess-language c369ef5 063/101: Type-mode is not a dependency anymore.
Date: Sat, 23 Feb 2019 10:34:43 -0500 (EST)

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

    Type-mode is not a dependency anymore.
    
    Still supported, though.
---
 README.org        |  8 ++++----
 guess-language.el | 16 ++++++++--------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/README.org b/README.org
index e09a411..fb31821 100644
--- a/README.org
+++ b/README.org
@@ -3,7 +3,7 @@
 
 * guess-language: Emacs minor mode for robust automatic language detection
 
-Emacs minor mode that detects the language of what you're typing.  
Automatically switches spell checker and typo-mode.
+Emacs minor mode that detects the language of what you're typing.  
Automatically switches the spell checker and typo-mode (if present).
 
 *Key features:*
 - Detection algorithm is robust, efficient, and dead simple.  Based on
@@ -14,13 +14,13 @@ Emacs minor mode that detects the language of what you're 
typing.  Automatically
 
 -----
 
-I write a lot of text in multiple languages and was getting tired of 
constantly having to switch the dictionary of my spell-checker.  In true Emacs 
spirit, I decided to dust off my grandpa's parentheses and wrote some code to 
address this problem.  The result is ~guess-language-mode~, a minor mode for 
Emacs that guesses the language of the current paragraph and then changes the 
dictionary of ispell and the language settings of typo-mode.  It also reruns 
Flyspell on the current paragraph, [...]
+I write a lot of text in multiple languages and was getting tired of 
constantly having to switch the dictionary of my spell-checker.  In true Emacs 
spirit, I decided to dust off my grandpa's parentheses and wrote some code to 
address this problem.  The result is ~guess-language-mode~, a minor mode for 
Emacs that guesses the language of the current paragraph and then changes the 
dictionary of ispell and the language settings of typo-mode (if present).  It 
also reruns Flyspell on the curre [...]
 
 Currently, the following languages are supported: Arabic, Czech, Danish, 
Dutch, English, Finnish, French, German, Italian, Norwegian, Polish, 
Portuguese, Russian, Slovak, Slovenian, Spanish, Swedish.  It is very easy to 
add more languages and this repository includes the necessary language 
statistics for 49 additional languages.  (These were copied from 
[[https://github.com/kent37/guess-language][guess_language.py]].)
 
 ** Prerequisites
 
-This mode assumes that Flyspell is activated and configured for all relevant 
languages, i.e., those listed in ~guess-language-languages~.  Guess-language 
also assumes that [[https://github.com/jorgenschaefer/typoel][typo-mode]] is 
installed and set up.
+This mode assumes that Flyspell is activated and configured for all relevant 
languages, i.e., those listed in ~guess-language-languages~.  If 
[[https://github.com/jorgenschaefer/typoel][typo-mode]] is present, 
guess-language also changes the language there.  Typo-mode is not a dependency, 
though.
 
 ** Installation
 
@@ -54,7 +54,7 @@ In this case, use the variable ~guess-language-langcodes~ to 
tell guess-language
     (de . ("de_CH" "German"))))
 #+END_SRC
 
-The key of each entry in this alist is an ISO 639-1 language code.  The first 
element of the value is the name of the dictionary that should be used (i.e., 
what you would enter when setting the language via ~M-x 
ispell-change-dictionary~).  The second element is the name of the language 
setting that should be used with typo-mode.  If a language is not supported by 
typo-mode, enter ~nil~.
+The key of each entry in this alist is an ISO 639-1 language code.  The first 
element of the value is the name of the dictionary that should be used (i.e., 
what you would enter when setting the language via ~M-x 
ispell-change-dictionary~).  The second element is the name of the language 
setting that should be used with typo-mode (if present).  If a language is not 
supported by typo-mode, enter ~nil~.
 
 For a list of all dictionaries available for spell-checking, use the following:
 
diff --git a/guess-language.el b/guess-language.el
index c7c2889..e06bb91 100644
--- a/guess-language.el
+++ b/guess-language.el
@@ -23,12 +23,13 @@
 
 ;; Guess-language is a buffer-local minor mode.  It guesses the
 ;; language of the current paragraph when flyspell detects an
-;; incorrect word and changes Ispell's dictionary and typo-mode
-;; accordingly.  If the language settings change, flyspell is rerun
-;; but only on the current paragraph.  Guess-language thus supports
-;; documents using multiple languages.  If the paragraph is shorter
-;; than some user-defined value, none of the above happens because
-;; there is likely not enough text to guess the language correctly.
+;; incorrect word and changes Ispell's dictionary and typo-mode (if
+;; present) accordingly.  If the language settings change, flyspell is
+;; rerun but only on the current paragraph.  Guess-language thus
+;; supports documents using multiple languages.  If the paragraph is
+;; shorter than some user-defined value, none of the above happens
+;; because there is likely not enough text to guess the language
+;; correctly.
 ;;
 ;; The detection algorithm is based on counts of character
 ;; trigrams.  At this time, supported languages are Arabic, Czech,
@@ -40,7 +41,6 @@
 ;;; Code:
 
 (require 'cl-lib)
-(require 'typo)
 (require 'find-func)
 (require 'ispell)
 (require 'flyspell)
@@ -165,7 +165,7 @@ If typo doesn't support the language, we leave it alone."
   (let* ((lang (guess-language-paragraph))
          (codes (cdr (assoc lang guess-language-langcodes))))
     (ispell-change-dictionary (car codes))
-    (when (cadr codes)
+    (when (and (boundp typo-mode) (cadr codes))
       (typo-change-language (cadr codes)))))
 
 (defun guess-language-autoset-and-spellcheck-maybe (beginning end doublon)



reply via email to

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