Debian Codegraph @

mew-lang-latin.el

raw
1 ;;; mew-lang-latin.el --- Latin specific stuff for Mew
2
3 ;; Author: Kazu Yamamoto <[email protected]>
4 ;; Created: Dec 11, 2002
5
6 ;;; Code:
7
8 (require 'mew)
9
10 (defvar mew-latin01-list '(36 38 40 52 56 60 61 62))
11
12 (defvar mew-charset-latin-alist
13 '(("iso-8859-1" latin-iso8859-1 latin-iso8859-15)
14 ("iso-8859-15" latin-iso8859-15 latin-iso8859-1)))
15
16 (defun mew-latin-make-regex (lc lst)
17 (mapconcat (lambda (x) (char-to-string (make-char lc x))) lst "\\|"))
18
19 (defvar mew-latin0-regex
20 (mew-latin-make-regex 'latin-iso8859-15 mew-latin01-list))
21
22 (defvar mew-latin1-regex
23 (mew-latin-make-regex 'latin-iso8859-1 mew-latin01-list))
24
25 (defun mew-latin0-region (beg end)
26 (let* (charset ent to from ch lc conflict0 conflict1)
27 (save-restriction
28 (narrow-to-region beg end)
29 (setq conflict0
30 (save-excursion
31 (goto-char (point-min))
32 (re-search-forward mew-latin0-regex nil t)))
33 (setq conflict1
34 (save-excursion
35 (goto-char (point-min))
36 (re-search-forward mew-latin1-regex nil t)))
37 (unless (and conflict0 conflict1) ;; mew-charset-m17n
38 (cond
39 (conflict0
40 (setq charset "iso-8859-15"))
41 (conflict1
42 (setq charset "iso-8859-1"))
43 (t
44 (setq charset mew-charset-latin)))
45 (setq ent (assoc charset mew-charset-latin-alist))
46 (mew-set '(nil to from) ent)
47 (save-excursion
48 (goto-char (point-min))
49 (while (re-search-forward "\\cl" nil t)
50 (setq ch (split-char (preceding-char)))
51 (setq lc (car ch))
52 (when (eq lc from)
53 (delete-char -1)
54 (insert (make-char to (nth 1 ch))))))))))
55
56 (provide 'mew-lang-latin)
57
58 ;;; Copyright Notice:
59
60 ;; Copyright (C) 2002-2015 Mew developing team.
61 ;; All rights reserved.
62
63 ;; Redistribution and use in source and binary forms, with or without
64 ;; modification, are permitted provided that the following conditions
65 ;; are met:
66 ;;
67 ;; 1. Redistributions of source code must retain the above copyright
68 ;; notice, this list of conditions and the following disclaimer.
69 ;; 2. Redistributions in binary form must reproduce the above copyright
70 ;; notice, this list of conditions and the following disclaimer in the
71 ;; documentation and/or other materials provided with the distribution.
72 ;; 3. Neither the name of the team nor the names of its contributors
73 ;; may be used to endorse or promote products derived from this software
74 ;; without specific prior written permission.
75 ;;
76 ;; THIS SOFTWARE IS PROVIDED BY THE TEAM AND CONTRIBUTORS ``AS IS'' AND
77 ;; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
78 ;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
79 ;; PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE TEAM OR CONTRIBUTORS BE
80 ;; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
81 ;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
82 ;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
83 ;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
84 ;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
85 ;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
86 ;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
87
88 ;;; mew-lang-latin.el ends here