;ELC ;;; Compiled ;;; in Emacs version 28.0.50 ;;; with all optimizations. (byte-code "\300\301!\210\300\302!\210\300\303!\210\300\304!\210\305\306\307\310\311\312%\210\313\314\315\316\317DD\320\321\322%\210\313\323\315\316\324DD\325\321\326%\207" [require cl-lib find-func ispell flyspell custom-declare-group guess-language nil "Minor mode that automatically guesses the language being\ntyped. Automatically switches things like spell-checker\ndictionary, input methods, etc." :group completion custom-declare-variable guess-language-languages funcall function #[0 "\300\207" [(en de fr)] 1] "List of languages that should be considered.\n\nUses ISO 639-1 identifiers. Currently supported languages are:\nArabic (ar), Czech (cs), Danish (da), Dutch (nl), English (en),\nFinnish (fi), French (fr), German (de), Italian (it),\nNorwegian (nb), Polish (pl), Portuguese (pt), Russian (ru),\nSlovak (sk), Slovenian (sl), Spanish (es), Swedish (sv)" :type (repeat symbol) guess-language-min-paragraph-length #[0 "\300\207" [40] 1] "Minimum number of characters in paragraph.\n\nWhen a paragraph is shorter than this value (in characters),\nguess-language doesn't do anything because there is likely too\nlittle material to reliably guess the language." integer] 6) #@58 The regular expressions that are used to count trigrams. (defvar guess-language-regexps nil (#$ . 1287)) (byte-code "\300\301\302\303\304DD\305\306\307%\210\300\310\302\303\311DD\312\306\313%\210\300\314\302\303\315DD\316#\207" [custom-declare-variable guess-language-langcodes funcall function #[0 "\300\207" [((ar "ar" nil) (cs "czech" "Czech") (da "dansk" nil) (de "de" "German") (en "en" "English") (es "spanish" nil) (fi "finnish" "Finnish") (fr "francais" "French") (it "italiano" "Italian") (nb "norsk" nil) (nl "nederlands" nil) (pl "polish" nil) (pt "portuguese" nil) (ru "russian" "Russian") (sk "slovak" nil) (sl "slovenian" nil) (sv "svenska" nil))] 1] "Language codes for spell-checker and typo-mode.\n\nThe key is a symbol specifying the ISO 639-1 code of the\nlanguage. The values is a list with two elements. The first is\nthe name of the dictionary that should be used by the\nspell-checker (e.g., what you would enter when setting the\nlanguage with `ispell-change-dictionary'). The second element is\nthe name of the language setting that should be used with\ntypo-mode. If a language is not supported by typo-mode, that\nvalue is nil." :type (alist :key-type symbol :value-type list) guess-language-after-detection-functions #[0 "\300\301D\207" [guess-language-switch-flyspell-function guess-language-switch-typo-mode-function] 2] "Hook run when a new language is detected.\n\nThis hook is abnormal in that its functions take arguments,\nnamely a symbol indicating the language that was detected and the\nbeginning and end of the region in which the language was\ndetected." hook guess-language-trigrams-directory #[0 "\300\301\302!!\207" [file-name-directory find-library-name "guess-language"] 3] "Directory where trigrams are stored.\n\nBy default it's the same directory where this module is installed."] 6) #@103 The language detected when `guess-language' was last executed. Uses ISO 639-1 to identify languages. (defvar guess-language-current-language nil (#$ . 3130)) (make-variable-buffer-local 'guess-language-current-language) #@27 Load language statistics. (defalias 'guess-language-load-trigrams #[0 "\302\211\211\211\211:\203^@\262\303\304! \"\303\304!\303\305 \"\"\306!\203,\266\202\202/\211\266\202\262\307\310\311\"r\211q\210\312\313\"\216\314!\210\315\316 \317\311#*\262\262BB\262A\262\302\262\202\237\207" [guess-language-languages guess-language-trigrams-directory nil expand-file-name symbol-name "trigrams" file-exists-p generate-new-buffer " *temp*" t make-closure #[0 "\301\300!\205 \302\300!\207" [V0 buffer-name kill-buffer] 2] insert-file-contents split-string buffer-string "\n"] 12 (#$ . 3357)]) #@57 Compile regular expressions used for guessing language. (defalias 'guess-language-compile-regexps #[0 "\301 \302\211\211\211\211:\2031@\262\303\304A\305#\262\306\307Q\262@BB\262A\262\302\262\202\237\266\206\211\207" [guess-language-regexps guess-language-load-trigrams nil mapconcat identity "\\)\\|\\(" "\\(" "\\)"] 10 (#$ . 3974)]) #@102 Uses whatever method for moving to the previous paragraph is most appropriate given the buffer mode. (defalias 'guess-language-backward-paragraph #[0 "\301=\203\302 \203\303 \207\304 \207\305 \207" [major-mode org-mode org-in-item-p org-beginning-of-item-list org-backward-paragraph backward-paragraph] 2 (#$ . 4335)]) #@98 Uses whatever method for moving to the next paragraph is most appropriate given the buffer mode. (defalias 'guess-language-forward-paragraph #[0 "\301=\203\302 \203\303 \207\304 \207\305 \207" [major-mode org-mode org-in-item-p org-end-of-item-list org-forward-paragraph forward-paragraph] 2 (#$ . 4665)]) #@106 Guess language in the specified region. Region starts at BEGINNING and ends at END. (fn BEGINNING END) (defalias 'guess-language-region #[514 "\204\302 \210\303 \304\305\"\"\203\302 \210\306\211\211\211:\203>@\262A\262@\307  #BB\262A\262\306\262\202\237\266\205\310\311\"@\207" [guess-language-regexps guess-language-languages guess-language-compile-regexps cl-set-exclusive-or mapcar car nil how-many cl-reduce #[514 "AAV\203\n\207\207" [] 4 "\n\n(fn X Y)"]] 12 (#$ . 4983) "*r"]) #@35 Guess the language of the buffer. (defalias 'guess-language-buffer #[0 "\300ed\"\207" [guess-language-region] 3 (#$ . 5503)]) #@46 Guess the language of the current paragraph. (defalias 'guess-language-paragraph #[0 "\212\300 \210`)\212\301 \210`)\302\"\207" [guess-language-backward-paragraph guess-language-forward-paragraph guess-language-region] 5 (#$ . 5635)]) #@48 Guess the language of the current buffer line. (defalias 'guess-language-line #[0 "\212\300 \210`)\212\301\210`)\302\"\207" [beginning-of-line nil guess-language-region] 5 (#$ . 5878)]) #@252 Guess language of the current paragraph. Calls the functions in `guess-language-after-detection-functions`. These functions may switch the dictionary of the spell checker and do other useful things like changing the keyboard layout or input method. (defalias 'guess-language #[0 "\212\303 \210`)\212\304 \210`)\211ZV\205/\305\"\306\307$\210\211\310\311\312\313\n\"AA@\"!\262\207" [guess-language-min-paragraph-length guess-language-current-language guess-language-langcodes guess-language-backward-paragraph guess-language-forward-paragraph guess-language-region run-hook-with-args guess-language-after-detection-functions message format "Detected language: %s" assoc] 9 (#$ . 6074) nil]) #@137 Wrapper for `guess-language' because `flyspell-incorrect-hook' provides three arguments that we don't need. (fn BEGINNING END DOUBLON) (defalias 'guess-language-function #[771 "\300 \210\301\207" [guess-language nil] 4 (#$ . 6783)]) #@339 Switch the Flyspell dictionary and recheck the current paragraph. This is only done if the new language is different from the previous language. Otherwise, nothing happens. 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. (fn LANG BEGINNING END) (defalias 'guess-language-switch-flyspell-function #[771 " \236A@ \236A@\230?\205\"\306!\210\307\211\211\310\311\",\207" [guess-language-current-language guess-language-langcodes flyspell-large-region flyspell-incorrect-hook flyspell-issue-message-flag flyspell-issue-welcome-flag ispell-change-dictionary nil 1 flyspell-region] 9 (#$ . 7024)]) #@203 Switch the language used by typo-mode. 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. (fn LANG BEGINNING END) (defalias 'guess-language-switch-typo-mode-function #[771 "\301\302!\205\236AA@\211\205\303!\262\207" [guess-language-langcodes boundp typo-mode typo-change-language] 6 (#$ . 7726)]) #@111 Do not guess language when an unknown word is encountered during `flyspell-buffer'. (fn ORIG-FUN &rest ARGS) (defalias 'guess-language-flyspell-buffer-wrapper #[385 "\301\302\")\207" [flyspell-incorrect-hook nil apply] 5 (#$ . 8126)]) #@107 Non-nil if Guess-Language mode is enabled. Use the command `guess-language-mode' to change this variable. (defvar guess-language-mode nil (#$ . 8372)) (make-variable-buffer-local 'guess-language-mode) #@1266 Toggle guess-language mode. This is a minor mode. If called interactively, toggle the `Guess-Language mode' mode. If the prefix argument is positive, enable the mode, and if it is zero or negative, disable the mode. If called from Lisp, toggle the mode if ARG is `toggle'. Enable the mode if ARG is nil, omitted, or is a positive number. Disable the mode if ARG is a negative number. To check whether the minor mode is enabled in the current buffer, evaluate `guess-language-mode'. The mode's hook is called both when the mode is enabled and when it is disabled. Interactively with no argument, this command toggles the mode. A positive prefix argument enables the mode, any other prefix argument disables it. From Lisp, argument omitted or nil enables the mode, `toggle' toggles the state. 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 on the current paragraph. If the paragraph is shorter than `guess-language-min-paragraph-length', none of the above happens because there is likely not enough text to guess the language correctly. (fn &optional ARG) (defalias 'guess-language-mode #[256 "\302 \303=\203 ?\202\247\203\304W\203\305\202\306\307\301!\2031\310\300 \"\2031\300 B\203E\311\312\313\305\306$\210\314\315\316\317#\210\202P\320\312\313\306#\210\321\315\317\"\210\322\323\203Z\324\202[\325\"\210\326\327!\203}\302 \203o\211\302 \232\203}\330\331\203y\332\202z\333\334#\210\210\335 \210\207" [guess-language-mode local-minor-modes current-message toggle 1 nil t boundp delq add-hook flyspell-incorrect-hook guess-language-function advice-add flyspell-buffer :around guess-language-flyspell-buffer-wrapper remove-hook advice-remove run-hooks guess-language-mode-hook guess-language-mode-on-hook guess-language-mode-off-hook called-interactively-p any message "Guess-Language mode %sabled%s" "en" "dis" " in current buffer" force-mode-line-update] 7 (#$ . 8581) (byte-code "\203\n\301!\202 \302C\207" [current-prefix-arg prefix-numeric-value toggle] 2)]) (defvar guess-language-mode-hook nil) (byte-code "\301\302N\204\f\303\301\302\304#\210\303\301\305\306#\210\303\301\307\310C#\210\311\312\313\314\300!\205#\310\211%\207" [guess-language-mode-map guess-language-mode-hook variable-documentation put "Hook run after entering or leaving `guess-language-mode'.\nNo problems result if this variable is not bound.\n`add-hook' automatically binds it. (This is true for all hook variables.)" custom-type hook standard-value nil add-minor-mode guess-language-mode (:eval (format " (%s)" (or guess-language-current-language "default"))) boundp] 6) #@488 Guess language on all lines in the buffer and mark them. If HIGHLIGHT is non-nil, lines that are not in the same language as the overall buffer are marked red, other lines are marked green. Marking is done with overlays which can be removed using the function `remove-overlays'. This primary purpose of this command is to aid debugging and improvement of the language identification algorithm. Interface and implementation details may change in the future. (fn &optional HIGHLIGHT) (defalias 'guess-language-mark-lines #[256 "\301 \210\302 \212eb\210\212\303y\304U)\205l\305\306\307!\310\311\312#)\266\203\304U\204f\212\313 \210`)\212\310\210`)\314\"\315\"\316\317\320!\321P#\210\316\322\323#\210\203d=\203^\316\322\324#\266\202f\316\322\325#\210\266\303y\210\202 )\207" [inhibit-changing-match-data remove-overlays guess-language-buffer 1 0 "^[[:blank:]]*$" thing-at-point line nil t string-match beginning-of-line guess-language-region make-overlay overlay-put before-string symbol-name ": " face (:background "grey90") (:background "green") (:background "red")] 11 (#$ . 11387) nil]) (provide 'guess-language)