;ELC ;;; Compiled ;;; in Emacs version 28.0.50 ;;; with all optimizations. (byte-code "\300\301!\210\302\303\304\305\306\307\310\311&\210\312\313\314\315\316\317\306\303&\210\312\320\321\322\316\323\306\303&\210\312\324\304\325\316\326\306\303&\210\327\330\331\332\306\303%\207" [require iso-cvt custom-declare-group tex-smart-umlauts nil "Intelligent automatic conversion of TeX umlaut encodings." :group tex :prefix tex-smart-umlauts- custom-declare-variable tex-smart-umlauts-encode 'auto "Encoding of new umlauts.\nThis option has three possible values. \"Never\" means that newly\ninserted characters are never encoded, i.e. they are written\nunmodified to the file. \"Always\" means each new character is\nencoded according to `tex-smart-umlauts-encodings'. \"Automatic\"\nmeans conversion happens if and only if there is at least one\ndecoded character in the buffer (i.e. some character that has\nbeen decoded in the file when it has been loaded)." :type (radio (const :tag "Never" :value nil) (const :tag "Automatic." :value auto) (const :tag "Always." :value t)) tex-smart-umlauts-encodings '("^\\\\[^[:word:][:space:]][[:word:]]" "^\\\\[^[:word:][:space:]]{[[:word:]]}" "^\\\\[[:word:]]+{}" "^{\\\\.*}$") "A list of regular expressions that match your prefered encodings in order.\nWhen the encoding for some character is determined, these regular\nexpressions are matched against all possible encodings of that\ncharacter. The first matching encoding (that matches the first\nregular expression) will be used. If no regular expression\nmatches, some arbitrary encoding will be used." (repeat regexp) tex-smart-umlauts-german-shortcuts "If non-nil, also translate German shortcuts like \"a, \"o, \"s.\nNote that this is often viable for tex-files, but inappropriate\nfor other files like BibTeX files, because the latter may contain\nstrings enclosed in double-quotes." boolean custom-declare-face tex-smart-umlauts-marks ((t :foreground "white" :background "red")) "Face for displaying umlaut conversions."] 8) #@209 Conversion table for tex decoding. Each element of the list is two-element list of strings (tex iso). The first element is the tex-encoding of a character, the second element is the encoded character itself. (defvar tex-smart-umlauts--decode-table nil (#$ . 2040)) #@130 Conversion table for tex encodings. Same structure as `tex-smart-umlauts--decode-table', but used for newly inserted characters. (defvar tex-smart-umlauts--encode-table nil (#$ . 2312)) #@57 List of active overlays for showing stored conversions. (defvar tex-smart-umlauts--mark-overlays nil (#$ . 2504)) (byte-code "\300\301!\210\302\303\304\"\207" [make-variable-buffer-local tex-smart-umlauts--mark-overlays add-to-list format-alist (tex-smart-umlauts "Persistent TeX (encoding)" nil tex-smart-umlauts--decode tex-smart-umlauts--encode t nil)] 3) #@42 Convert latin-1 string STR to multibyte. (defalias 'tex-smart-umlauts--iso-to-multibyte #[(str) "\302\303\"\304\305 G\306 $\210 )\207" [str txt decode-coding-string latin-1 remove-text-properties 0 (charset)] 5 (#$ . 2869)]) #@149 Update internal encoding and decoding tables. This function updates the internal encoding and decoding tables from the tables defined in `iso-cvt'. (defalias 'tex-smart-umlauts--update-tables #[nil "\300 \210\301 \207" [tex-smart-umlauts--update-decode-table tex-smart-umlauts--update-encode-table] 1 (#$ . 3103)]) #@215 Update internal decoding table. This function updates the internal decoding table from the table defined in `iso-cvt'. If `tex-smart-umlauts-german-shortcuts' is non-nil, additional encodings like "a are included. (defalias 'tex-smart-umlauts--update-decode-table #[nil "\n\203 \304 \305\"\304 \306\"\307\310 \"\304\307\311 \"\307\312\313\307\314 \"!\"\"\211)\207" [iso-tex2iso-trans-tab tab tex-smart-umlauts-german-shortcuts tex-smart-umlauts--decode-table append (("\"a" "ä") ("\"o" "ö") ("\"u" "ü") ("\"A" "Ä") ("\"O" "Ö") ("\"U" "Ü") ("\"s" "ß")) (("\\\\ss{}" "ß") ("\\\\ss " "ß")) mapcar #[(pair) "\301\302\"\207" [pair mapcar tex-smart-umlauts--iso-to-multibyte] 3] #[(pair) "@A@\211\303 \304\305\n!#*D\207" [pair iso tex propertize tex-smart-umlauts tex-smart-umlauts--regexp-unquote] 7] #[(char) "\301!\302\303\304#D\207" [char regexp-quote propertize tex-smart-umlauts t] 5] delete-dups cadr] 8 (#$ . 3425)]) #@224 Remove quoted characters from regular expression REGEXP. This is the inverse of `regexp-quote', but note that it only works with simple regular expression. The effect is to replace double backslashes by a single backslash. (defalias 'tex-smart-umlauts--regexp-unquote #[(regexp) "\301\302\303\304\211%\207" [regexp replace-regexp-in-string "\\\\\\\\" "\\" t] 6 (#$ . 4374)]) #@263 Update internal encoding table. The internal encoding table is created by switching key and values of the decoding table `tex-smart-umlauts--decode-table'. If a character as several possible encodings, one is selected according to `tex-smart-umlauts-encodings'. (defalias 'tex-smart-umlauts--update-encode-table #[nil "\306\307\310\"\311\n\311\211\203F\f@\211A@\260 @\211 @\230\204>\312\313G\311$\210\314 !\315 \316 \"B #\210*\fA\211\204*\311\317\320 \"\210\321\322\n\"\211*\207" [encode-alist tbl tex-smart-umlauts--decode-table pair --dolist-tail-- encoding make-hash-table :test equal nil set-text-properties 0 tex-smart-umlauts--regexp-unquote puthash gethash maphash #[(char encodings) "\3062: \307\211\2036 @\f\307\211\203. @\310\n \"\203'\311\306 \"\210 A\211\204* A\211\204 *\f@0B\nB\211\n\207" [char tex-smart-umlauts-encodings re-encoding --dolist-tail-- encodings encoding done nil string-match throw encode-alist] 5] mapcar #[(pair) "@A@\211\304 \305\306 \"\243#*D\207" [pair iso tex encode-alist propertize tex-smart-umlauts assoc] 8] key tex-smart-umlauts--encode-table] 7 (#$ . 4757)]) #@311 Mark and decode all tex encoded characters in region. Only characters between the buffer positions FROM and TO are decoded. If FROM and TO are nil the whole buffer is decoded. This function registers 'tex-smart-umlauts' has buffer file format, so decoded characters are encoded again when the buffer is saved. (defalias 'tex-smart-umlauts--decode #[(&optional from to) "\304 \203\305 \306 \202\206e \206d\307 \310 #\311\n!\210)\207" [from to modified tex-smart-umlauts--decode-table region-active-p region-beginning region-end buffer-modified-p tex-smart-umlauts--translate set-buffer-modified-p] 4 (#$ . 5915)]) #@556 Mark and encode all characters in region. Only characters between the buffer positions FROM and TO are decoded. If FROM and TO are nil the whole buffer is encoded. Characters, that have existed when the buffer has been loaded will be encoded in their original encoding. Newly inserted characters will be encoded according the rules of `tex-smart-umlauts-encodings' and `tex-smart-umlauts--encode'. This function should never be called directly but is called just before the buffer is saved if the buffer has been decoded with `tex-smart-umlauts--decode'. (defalias 'tex-smart-umlauts--encode #[(&optional from to buffer) "\206e \206 d\306 \"\203?\307 \310 \311\223\310 \311\223\312 #\210\313\f!\210\314 !\314\n! \311\211\223\210\n\311\211\223\210+\315 \316#\207" [from to end beg modified tex-smart-umlauts--encode-table tex-smart-umlauts--should-encode buffer-modified-p make-marker nil tex-smart-umlauts--translate set-buffer-modified-p marker-position tex-smart-umlauts--each-char #[(pos) "\302\303\"\211\304=\203\305\211T\" \306=\203\307 \210 c\210\310\311!)\207" [pos encoded get-text-property tex-smart-umlauts t buffer-substring-no-properties nil debug delete-char 1] 4]] 5 (#$ . 6551)]) #@234 Return if characters should be encoded. This function returns non-nil if either `tex-smart-umlauts-encode' is t or if it is 'auto' and at least one character in the region FROM to TO has been decoded when the buffer has been loaded. (defalias 'tex-smart-umlauts--should-encode #[(from to) "\303=\206\304=\205\3052\306 \n\307#\210\3100\207" [tex-smart-umlauts-encode from to t auto found tex-smart-umlauts--each-char #[(pos) "\301\302\"\303=?\205\304\305\303\"\207" [pos get-text-property tex-smart-umlauts t throw found] 3] nil] 4 (#$ . 7779)]) #@255 Iterates over all encoded characters in region. The region between FROM and TO is scanned for characters that have an associated encoding. The function FUNCTION is called once for each character with one parameter, the buffer position of this character. (defalias 'tex-smart-umlauts--each-char #[(from to function) "\212\214 }\210\306 \307e\310\"\203e\202\311e\310\"\n\203g\311\n\310\"\nb\210 \n\312\223\210\f\nZ\313  W\203R\314 ! T\312\223\210!\210) T\211\2022*\314 !\307\n\310\"\204c\311\n\310\")\202 \312\211\223,\207" [from to beg marker end i make-marker get-text-property tex-smart-umlauts next-single-property-change nil 0 marker-position --dotimes-limit-- pos function] 5 (#$ . 8342)]) #@70 Translate between FROM and TO using the translation table TRANS-TAB. (defalias 'tex-smart-umlauts--translate #[(from to trans-tab) "\212\214 }\210b\210\306\307\f\307\211 \203A @\212\310 @\307\306#\2037\311\312\224\313\"\204\314 A@\306\211#\210\202) A\211 \204,d*\207" [from to case-fold-search inhibit-read-only trans-tab trans-this t nil re-search-forward get-text-property 0 tex-smart-umlauts replace-match --dolist-tail--] 5 (#$ . 9071)]) #@324 Remove encoding marks from all converted characters in region. This makes tex-smart-umlauts consider all characters as if they were modified, i.e. their original encoding will not be restored when the buffer is stored. FROM and TO are the region in which should be scanned. If FROM and TO are nil the whole buffer is used. (defalias 'tex-smart-umlauts--unmark #[(&optional from to) "\206e \206 d\302 \303#\207" [from to remove-text-properties (tex-smart-umlauts)] 4 (#$ . 9538)]) #@530 Reencode all charactes in region. Only characters between the buffer positions FROM and TO are decoded. If FROM and TO are nil the whole buffer is encoded. The original encodings of all characters in the region is dropped. If NOENCODE is non-nil the characters are not encoded (i.e. they are written literaly to the file in the current buffer's file encoding). Otherwise the characters are tex-encoded according to the rules of `tex-smart-umlauts-encodings'. In interactive use NOENCODE is non-nil if a prefix argument is used. (defalias 'tex-smart-umlauts-reencode-all #[(&optional noencode from to) "?\304 \210\305\n \"\210\306\n \"\210\307\n \")\207" [noencode tex-smart-umlauts-encode from to tex-smart-umlauts-hide-encodings tex-smart-umlauts--unmark tex-smart-umlauts--encode tex-smart-umlauts--decode] 3 (#$ . 10032) "*P"]) #@42 Show encodings of all umlauts in buffer. (defalias 'tex-smart-umlauts-show-encodings #[nil "\300 \210\301ed\302#\207" [tex-smart-umlauts-hide-encodings tex-smart-umlauts--each-char #[(pos) "\304\211T\"\305\306\"\211 B\307\n\310\311 \312=\203!\313\211T\"\202\" \314\315##*\207" [pos orig-txt ov tex-smart-umlauts--mark-overlays make-overlay get-text-property tex-smart-umlauts overlay-put after-string propertize t buffer-substring-no-properties face tex-smart-umlauts-marks] 8]] 4 (#$ . 10872) nil]) #@42 Hide encodings of all umlauts in buffer. (defalias 'tex-smart-umlauts-hide-encodings #[nil "\303\211\203\n@\304 !\210\nA\211\204*\303\211\207" [tex-smart-umlauts--mark-overlays ov --dolist-tail-- nil delete-overlay] 3 (#$ . 11386) nil]) #@197 Temporarily disables `tex-smart-umlauts-mode' while reverting a file. This function adds a `after-revert-hook' so that `tex-smart-umlauts-mode' is properly reinitialized after reverting the file. (defalias 'tex-smart-umlauts--before-revert #[nil "\300\301\302\"\210\303\304!\207" [add-hook after-revert-hook tex-smart-umlauts--after-revert tex-smart-umlauts-mode -1] 3 (#$ . 11640)]) #@62 Reactivates `tex-smart-umlauts-mode' after reverting a file. (defalias 'tex-smart-umlauts--after-revert #[nil "\300\301\302\"\210\303\304!\207" [remove-hook after-revert-hook tex-smart-umlauts--after-revert tex-smart-umlauts-mode 1] 3 (#$ . 12030)]) (defalias 'tex-smart-umlauts-decode #[(&optional from to) "\300\301!\207" [tex-smart-umlauts-mode 1] 2]) (make-obsolete 'tex-smart-umlauts-decode "Use `tex-smart-umlauts-mode' to enable tex-smart-umlauts" "1.3.0") #@113 Non-nil if Tex-Smart-Umlauts mode is enabled. Use the command `tex-smart-umlauts-mode' to change this variable. (defvar tex-smart-umlauts-mode nil (#$ . 12501)) (make-variable-buffer-local 'tex-smart-umlauts-mode) #@614 Minor mode for seamless translation of LaTeX special characters. This is a minor mode. If called interactively, toggle the `Tex-Smart-Umlauts 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 `tex-smart-umlauts-mode'. The mode's hook is called both when the mode is enabled and when it is disabled. (defalias 'tex-smart-umlauts-mode #[(&optional arg) "\306  \307=\203\n?\202 \247\203 \310W\203\311\202\312\313\303!\2032\314\302 \"\n\2032\302 B\n\203S\f\203> \204A\315 \210\316 \210\317\320\321\"\210\322\323\324\311\312$\210\202`\314\321\"\325\323\324\312#\210\326\327\n\203j\330\202k\331\"\210\332\333!\203\222\306 \203\306 \232\203\222\334\"\335\336\n\203\214\337\202\215\340\"#\210))\341 \210\n\207" [#1=#:last-message arg tex-smart-umlauts-mode local-minor-modes tex-smart-umlauts--decode-table tex-smart-umlauts--encode-table current-message toggle 1 nil t boundp delq tex-smart-umlauts--update-tables tex-smart-umlauts--decode add-to-list buffer-file-format tex-smart-umlauts add-hook before-revert-hook tex-smart-umlauts--before-revert remove-hook run-hooks tex-smart-umlauts-mode-hook tex-smart-umlauts-mode-on-hook tex-smart-umlauts-mode-off-hook called-interactively-p any " in current buffer" message "Tex-Smart-Umlauts mode %sabled%s" "en" "dis" force-mode-line-update local] 5 (#$ . 12722) (list (if current-prefix-arg (prefix-numeric-value current-prefix-arg) 'toggle))]) (defvar tex-smart-umlauts-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\310\313\300!\205#\310\211%\210\314\315!\207" [tex-smart-umlauts-mode-map tex-smart-umlauts-mode-hook variable-documentation put "Hook run after entering or leaving `tex-smart-umlauts-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 tex-smart-umlauts-mode boundp provide tex-smart-umlauts] 6)