Debian Codegraph @

mew-lang-jp.el

raw
1 ;;-*-coding:iso-2022-7bit;-*-
2 ;;; mew-lang-jp.el --- Japanese specific stuff for Mew
3
4 ;; Author: Mito <[email protected]>
5 ;; Kazu Yamamoto <[email protected]>
6 ;; Created: Sep 08, 1997
7
8 ;;; Code:
9
10 ;; from jisx0201.el
11 (defvar mew-katakana-alist
12 '(( 161 . "(I'(B" )
13 ( 162 . "(I1(B" )
14 ( 163 . "(I((B" )
15 ( 164 . "(I2(B" )
16 ( 165 . "(I)(B" )
17 ( 166 . "(I3(B" )
18 ( 167 . "(I*(B" )
19 ( 168 . "(I4(B" )
20 ( 169 . "(I+(B" )
21 ( 170 . "(I5(B" )
22 ( 171 . "(I6(B" )
23 ( 172 . "(I6^(B" )
24 ( 173 . "(I7(B" )
25 ( 174 . "(I7^(B" )
26 ( 175 . "(I8(B" )
27 ( 176 . "(I8^(B" )
28 ( 177 . "(I9(B" )
29 ( 178 . "(I9^(B" )
30 ( 179 . "(I:(B" )
31 ( 180 . "(I:^(B" )
32 ( 181 . "(I;(B" )
33 ( 182 . "(I;^(B" )
34 ( 183 . "(I<(B" )
35 ( 184 . "(I<^(B" )
36 ( 185 . "(I=(B" )
37 ( 186 . "(I=^(B" )
38 ( 187 . "(I>(B" )
39 ( 188 . "(I>^(B" )
40 ( 189 . "(I?(B" )
41 ( 190 . "(I?^(B" )
42 ( 191 . "(I@(B" )
43 ( 192 . "(I@^(B" )
44 ( 193 . "(IA(B" )
45 ( 194 . "(IA^(B" )
46 ( 195 . "(I/(B" )
47 ( 196 . "(IB(B" )
48 ( 197 . "(IB^(B" )
49 ( 198 . "(IC(B" )
50 ( 199 . "(IC^(B" )
51 ( 200 . "(ID(B" )
52 ( 201 . "(ID^(B" )
53 ( 202 . "(IE(B" )
54 ( 203 . "(IF(B" )
55 ( 204 . "(IG(B" )
56 ( 205 . "(IH(B" )
57 ( 206 . "(II(B" )
58 ( 207 . "(IJ(B" )
59 ( 208 . "(IJ^(B" )
60 ( 209 . "(IJ_(B" )
61 ( 210 . "(IK(B" )
62 ( 211 . "(IK^(B" )
63 ( 212 . "(IK_(B" )
64 ( 213 . "(IL(B" )
65 ( 214 . "(IL^(B" )
66 ( 215 . "(IL_(B" )
67 ( 216 . "(IM(B" )
68 ( 217 . "(IM^(B" )
69 ( 218 . "(IM_(B" )
70 ( 219 . "(IN(B" )
71 ( 220 . "(IN^(B" )
72 ( 221 . "(IN_(B" )
73 ( 222 . "(IO(B" )
74 ( 223 . "(IP(B" )
75 ( 224 . "(IQ(B" )
76 ( 225 . "(IR(B" )
77 ( 226 . "(IS(B" )
78 ( 227 . "(I,(B" )
79 ( 228 . "(IT(B" )
80 ( 229 . "(I-(B" )
81 ( 230 . "(IU(B" )
82 ( 231 . "(I.(B" )
83 ( 232 . "(IV(B" )
84 ( 233 . "(IW(B" )
85 ( 234 . "(IX(B" )
86 ( 235 . "(IY(B" )
87 ( 236 . "(IZ(B" )
88 ( 237 . "(I[(B" )
89 ( 239 . "(I\(B" ) ; (I\(B -> $B%o(B $B$KJQ49$9$k$h$&$K(B
90 ( 238 . "(I\(B" ) ; $B%o$H%n$N=gHV$,8r49$7$F$"$k!#(B
91 ( 240 . "(I((B" )
92 ( 241 . "(I*(B" )
93 ( 242 . "(I&(B" )
94 ( 243 . "(I](B" )
95 ( 244 . "(I3^(B" )
96 ( 245 . "(I6(B" )
97 ( 246 . "(I9(B" )))
98
99 (defvar mew-katakana-kigou-alist
100 '(( 162 . "(I$(B" )
101 ( 163 . "(I!(B" )
102 ( 166 . "(I%(B" )
103 ( 171 . "(I^(B" )
104 ( 172 . "(I_(B" )
105 ( 188 . "(I0(B" )
106 ( 214 . "(I"(B" )
107 ( 215 . "(I#(B" )))
108
109 (defvar mew-dakuon-list
110 '( ?$B%+(B ?$B%-(B ?$B%/(B ?$B%1(B ?$B%3(B
111 ?$B%5(B ?$B%7(B ?$B%9(B ?$B%;(B ?$B%=(B
112 ?$B%?(B ?$B%A(B ?$B%D(B ?$B%F(B ?$B%H(B
113 ?$B%O(B ?$B%R(B ?$B%U(B ?$B%X(B ?$B%[(B))
114
115 (defvar mew-handakuon-list (memq ?$B%O(B mew-dakuon-list))
116
117 (defun mew-hankaku-code (ch)
118 (let* ((str (char-to-string ch))
119 (ent (rassoc str mew-katakana-alist)))
120 (if ent (car ent))))
121
122 (defun mew-hankaku-kigou-code (ch)
123 (let* ((str (char-to-string ch))
124 (ent (rassoc str mew-katakana-kigou-alist)))
125 (if ent (car ent))))
126
127 (defun mew-zenkaku-katakana-region (beg end)
128 (let (ch wk)
129 (save-restriction
130 (narrow-to-region beg end)
131 (save-excursion
132 (goto-char (point-min))
133 (while (re-search-forward "\\ck" nil t)
134 (setq ch (preceding-char))
135 (setq wk nil)
136 (cond
137 ((= ch ?(I^(B)
138 (save-excursion
139 (backward-char 1)
140 (setq wk (preceding-char)))
141 (cond
142 ((= wk ?$B%&(B)
143 (delete-char -2)
144 (insert "$B%t(B"))
145 ((setq wk (memq wk mew-dakuon-list))
146 (delete-char -2)
147 (insert (1+ (car wk))))
148 (t
149 (delete-char -1)
150 (insert "$B!+(B"))))
151 ((= ch ?(I_(B)
152 (save-excursion
153 (backward-char 1)
154 (setq wk (preceding-char)))
155 (if (setq wk (memq wk mew-handakuon-list))
156 (progn
157 (delete-char -2)
158 (insert (+ 2 (car wk))))
159 (delete-char -1)
160 (insert "$B!,(B")))
161 ((setq wk (mew-hankaku-code ch))
162 (delete-char -1)
163 (insert (make-char mew-lc-jp ?\245 wk)))
164 ((setq wk (mew-hankaku-kigou-code ch))
165 (delete-char -1)
166 (insert (make-char mew-lc-jp ?\241 wk)))))))))
167
168 ;;
169
170 (defvar mew-thread-indent-strings ["$B(2(B" "$B(1(B" "$B(-(B" "$B!!(B"])
171
172 (defvar mew-highlight-body-regex-cite
173 "^\\(\\([ \t]\\{,7\\}\\([>:|$B!S!d!U"d!'!C(B]\\|\\w+\\([._-]+\\w+\\)*>+\\)\\)+\\).*")
174
175 ;; mew-regex-url is defined in mew-vars.el. This duplication is intentional.
176 ;; This definition includes full-width space characters.
177 (defvar mew-regex-url
178 (concat
179 "\\b\\("
180 "\\(\\(file\\|news\\|mailto\\):\\)"
181 "\\|"
182 "\\(\\(s?https?\\|ftp\\|gopher\\|telnet\\|wais\\)://\\)"
183 "\\)"
184 "[^ $B!!(B\t\n>)\"]*"
185 "[^] $B!!(B\t\n>.,:)\"]+"))
186
187 (provide 'mew-lang-jp)
188
189 ;;; Copyright Notice:
190
191 ;; Copyright (C) 1997-2015 Mew developing team.
192 ;; All rights reserved.
193
194 ;; Redistribution and use in source and binary forms, with or without
195 ;; modification, are permitted provided that the following conditions
196 ;; are met:
197 ;;
198 ;; 1. Redistributions of source code must retain the above copyright
199 ;; notice, this list of conditions and the following disclaimer.
200 ;; 2. Redistributions in binary form must reproduce the above copyright
201 ;; notice, this list of conditions and the following disclaimer in the
202 ;; documentation and/or other materials provided with the distribution.
203 ;; 3. Neither the name of the team nor the names of its contributors
204 ;; may be used to endorse or promote products derived from this software
205 ;; without specific prior written permission.
206 ;;
207 ;; THIS SOFTWARE IS PROVIDED BY THE TEAM AND CONTRIBUTORS ``AS IS'' AND
208 ;; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
209 ;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
210 ;; PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE TEAM OR CONTRIBUTORS BE
211 ;; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
212 ;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
213 ;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
214 ;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
215 ;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
216 ;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
217 ;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
218
219 ;;; mew-lang-jp.el ends here