comparison lisp/language/arabic-util.el @ 165:5a88923fcbfe r20-3b9

Import from CVS: tag r20-3b9
author cvs
date Mon, 13 Aug 2007 09:44:42 +0200
parents
children 85ec50267440
comparison
equal deleted inserted replaced
164:4e0740e5aab2 165:5a88923fcbfe
1 ;;; arabic-util.el --- minor mode for editing Arabic.
2
3 ;; Copyright (C) 1994 Free Software Foundation, Inc.
4
5 ;; Keywords: multilingual, Arabic
6
7 ;; This file is part of XEmacs.
8
9 ;; XEmacs is free software; you can redistribute it and/or modify it
10 ;; under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 2, or (at your option)
12 ;; any later version.
13
14 ;; XEmacs is distributed in the hope that it will be useful, but
15 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 ;; General Public License for more details.
18
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with XEmacs; see the file COPYING. If not, write to the
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 ;; Boston, MA 02111-1307, USA.
23
24 ;;; Commentary:
25
26 ;; Synched up with: Mule 2.3.
27
28 ;;; Code:
29
30 ;;; 94.6.13 created for Mule Ver.1.1 by Takahashi N. <ntakahas@etl.go.jp>
31
32 (require 'visual-mode)
33
34 (defvar arabic-mode-indicator " [2](3=a:GJ[0](B"
35 "String displayed in mode-line.
36 \" Arabic\" for Arabic keyboard input, \" [2](3=a:GJ[0](B\".")
37
38 (make-variable-buffer-local 'arabic-mode-indicator)
39
40 ;;;###autoload
41 (defvar arabic-mode nil
42 "Non-nil if in arabic-mode.")
43
44 (make-variable-buffer-local 'arabic-mode)
45
46 (if (not (assq 'arabic-mode minor-mode-alist))
47 (setq minor-mode-alist
48 (cons '(arabic-mode arabic-mode-indicator) minor-mode-alist)))
49
50 (define-key global-map [(meta \\)] 'arabic-mode)
51
52 (defvar arabic-input-arabic-char t
53 "Non-nil if key input is Arabic. Nil if key input is ASCII.")
54
55 (make-variable-buffer-local 'arabic-input-arabic-char)
56
57 (defvar arabic-input-keymap 'arabic-keymap-0
58 "Specify which input table is used for Arabic input. Should be on of:
59 arabic-keymap-0 (default),
60 arabic-keymap-1 (Farsi standard), or
61 arabic-keymap-2 (Microsoft Arabic).")
62
63 (defvar arabic-translate-table
64 (cond
65 ((eq arabic-input-keymap 'arabic-keymap-0)
66 [?[2](3![0](B ?[2](3"[0](B ?[2](3-[0](B nil nil nil nil ?' ?[2](3#[0](B ?[2](3$[0](B nil nil ?[2](3%[0](B nil ?[2](3&[0](B ?[2](49[0](B
67 ?(2![0](B ?(2"[0](B ?(2#[0](B ?(2$[0](B ?(2%[0](B ?(2&[0](B ?(2'[0](B ?(2([0](B ?(2)[0](B ?(2*[0](B ?[2](3'[0](B ?[2](3([0](B ?[2](3*[0](B nil ?[2](3+[0](B ?[2](3)[0](B
68 nil ?[2](4][0](B nil ?[2](4g[0](B ?[2](4A[0](B nil nil ?[2](4O[0](B ?[2](4-[0](B nil nil ?[2](41[0](B nil nil nil nil
69 nil nil nil ?[2](4=[0](B ?[2](4E[0](B nil nil nil ?[2](3h[0](B nil ?[2](4I[0](B nil nil nil nil nil
70 ?[2](4M[0](B ?[2](38[0](B ?[2](4#[0](B ?[2](4'[0](B ?[2](3B[0](B nil ?[2](4Q[0](B ?[2](4k[0](B ?[2](3Z[0](B nil ?[2](4)[0](B ?[2](4U[0](B ?[2](4Y[0](B ?[2](3T[0](B ?[2](4[[0](B ?[2](3<[0](B
71 ?[2](4e[0](B ?[2](4S[0](B ?[2](3F[0](B ?[2](45[0](B ?[2](4%[0](B nil nil ?[2](3^[0](B ?[2](3D[0](B ?[2](4_[0](B ?[2](3H[0](B nil ?| nil nil])
72 ((eq arabic-input-keymap 'arabic-keymap-1)
73 [?[2](3![0](B ?[2](3"[0](B nil nil nil nil nil nil ?[2](3#[0](B ?[2](3$[0](B nil nil ?[2](3%[0](B nil ?[2](3&[0](B nil
74 ?(2![0](B ?(2"[0](B ?(2#[0](B ?(2$[0](B ?(2%[0](B ?(2&[0](B ?(2'[0](B ?(2([0](B ?(2)[0](B ?(2*[0](B ?[2](3'[0](B ?[2](4U[0](B ?[2](3*[0](B nil ?[2](3+[0](B ?[2](3)[0](B
75 nil nil ?[2](3h[0](B nil nil nil ?[2](4e[0](B ?[2](3.[0](B nil nil nil nil nil nil nil nil
76 nil nil nil nil nil nil ?[2](30[0](B nil nil nil nil ?[2](4)[0](B nil ?[2](4g[0](B nil nil
77 nli ?[2](49[0](B ?[2](3H[0](B ?[2](3D[0](B ?[2](4_[0](B ?[2](4S[0](B ?[2](4#[0](B ?[2](38[0](B ?[2](4%[0](B nil ?[2](4Y[0](B ?[2](4[[0](B ?[2](3T[0](B ?[2](3^[0](B ?[2](3F[0](B ?[2](41[0](B
78 ?[2](4-[0](B ?[2](4A[0](B ?[2](4Q[0](B ?[2](45[0](B ?[2](4O[0](B ?[2](3Z[0](B ?[2](3B[0](B ?[2](4=[0](B ?[2](4E[0](B ?[2](4M[0](B ?[2](4I[0](B nil nli nil nil ])
79 (t
80 [?[2](3![0](B ?[2](3"[0](B ?\" ?# ?$ ?% ?& ?' ?[2](3#[0](B ?[2](3$[0](B ?* ?+ ?[2](3^[0](B ?- ?[2](3H[0](B ?[2](4I[0](B
81 ?(2![0](B ?(2"[0](B ?(2#[0](B ?(2$[0](B ?(2%[0](B ?(2&[0](B ?(2'[0](B ?(2([0](B ?(2)[0](B ?(2*[0](B ?[2](3'[0](B ?[2](4U[0](B ?, ?= ?. ?[2](3)[0](B
82 ?@ nil ?[2](3b[0](B ?{ ?[ nil ?] ?[2](3c[0](B ?[2](30[0](B nil nil ?[2](3%[0](B ?/ ?` ?[2](3.[0](B nil
83 ?[2](3([0](B nil nil nil ?[2](3d[0](B ?' ?} nil nil ?[2](34[0](B ?~ ?[2](4)[0](B ?\\ ?[2](3B[0](B ?^ ?_
84 ?[2](3D[0](B ?[2](49[0](B ?[2](3e[0](B ?[2](32[0](B ?[2](4_[0](B ?[2](4'[0](B ?[2](4#[0](B ?[2](4Y[0](B ?[2](38[0](B ?[2](3Z[0](B ?[2](4%[0](B ?[2](4[[0](B ?[2](3T[0](B ?[2](3<[0](B ?[2](4][0](B ?[2](41[0](B
85 ?[2](4-[0](B ?[2](4A[0](B ?[2](4S[0](B ?[2](45[0](B ?[2](4Q[0](B ?[2](4M[0](B ?[2](3F[0](B ?[2](4=[0](B ?[2](3-[0](B ?[2](4O[0](B ?[2](4![0](B ?< ?| ?> nil ])))
86
87 (defvar arabic-mode-map
88 (let ((map (make-keymap)))
89 (substitute-key-definition 'self-insert-command
90 'arabic-self-insert-command
91 map global-map)
92
93 (define-key map [(control c) (control c)] 'arabic-mode)
94 (define-key map [(control d)] 'arabic-delete-char)
95 (define-key map [(control k)] 'arabic-kill-line)
96 (define-key map [(control m)] 'arabic-newline)
97 (define-key map [(control o)] 'arabic-open-line)
98 (define-key map [(control w)] 'arabic-kill-region)
99 (define-key map [(control y)] 'arabic-yank)
100 (define-key map [delete] 'arabic-backward-delete-char)
101 (define-key map [(meta d)] 'arabic-delete-word)
102 (define-key map [(meta y)] 'arabic-yank-pop)
103 (define-key map [(meta z)] 'arabic-help)
104 (define-key map [(meta \\)] 'arabic-toggle-input-char)
105 (define-key map [(meta delete)] 'arabic-backward-kill-word)
106
107 (define-key map [(control n)] 'visual-next-line)
108 (define-key map [(control p)] 'visual-previous-line)
109 (define-key map [(meta <)] 'visual-beginning-of-buffer)
110 (define-key map [(meta >)] 'visual-end-of-buffer)
111 (define-key map [up] 'visual-previous-line)
112 (define-key map [down] 'visual-next-line)
113 (define-key map [home] 'visual-beginning-of-buffer)
114 (define-key map [end] 'visual-end-of-buffer)
115 (define-key map [left] 'visual-move-to-left-char)
116 (define-key map [right] 'visual-move-to-right-char)
117 (define-key map [(meta left)] 'visual-move-to-left-word)
118 (define-key map [(meta right)] 'visual-move-to-right-word)
119
120 (if visual-use-lr-commands
121 (progn
122 (define-key map [(control a)] 'visual-left-end-of-line)
123 (define-key map [(control b)] 'visual-move-to-left-char)
124 (define-key map [(control e)] 'visual-right-end-of-line)
125 (define-key map [(control f)] 'visual-move-to-right-char)
126 (define-key map [(meta b)] 'visual-move-to-left-word)
127 (define-key map [(meta f)] 'visual-move-to-right-word))
128 (define-key map [(control a)] 'visual-beginning-of-line)
129 (define-key map [(control b)] 'visual-backward-char)
130 (define-key map [(control e)] 'visual-end-of-line)
131 (define-key map [(control f)] 'visual-forward-char)
132 (define-key map [(meta b)] 'visual-backward-word)
133 (define-key map [(meta f)] 'visual-forward-word))
134
135 (cond
136 ((eq arabic-input-keymap 'arabic-keymap-0)
137 (define-key map [?~] 'arabic-insert-madda)
138 (define-key map [?'] 'arabic-insert-hamza)
139 (define-key map [?a] 'arabic-insert-alif)
140 (define-key map [?_] 'arabic-make-connection)
141 (define-key map [?|] 'arabic-cut-connection))
142 ((eq arabic-input-keymap 'arabic-keymap-1)
143 (define-key map [?~] 'arabic-insert-madda)
144 (define-key map [?'] 'arabic-insert-hamza)
145 (define-key map [?a] 'arabic-insert-alif)
146 (define-key map [?_] 'arabic-make-connection)
147 (define-key map [?|] 'arabic-cut-connection)
148 (define-key map [(alt \;)] 'arabic-insert-gaaf)
149 (define-key map [(alt v)] 'arabic-insert-isolated-hamza))
150 (t
151 (define-key map [(alt z)] 'arabic-insert-madda)
152 (define-key map [(alt x)] 'arabic-insert-hamza)
153 (define-key map [(alt h)] 'arabic-insert-alif)
154 (define-key map [(alt _)] 'arabic-make-connection)
155 (define-key map [(alt |)] 'arabic-cut-connection)))
156
157 map)
158 "minor-mode-keymap for arabic-mode.")
159
160 (if (not (assq 'arabic-mode minor-mode-map-alist))
161 (setq minor-mode-map-alist
162 (cons (cons 'arabic-mode arabic-mode-map) minor-mode-map-alist)))
163
164 (defvar arabic-help-string
165 (cond
166 ((eq arabic-input-keymap 'arabic-keymap-0)
167 "\
168 Keymap in Arabic-mode
169
170 +----------------------------------------------------------------+
171 |! [2](3"[0](B |@ |# |$ |% |^ |& |* |( [2](3#[0](B |) [2](3$[0](B |_ |+ |~ |
172 |1 (2"[0](B |2 (2#[0](B |3 (2$[0](B |4 (2%[0](B |5 (2&[0](B |6 (2'[0](B |7 (2([0](B |8 (2)[0](B |9 (2*[0](B |0 (2![0](B |- |= |` [2](4M[0](B|
173 +----------------------------------------------------------------+
174 |Q |W |E |R |T [2](4E[0](B|Y |U |I |O |P |
175 |q [2](4S[0](B|w [2](3^[0](B |e |r [2](3F[0](B |t [2](4%[0](B|y [2](4_[0](B|u |i |o [2](3<[0](B |p [2](4e[0](B|
176 +--------------------------------------------------------+
177 |A [2](4][0](B|S [2](4=[0](B|D [2](4A[0](B|F |G [2](4O[0](B|H [2](4-[0](B|J |K [2](41[0](B|L |: [2](3'[0](B |\" [2](3-[0](B |
178 |a [2](38[0](B |s [2](45[0](B|d [2](3B[0](B |f [2](4Q[0](B|g [2](4k[0](B|h [2](3Z[0](B |j [2](4)[0](B|k [2](4U[0](B|l [2](4Y[0](B|; [2](3([0](B |' |
179 +------------------------------------------------------+
180 |Z [2](4I[0](B|X [2](3h[0](B |C [2](4g[0](B|V |B |N |M |< [2](3*[0](B |> [2](3+[0](B |? [2](3)[0](B |
181 |z [2](3H[0](B |x [2](3D[0](B |c [2](4'[0](B|v |b [2](4#[0](B|n [2](4[[0](B|m [2](3T[0](B |, [2](3%[0](B |. [2](3&[0](B |/ [2](49[0](B|
182 +-------------------------------------------------+")
183
184 ((eq arabic-input-keymap 'arabic-keymap-1)
185 "\
186 Keymap in Arabic-mode +--------------+
187 | ALT SHIFT|
188 +-------------------------------------------------+ |ASCII ARABIC|
189 | [2](3"[0](B | | | | | | | | [2](3#[0](B | [2](3$[0](B | +--------------+
190 |1 (2"[0](B |2 (2#[0](B |3 (2$[0](B |4 (2%[0](B |5 (2&[0](B |6 (2'[0](B |7 (2([0](B |8 (2)[0](B |9 (2*[0](B |0 (2![0](B |
191 +-------------------------------------------------------------+
192 | | | | | | | | | | | | |
193 |q [2](4A[0](B|w [2](4=[0](B|e [2](4S[0](B|r [2](4Q[0](B|t [2](4O[0](B|y [2](4M[0](B|u [2](3Z[0](B |i |o [2](41[0](B|p [2](4-[0](B|[ [2](4)[0](B|] [2](4g[0](B|
194 +-----------------------------------------------------------+
195 | | | | [2](4e[0](B| [2](3.[0](B | | | | |[2](4k[0](B [2](3'[0](B|
196 |a [2](49[0](B|s [2](45[0](B|d [2](4_[0](B|f [2](4#[0](B|g [2](38[0](B |h [2](4%[0](B|j [2](4Y[0](B|k [2](4[[0](B|l [2](3T[0](B |; [2](4U[0](B|
197 +---------------------------------------------------+
198 | | | |[2](3-[0](B [2](30[0](B | [2](3h[0](B | | | [2](3*[0](B | [2](3+[0](B | [2](3)[0](B |
199 |z [2](4I[0](B|x [2](4E[0](B|c [2](3D[0](B |v [2](3B[0](B |b [2](3H[0](B |n [2](3F[0](B |m [2](3^[0](B |, [2](3%[0](B |. [2](3&[0](B |/ |
200 +-------------------------------------------------+")
201
202 (t
203 "\
204 +-----------------+
205 |S-ASCII S-Arabic|
206 | ASCII Arabic | +----+
207 +-----------------+ || ||
208 |\\ \\|
209 +-----------------------------------------------------------+
210 |! [2](3"[0](B|@ @|# #|$ $|% %|^ ^|& &|* *|( [2](3#[0](B|) [2](3$[0](B|_ _|+ +|
211 |1 (2"[0](B|2 (2#[0](B|3 (2$[0](B|4 (2%[0](B|5 (2&[0](B|6 (2'[0](B|7 (2([0](B|8 (2)[0](B|9 (2*[0](B|0 (2![0](B|- -|= =|
212 +-------------------------------------------------------------+
213 |Q |W |E |R |T [2](3d[0](B|Y [2](34[0](B|U '|I |O |P [2](3([0](B|{ <|} >|
214 | [2](4A[0](B| [2](4=[0](B| [2](4'[0](B| [2](4S[0](B| [2](4Q[0](B| [2](4O[0](B| [2](4M[0](B| [2](3Z[0](B| [2](41[0](B| [2](4-[0](B|[ [2](4)[0](B|] [2](3B[0](B|
215 +-------------------------------------------------------------+
216 |A |S |D [|F ]|G [2](3c[0](B|H [2](30[0](B|J |K [2](3%[0](B|L /|: [2](3'[0](B|\" \" |~[2](3,[0](B |
217 | [2](49[0](B| [2](45[0](B| [2](4_[0](B| [2](4#[0](B| [2](4Y[0](B| [2](38[0](B| [2](4%[0](B| [2](4[[0](B| [2](3T[0](B|\; [2](4U[0](B|' [2](4E[0](B|` [2](3D[0](B|
218 +-----------------------------------------------------------+
219 |Z ~|X |C {|V }|B [2](3b[0](B|N [2](3.[0](B|M `|< ,|> [2](3&[0](B|? [2](3)[0](B|
220 | [2](4![0](B| [2](3-[0](B| [2](32[0](B| [2](3F[0](B| [2](3e[0](B| [2](4][0](B| [2](3<[0](B|, [2](3^[0](B|. [2](3H[0](B|/ [2](4I[0](B|
221 +-------------------------------------------------+"))
222
223 "Document shown by arabic-help (M-z).")
224
225 ;;;###autoload
226 (defun arabic-mode (&optional arg)
227 "Toggle arabic-mode. With ARG, turn arabic-mode on iff ARG is positive."
228 (interactive "P")
229 (if (null arg)
230 (if arabic-mode (exit-arabic-mode) (enter-arabic-mode))
231 (if (> (prefix-numeric-value arg) 0)
232 (enter-arabic-mode)
233 (exit-arabic-mode))))
234
235 (defun enter-arabic-mode nil
236 "Enter arabic-mode."
237 (interactive)
238 (if (not arabic-mode)
239 (progn
240 (setq arabic-mode t
241 arabic-input-arabic-char t
242 arabic-mode-indicator " [2](3=a:GJ[0](B")
243 (redraw-modeline t)
244 (message "M-z to display arabic keymap.")
245 (run-hooks 'arabic-mode-hooks))))
246
247 (defun exit-arabic-mode nil
248 "Exit arabic-mode."
249 (interactive)
250 (if arabic-mode
251 (progn
252 (setq arabic-mode nil)
253 (redraw-modeline t))))
254
255 (defconst *arabic-adding-connection-to-right*
256 '((?[2](3.[0](B . ?[2](3/[0](B ) (?[2](3/[0](B . ?[2](3/[0](B )
257 (?[2](30[0](B . ?[2](31[0](B ) (?[2](31[0](B . ?[2](31[0](B )
258 (?[2](32[0](B . ?[2](33[0](B ) (?[2](33[0](B . ?[2](33[0](B )
259 (?[2](34[0](B . ?[2](35[0](B ) (?[2](35[0](B . ?[2](35[0](B )
260 (?[2](4![0](B . ?[2](4"[0](B) (?[2](36[0](B . ?[2](37[0](B ) (?[2](37[0](B . ?[2](37[0](B ) (?[2](4"[0](B . ?[2](4"[0](B)
261 (?[2](36[0](B . ?[2](37[0](B ) (?[2](37[0](B . ?[2](37[0](B )
262 (?[2](38[0](B . ?[2](39[0](B ) (?[2](39[0](B . ?[2](39[0](B )
263 (?[2](4#[0](B . ?[2](4$[0](B) (?[2](3:[0](B . ?[2](3;[0](B ) (?[2](3;[0](B . ?[2](3;[0](B ) (?[2](4$[0](B . ?[2](4$[0](B)
264 (?[2](3<[0](B . ?[2](3=[0](B ) (?[2](3=[0](B . ?[2](3=[0](B )
265 (?[2](4%[0](B . ?[2](4&[0](B) (?[2](3>[0](B . ?[2](3?[0](B ) (?[2](3?[0](B . ?[2](3?[0](B ) (?[2](4&[0](B . ?[2](4&[0](B)
266 (?[2](4'[0](B . ?[2](4([0](B) (?[2](3@[0](B . ?[2](3A[0](B ) (?[2](3A[0](B . ?[2](3A[0](B ) (?[2](4([0](B . ?[2](4([0](B)
267 (?[2](4)[0](B . ?[2](4,[0](B) (?[2](4*[0](B . ?[2](4+[0](B) (?[2](4+[0](B . ?[2](4+[0](B) (?[2](4,[0](B . ?[2](4,[0](B)
268 (?[2](4-[0](B . ?[2](40[0](B) (?[2](4.[0](B . ?[2](4/[0](B) (?[2](4/[0](B . ?[2](4/[0](B) (?[2](40[0](B . ?[2](40[0](B)
269 (?[2](41[0](B . ?[2](44[0](B) (?[2](42[0](B . ?[2](43[0](B) (?[2](43[0](B . ?[2](43[0](B) (?[2](44[0](B . ?[2](44[0](B)
270 (?[2](3B[0](B . ?[2](3C[0](B ) (?[2](3C[0](B . ?[2](3C[0](B )
271 (?[2](3D[0](B . ?[2](3E[0](B ) (?[2](3E[0](B . ?[2](3E[0](B )
272 (?[2](3F[0](B . ?[2](3G[0](B ) (?[2](3G[0](B . ?[2](3G[0](B )
273 (?[2](3H[0](B . ?[2](3I[0](B ) (?[2](3I[0](B . ?[2](3I[0](B )
274 (?[2](45[0](B . ?[2](48[0](B) (?[2](46[0](B . ?[2](47[0](B) (?[2](47[0](B . ?[2](47[0](B) (?[2](48[0](B . ?[2](48[0](B)
275 (?[2](49[0](B . ?[2](4<[0](B) (?[2](4:[0](B . ?[2](4;[0](B) (?[2](4;[0](B . ?[2](4;[0](B) (?[2](4<[0](B . ?[2](4<[0](B)
276 (?[2](4=[0](B . ?[2](4@[0](B) (?[2](4>[0](B . ?[2](4?[0](B) (?[2](4?[0](B . ?[2](4?[0](B) (?[2](4@[0](B . ?[2](4@[0](B)
277 (?[2](4A[0](B . ?[2](4D[0](B) (?[2](4B[0](B . ?[2](4C[0](B) (?[2](4C[0](B . ?[2](4C[0](B) (?[2](4D[0](B . ?[2](4D[0](B)
278 (?[2](4E[0](B . ?[2](4H[0](B) (?[2](4F[0](B . ?[2](4G[0](B) (?[2](4G[0](B . ?[2](4G[0](B) (?[2](4H[0](B . ?[2](4H[0](B)
279 (?[2](4I[0](B . ?[2](4L[0](B) (?[2](4J[0](B . ?[2](4K[0](B) (?[2](4K[0](B . ?[2](4K[0](B) (?[2](4L[0](B . ?[2](4L[0](B)
280 (?[2](4M[0](B . ?[2](4N[0](B) (?[2](3J[0](B . ?[2](3K[0](B ) (?[2](3K[0](B . ?[2](3K[0](B ) (?[2](4N[0](B . ?[2](4N[0](B)
281 (?[2](4O[0](B . ?[2](4P[0](B) (?[2](3L[0](B . ?[2](3M[0](B ) (?[2](3M[0](B . ?[2](3M[0](B ) (?[2](4P[0](B . ?[2](4P[0](B)
282 (?[2](4Q[0](B . ?[2](4R[0](B) (?[2](3N[0](B . ?[2](3O[0](B ) (?[2](3O[0](B . ?[2](3O[0](B ) (?[2](4R[0](B . ?[2](4R[0](B)
283 (?[2](4S[0](B . ?[2](4T[0](B) (?[2](3P[0](B . ?[2](3Q[0](B ) (?[2](3Q[0](B . ?[2](3Q[0](B ) (?[2](4T[0](B . ?[2](4T[0](B)
284 (?[2](4U[0](B . ?[2](4X[0](B) (?[2](4V[0](B . ?[2](4W[0](B) (?[2](4W[0](B . ?[2](4W[0](B) (?[2](4X[0](B . ?[2](4X[0](B)
285 (?[2](4Y[0](B . ?[2](4Z[0](B) (?[2](3R[0](B . ?[2](3S[0](B ) (?[2](3S[0](B . ?[2](3S[0](B ) (?[2](4Z[0](B . ?[2](4Z[0](B)
286 (?[2](3T[0](B . ?[2](3W[0](B ) (?[2](3U[0](B . ?[2](3V[0](B ) (?[2](3V[0](B . ?[2](3V[0](B ) (?[2](3W[0](B . ?[2](3W[0](B )
287 (?[2](4[[0](B . ?[2](4\[0](B) (?[2](3X[0](B . ?[2](3Y[0](B ) (?[2](3Y[0](B . ?[2](3Y[0](B ) (?[2](4\[0](B . ?[2](4\[0](B)
288 (?[2](3Z[0](B . ?[2](3][0](B ) (?[2](3[[0](B . ?[2](3\[0](B ) (?[2](3\[0](B . ?[2](3\[0](B ) (?[2](3][0](B . ?[2](3][0](B )
289 (?[2](3^[0](B . ?[2](3_[0](B ) (?[2](3_[0](B . ?[2](3_[0](B )
290 (?[2](4][0](B . ?[2](4^[0](B) (?[2](4^[0](B . ?[2](4^[0](B)
291 (?[2](4_[0](B . ?[2](4`[0](B) (?[2](3`[0](B . ?[2](3a[0](B ) (?[2](3a[0](B . ?[2](3a[0](B ) (?[2](4`[0](B . ?[2](4`[0](B)
292 (?[2](3b[0](B . ?[2](4a[0](B) (?[2](4a[0](B . ?[2](4a[0](B)
293 (?[2](3c[0](B . ?[2](4b[0](B) (?[2](4b[0](B . ?[2](4b[0](B)
294 (?[2](3d[0](B . ?[2](4c[0](B) (?[2](4c[0](B . ?[2](4c[0](B)
295 (?[2](3e[0](B . ?[2](4d[0](B) (?[2](4d[0](B . ?[2](4d[0](B)
296 (?[2](4e[0](B . ?[2](4f[0](B) (?[2](3f[0](B . ?[2](3g[0](B ) (?[2](3g[0](B . ?[2](3g[0](B ) (?[2](4f[0](B . ?[2](4f[0](B)
297 (?[2](4g[0](B . ?[2](4j[0](B) (?[2](4h[0](B . ?[2](4i[0](B) (?[2](4i[0](B . ?[2](4i[0](B) (?[2](4j[0](B . ?[2](4j[0](B)
298 (?[2](3h[0](B . ?[2](3i[0](B ) (?[2](3i[0](B . ?[2](3i[0](B )
299 (?[2](4k[0](B . ?[2](4n[0](B) (?[2](4l[0](B . ?[2](4m[0](B) (?[2](4m[0](B . ?[2](4m[0](B) (?[2](4n[0](B . ?[2](4n[0](B)))
300
301 (defconst *arabic-adding-connection-to-left*
302 '((?[2](4![0](B . ?[2](36[0](B ) (?[2](36[0](B . ?[2](36[0](B ) (?[2](37[0](B . ?[2](37[0](B ) (?[2](4"[0](B . ?[2](37[0](B)
303 (?[2](4#[0](B . ?[2](3:[0](B ) (?[2](3:[0](B . ?[2](3:[0](B ) (?[2](3;[0](B . ?[2](3;[0](B ) (?[2](4$[0](B . ?[2](3;[0](B )
304 (?[2](4%[0](B . ?[2](3>[0](B ) (?[2](3>[0](B . ?[2](3>[0](B ) (?[2](3?[0](B . ?[2](3?[0](B ) (?[2](4&[0](B . ?[2](3?[0](B )
305 (?[2](4'[0](B . ?[2](3@[0](B ) (?[2](3@[0](B . ?[2](3@[0](B ) (?[2](3A[0](B . ?[2](3A[0](B ) (?[2](4([0](B . ?[2](3A[0](B )
306 (?[2](4)[0](B . ?[2](4*[0](B) (?[2](4*[0](B . ?[2](4*[0](B) (?[2](4+[0](B . ?[2](4+[0](B) (?[2](4,[0](B . ?[2](4+[0](B)
307 (?[2](4-[0](B . ?[2](4.[0](B) (?[2](4.[0](B . ?[2](4.[0](B) (?[2](4/[0](B . ?[2](4/[0](B) (?[2](40[0](B . ?[2](4/[0](B)
308 (?[2](41[0](B . ?[2](42[0](B) (?[2](42[0](B . ?[2](42[0](B) (?[2](43[0](B . ?[2](43[0](B) (?[2](44[0](B . ?[2](43[0](B)
309 (?[2](45[0](B . ?[2](46[0](B) (?[2](46[0](B . ?[2](46[0](B) (?[2](47[0](B . ?[2](47[0](B) (?[2](48[0](B . ?[2](47[0](B)
310 (?[2](49[0](B . ?[2](4:[0](B) (?[2](4:[0](B . ?[2](4:[0](B) (?[2](4;[0](B . ?[2](4;[0](B) (?[2](4<[0](B . ?[2](4;[0](B)
311 (?[2](4=[0](B . ?[2](4>[0](B) (?[2](4>[0](B . ?[2](4>[0](B) (?[2](4?[0](B . ?[2](4?[0](B) (?[2](4@[0](B . ?[2](4?[0](B)
312 (?[2](4A[0](B . ?[2](4B[0](B) (?[2](4B[0](B . ?[2](4B[0](B) (?[2](4C[0](B . ?[2](4C[0](B) (?[2](4D[0](B . ?[2](4C[0](B)
313 (?[2](4E[0](B . ?[2](4F[0](B) (?[2](4F[0](B . ?[2](4F[0](B) (?[2](4G[0](B . ?[2](4G[0](B) (?[2](4H[0](B . ?[2](4G[0](B)
314 (?[2](4I[0](B . ?[2](4J[0](B) (?[2](4J[0](B . ?[2](4J[0](B) (?[2](4K[0](B . ?[2](4K[0](B) (?[2](4L[0](B . ?[2](4K[0](B)
315 (?[2](4M[0](B . ?[2](3J[0](B ) (?[2](3J[0](B . ?[2](3J[0](B ) (?[2](3K[0](B . ?[2](3K[0](B ) (?[2](4N[0](B . ?[2](3K[0](B )
316 (?[2](4O[0](B . ?[2](3L[0](B ) (?[2](3L[0](B . ?[2](3L[0](B ) (?[2](3M[0](B . ?[2](3M[0](B ) (?[2](4P[0](B . ?[2](3M[0](B )
317 (?[2](4Q[0](B . ?[2](3N[0](B ) (?[2](3N[0](B . ?[2](3N[0](B ) (?[2](3O[0](B . ?[2](3O[0](B ) (?[2](4R[0](B . ?[2](3O[0](B )
318 (?[2](4S[0](B . ?[2](3P[0](B ) (?[2](3P[0](B . ?[2](3P[0](B ) (?[2](3Q[0](B . ?[2](3Q[0](B ) (?[2](4T[0](B . ?[2](3Q[0](B )
319 (?[2](4U[0](B . ?[2](4V[0](B) (?[2](4V[0](B . ?[2](4V[0](B) (?[2](4W[0](B . ?[2](4W[0](B) (?[2](4X[0](B . ?[2](4W[0](B)
320 (?[2](4Y[0](B . ?[2](3R[0](B ) (?[2](3R[0](B . ?[2](3R[0](B ) (?[2](3S[0](B . ?[2](3S[0](B ) (?[2](4Z[0](B . ?[2](3S[0](B )
321 (?[2](3T[0](B . ?[2](3U[0](B ) (?[2](3U[0](B . ?[2](3U[0](B ) (?[2](3V[0](B . ?[2](3V[0](B ) (?[2](3W[0](B . ?[2](3V[0](B )
322 (?[2](4[[0](B . ?[2](3X[0](B ) (?[2](3X[0](B . ?[2](3X[0](B ) (?[2](3Y[0](B . ?[2](3Y[0](B ) (?[2](4\[0](B . ?[2](3Y[0](B )
323 (?[2](3Z[0](B . ?[2](3[[0](B ) (?[2](3[[0](B . ?[2](3[[0](B ) (?[2](3\[0](B . ?[2](3\[0](B ) (?[2](3][0](B . ?[2](3\[0](B )
324 (?[2](4_[0](B . ?[2](3`[0](B ) (?[2](3`[0](B . ?[2](3`[0](B ) (?[2](3a[0](B . ?[2](3a[0](B ) (?[2](4`[0](B . ?[2](3a[0](B )
325 (?[2](4e[0](B . ?[2](3f[0](B ) (?[2](3f[0](B . ?[2](3f[0](B ) (?[2](3g[0](B . ?[2](3g[0](B ) (?[2](4f[0](B . ?[2](3g[0](B)
326 (?[2](4g[0](B . ?[2](4h[0](B) (?[2](4h[0](B . ?[2](4h[0](B) (?[2](4i[0](B . ?[2](4i[0](B) (?[2](4j[0](B . ?[2](4i[0](B)
327 (?[2](4k[0](B . ?[2](4l[0](B) (?[2](4l[0](B . ?[2](4l[0](B) (?[2](4m[0](B . ?[2](4m[0](B) (?[2](4n[0](B . ?[2](4m[0](B)))
328
329 (defconst *arabic-removing-connection-from-right*
330 '((?[2](3/[0](B . ?[2](3.[0](B )
331 (?[2](31[0](B . ?[2](30[0](B )
332 (?[2](33[0](B . ?[2](32[0](B )
333 (?[2](35[0](B . ?[2](34[0](B )
334 (?[2](4"[0](B . ?[2](4![0](B) (?[2](37[0](B . ?[2](36[0](B )
335 (?[2](39[0](B . ?[2](38[0](B )
336 (?[2](4$[0](B . ?[2](4#[0](B) (?[2](3;[0](B . ?[2](3:[0](B )
337 (?[2](3=[0](B . ?[2](3<[0](B )
338 (?[2](4&[0](B . ?[2](4%[0](B) (?[2](3?[0](B . ?[2](3>[0](B )
339 (?[2](4([0](B . ?[2](4'[0](B) (?[2](3A[0](B . ?[2](3@[0](B )
340 (?[2](4,[0](B . ?[2](4)[0](B) (?[2](4+[0](B . ?[2](4*[0](B)
341 (?[2](40[0](B . ?[2](4-[0](B) (?[2](4/[0](B . ?[2](4.[0](B)
342 (?[2](44[0](B . ?[2](41[0](B) (?[2](43[0](B . ?[2](42[0](B)
343 (?[2](3C[0](B . ?[2](3B[0](B )
344 (?[2](3E[0](B . ?[2](3D[0](B )
345 (?[2](3G[0](B . ?[2](3F[0](B )
346 (?[2](3I[0](B . ?[2](3H[0](B )
347 (?[2](48[0](B . ?[2](45[0](B) (?[2](47[0](B . ?[2](46[0](B)
348 (?[2](4<[0](B . ?[2](49[0](B) (?[2](4;[0](B . ?[2](4:[0](B)
349 (?[2](4@[0](B . ?[2](4=[0](B) (?[2](4?[0](B . ?[2](4>[0](B)
350 (?[2](4D[0](B . ?[2](4A[0](B) (?[2](4C[0](B . ?[2](4B[0](B)
351 (?[2](4H[0](B . ?[2](4E[0](B) (?[2](4G[0](B . ?[2](4F[0](B)
352 (?[2](4L[0](B . ?[2](4I[0](B) (?[2](4K[0](B . ?[2](4J[0](B)
353 (?[2](4N[0](B . ?[2](4M[0](B) (?[2](3K[0](B . ?[2](3J[0](B )
354 (?[2](4P[0](B . ?[2](4O[0](B) (?[2](3M[0](B . ?[2](3L[0](B )
355 (?[2](4R[0](B . ?[2](4Q[0](B) (?[2](3O[0](B . ?[2](3N[0](B )
356 (?[2](4T[0](B . ?[2](4S[0](B) (?[2](3Q[0](B . ?[2](3P[0](B )
357 (?[2](4X[0](B . ?[2](4U[0](B) (?[2](4W[0](B . ?[2](4V[0](B)
358 (?[2](4Z[0](B . ?[2](4Y[0](B) (?[2](3S[0](B . ?[2](3R[0](B )
359 (?[2](3W[0](B . ?[2](3T[0](B ) (?[2](3V[0](B . ?[2](3U[0](B )
360 (?[2](4\[0](B . ?[2](4[[0](B) (?[2](3Y[0](B . ?[2](3X[0](B )
361 (?[2](3][0](B . ?[2](3Z[0](B ) (?[2](3\[0](B . ?[2](3[[0](B )
362 (?[2](3_[0](B . ?[2](3^[0](B )
363 (?[2](4^[0](B . ?[2](4][0](B)
364 (?[2](4`[0](B . ?[2](4_[0](B) (?[2](3a[0](B . ?[2](3`[0](B )
365 (?[2](4a[0](B . ?[2](3b[0](B )
366 (?[2](4b[0](B . ?[2](3c[0](B )
367 (?[2](4c[0](B . ?[2](3d[0](B )
368 (?[2](4d[0](B . ?[2](3e[0](B )
369 (?[2](4f[0](B . ?[2](4e[0](B) (?[2](3g[0](B . ?[2](3f[0](B )
370 (?[2](4j[0](B . ?[2](4g[0](B) (?[2](4i[0](B . ?[2](4h[0](B)
371 (?[2](3i[0](B . ?[2](3h[0](B)
372 (?[2](4n[0](B . ?[2](4k[0](B) (?[2](4m[0](B . ?[2](4l[0](B)))
373
374 (defconst *arabic-removing-connection-from-left*
375 '((?[2](36[0](B . ?[2](4![0](B) (?[2](37[0](B . ?[2](4"[0](B)
376 (?[2](3:[0](B . ?[2](4#[0](B) (?[2](3;[0](B . ?[2](4$[0](B)
377 (?[2](3>[0](B . ?[2](4%[0](B) (?[2](3?[0](B . ?[2](4&[0](B)
378 (?[2](3@[0](B . ?[2](4'[0](B) (?[2](3A[0](B . ?[2](4([0](B)
379 (?[2](4*[0](B . ?[2](4)[0](B) (?[2](4+[0](B . ?[2](4,[0](B)
380 (?[2](4.[0](B . ?[2](4-[0](B) (?[2](4/[0](B . ?[2](40[0](B)
381 (?[2](42[0](B . ?[2](41[0](B) (?[2](43[0](B . ?[2](44[0](B)
382 (?[2](46[0](B . ?[2](45[0](B) (?[2](47[0](B . ?[2](48[0](B)
383 (?[2](4:[0](B . ?[2](49[0](B) (?[2](4;[0](B . ?[2](4<[0](B)
384 (?[2](4>[0](B . ?[2](4=[0](B) (?[2](4?[0](B . ?[2](4@[0](B)
385 (?[2](4D[0](B . ?[2](4A[0](B) (?[2](4C[0](B . ?[2](4A[0](B)
386 (?[2](4F[0](B . ?[2](4E[0](B) (?[2](4G[0](B . ?[2](4H[0](B)
387 (?[2](4J[0](B . ?[2](4I[0](B) (?[2](4K[0](B . ?[2](4L[0](B)
388 (?[2](3J[0](B . ?[2](4M[0](B) (?[2](3K[0](B . ?[2](4N[0](B)
389 (?[2](3L[0](B . ?[2](4O[0](B) (?[2](3M[0](B . ?[2](4P[0](B)
390 (?[2](3N[0](B . ?[2](4Q[0](B) (?[2](3O[0](B . ?[2](4R[0](B)
391 (?[2](3P[0](B . ?[2](4S[0](B) (?[2](3Q[0](B . ?[2](4T[0](B)
392 (?[2](4V[0](B . ?[2](4U[0](B) (?[2](4W[0](B . ?[2](4X[0](B)
393 (?[2](3R[0](B . ?[2](4Y[0](B) (?[2](3S[0](B . ?[2](4Z[0](B)
394 (?[2](3U[0](B . ?[2](3T[0](B ) (?[2](3V[0](B . ?[2](3W[0](B )
395 (?[2](3X[0](B . ?[2](4[[0](B) (?[2](3Y[0](B . ?[2](4\[0](B)
396 (?[2](3[[0](B . ?[2](3Z[0](B ) (?[2](3\[0](B . ?[2](3][0](B )
397 (?[2](3`[0](B . ?[2](4_[0](B) (?[2](3a[0](B . ?[2](4`[0](B)
398 (?[2](4h[0](B . ?[2](4g[0](B) (?[2](4i[0](B . ?[2](4j[0](B)
399 (?[2](4l[0](B . ?[2](4k[0](B) (?[2](4m[0](B . ?[2](4n[0](B)))
400
401 (defun arabic-make-connection nil
402 "If possible, tie the two characters around the cursor."
403 (interactive)
404 (let ((lch (assoc (visual-char-left) *arabic-adding-connection-to-right*))
405 (rch (assoc (visual-char-right) *arabic-adding-connection-to-left*)))
406 (if (not (and lch rch))
407 (arabic-cut-connection)
408 (visual-replace-left-1-char (cdr lch))
409 (visual-replace-right-1-char (cdr rch)))))
410
411 (defun arabic-cut-connection nil
412 "Remove the connection between the two characters around the cursor, if any."
413 (interactive)
414 (let
415 ((lch (assoc (visual-char-left) *arabic-removing-connection-from-right*))
416 (rch (assoc (visual-char-right) *arabic-removing-connection-from-left*)))
417 (if lch
418 (visual-replace-left-1-char (cdr lch)))
419 (if rch
420 (visual-replace-right-1-char (cdr rch)))))
421
422 (defun arabic-insert-char (ch arg)
423 "Insert ARG (2nd arg; > 0) number of CHs (1st arg; character) around
424 visual point.
425 If CH is l2r, inserted on the left. Otherwise, on the right."
426 (while (> arg 0)
427 (arabic-insert-1-char ch)
428 (setq arg (1- arg))))
429
430 (defun arabic-insert-1-char (ch)
431 "Insert CH (1st arg; character) around visual point.
432 If CH is l2r, inserted on the left. Otherwise, on the right."
433 (if (= (visual-char-direction ch) 0)
434 ; if visual-char-direction = 0, always disjoint.
435 (progn
436 (arabic-cut-connection)
437 (visual-insert-left-1-char ch))
438 (visual-insert-left-1-char ch)
439 (arabic-make-connection)
440 (visual-move-to-left-1-char)
441 (arabic-make-connection)))
442
443 (defun arabic-self-insert-command (arg)
444 "Self-insert-command for arabic-mode."
445 (interactive "*p")
446 (let ((ch last-command-char))
447 (if arabic-input-arabic-char
448 (setq ch (aref arabic-translate-table (- ch 32))))
449 (if (null ch)
450 (beep)
451 (while (> arg 0)
452 (arabic-keyboard-insert-1-char ch)
453 (setq arg (1- arg))))))
454
455 (defun arabic-keyboard-insert-1-char (ch)
456 "Insert CH (1st arg; Arabic character) at visual cursor position.
457 if last-command is arabic-cut-connection, CH will not connected to the
458 right adjacent character (but connected to the left, if possible)."
459 (let ((rch (visual-char-right)))
460 (cond
461 ((= (visual-char-direction ch) 0)
462 (arabic-cut-connection)
463 (visual-insert-left-1-char ch))
464 ((eq last-command 'arabic-cut-connection)
465 (visual-insert-right-1-char ch)
466 (arabic-make-connection))
467 (t
468 (arabic-insert-1-char ch)))))
469
470 (defun arabic-insert-gaaf (arg)
471 "Insert gaaf as if it were typed from keyboard."
472 (interactive "*p")
473 (while (> arg 0)
474 (arabic-keyboard-insert-1-char ?[2](4k[0](B)
475 (setq arg (1- arg))))
476
477 (defun arabic-insert-isolated-hamza (arg)
478 "Insert an isolated hamza as if it were typed from keyboard."
479 (interactive "*p")
480 (while (> arg 0)
481 (arabic-keyboard-insert-1-char ?[2](3-[0](B)
482 (setq arg (1- arg))))
483
484 (defun arabic-insert-madda nil
485 "Put madda on the previous alif."
486 (interactive)
487 (let ((rch (visual-char-right)))
488 (cond
489 ((eq rch ?[2](38[0](B ) (visual-replace-right-1-char ?[2](3.[0](B ))
490 ((eq rch ?[2](39[0](B ) (visual-replace-right-1-char ?[2](3/[0](B ))
491 ((eq rch ?[2](3e[0](B ) (visual-replace-right-1-char ?[2](3b[0](B ))
492 ((eq rch ?[2](4d[0](B) (visual-replace-right-1-char ?[2](4a[0](B))
493 (t (beep)))))
494
495 (defun arabic-insert-alif (arg)
496 "Insert ARG number of alif's.
497 If the previous character is a laam, replace it with an alif+laam ligature."
498 (interactive "*p")
499 (let (rch)
500 (while (> arg 0)
501 (setq rch (visual-char-right))
502 (cond
503 ((eq last-command 'arabic-cut-connection)
504 (visual-insert-right-1-char ?[2](38[0](B))
505 ((or (eq rch ?[2](4Y[0](B) (eq rch ?[2](3R[0](B ))
506 (visual-replace-right-1-char ?[2](3e[0](B ))
507 ((or (eq rch ?[2](3S[0](B ) (eq rch ?[2](4Z[0](B))
508 (visual-replace-right-1-char ?[2](4d[0](B))
509 (t
510 (visual-insert-left-1-char ?[2](38[0](B )
511 (arabic-make-connection)
512 (visual-move-to-left-1-char)))
513 (setq arg (1- arg)))
514 (arabic-cut-connection)))
515
516 (defun arabic-insert-hamza (arg)
517 "Insert ARG number of hamza's.
518 Put it on/under previous characters, if possible."
519 (interactive "*p")
520 (let (rch)
521 (while (> arg 0)
522 (setq rch (visual-char-right))
523 (cond
524 ((eq last-command 'arabic-cut-connection)
525 (visual-insert-right-1-char ?[2](3-[0](B))
526 ((eq rch ?[2](38[0](B ) (visual-replace-right-1-char ?[2](30[0](B ))
527 ((eq rch ?[2](39[0](B ) (visual-replace-right-1-char ?[2](31[0](B ))
528 ((eq rch ?[2](30[0](B ) (visual-replace-right-1-char ?[2](34[0](B ))
529 ((eq rch ?[2](31[0](B ) (visual-replace-right-1-char ?[2](35[0](B ))
530 ((eq rch ?[2](3^[0](B ) (visual-replace-right-1-char ?[2](32[0](B ))
531 ((eq rch ?[2](3_[0](B ) (visual-replace-right-1-char ?[2](33[0](B ))
532 ((eq rch ?[2](4_[0](B) (visual-replace-right-1-char ?[2](4![0](B))
533 ((eq rch ?[2](3`[0](B ) (visual-replace-right-1-char ?[2](36[0](B ))
534 ((eq rch ?[2](3a[0](B ) (visual-replace-right-1-char ?[2](37[0](B ))
535 ((eq rch ?[2](4`[0](B) (visual-replace-right-1-char ?[2](4"[0](B))
536 ((eq rch ?[2](4][0](B) (visual-replace-right-1-char ?[2](4![0](B))
537 ((eq rch ?[2](4^[0](B) (visual-replace-right-1-char ?[2](4"[0](B))
538 ((eq rch ?[2](3e[0](B ) (visual-replace-right-1-char ?[2](3c[0](B ))
539 ((eq rch ?[2](4d[0](B) (visual-replace-right-1-char ?[2](4b[0](B))
540 ((eq rch ?[2](3c[0](B ) (visual-replace-right-1-char ?[2](3d[0](B ))
541 ((eq rch ?[2](4b[0](B) (visual-replace-right-1-char ?[2](4c[0](B))
542 (t (arabic-cut-connection)
543 (visual-insert-right-1-char ?[2](3-[0](B)))
544 (setq arg (1- arg)))))
545
546 (defun arabic-toggle-input-char nil
547 "Toggle Arabic key input and ASCII key input."
548 (interactive)
549 (if arabic-input-arabic-char
550 (setq arabic-input-arabic-char nil
551 arabic-mode-indicator " Arabic")
552 (setq arabic-input-arabic-char t
553 arabic-mode-indicator " [2](3=a:GJ[0](B"))
554 (redraw-modeline t))
555
556 (defun arabic-newline (arg)
557 "Newline for arabic-mode."
558 (interactive "*p")
559 (arabic-insert-char ?\n arg))
560
561 (defun arabic-open-line (arg)
562 "Openline for arabic-mode."
563 (interactive "*p")
564 (arabic-insert-char ?\n arg)
565 (visual-backward-char arg))
566
567 (defun arabic-delete-char (arg)
568 "Delete ARG (1st arg; integer) chars visually after visual point.
569 After that, Arabic ligature is performed."
570 (interactive "*p")
571 (visual-delete-char arg)
572 (arabic-make-connection))
573
574 (defun arabic-backward-delete-char (arg)
575 "Delete ARG (1st arg; integer) chars visually before visual point.
576 After that, Arabic ligature is performed."
577 (interactive "*p")
578 (visual-backward-delete-char arg)
579 (arabic-make-connection))
580
581 (defun arabic-kill-region (beg end)
582 "Kill-region command for arabic-mode."
583 (interactive "r")
584 (if (or (and buffer-read-only (not inhibit-read-only))
585 (text-property-not-all beg end 'read-only nil))
586 (visual-kill-region beg end)
587 (visual-kill-region beg end)
588 (arabic-make-connection)))
589
590 (defun arabic-kill-word (arg)
591 "Kill-word command for arabic-mode."
592 (interactive "*p")
593 (visual-kill-word arg)
594 (arabic-make-connection))
595
596 (defun arabic-backward-kill-word (arg)
597 "Backword-ill-word command for arabic-mode."
598 (interactive "*p")
599 (visual-backward-kill-word arg)
600 (arabic-make-connection))
601
602 (defun arabic-kill-line (&optional arg)
603 "Kill-line command for arabic-mode."
604 (interactive "*P")
605 (visual-kill-line arg)
606 (arabic-make-connection))
607
608 (defun arabic-yank (&optional arg)
609 "yank command for arabic-mode."
610 (interactive "*P")
611 (visual-yank arg)
612 (let ((p1 (point)) (p2 (mark t)))
613 (arabic-make-connection)
614 (goto-char p2)
615 (arabic-make-connection)
616 (goto-char p1)
617 (set-marker (mark-marker) p2 (current-buffer))
618 nil))
619
620 (defun arabic-yank-pop (arg)
621 "yank-pop command for arabic-mode."
622 (interactive "*p")
623 (visual-yank-pop arg)
624 (let ((p1 (point)) (p2 (mark t)))
625 (arabic-make-connection)
626 (goto-char p2)
627 (arabic-make-connection)
628 (goto-char p1)
629 (set-marker (mark-marker) p2 (current-buffer))
630 nil))
631
632 (defun arabic-help nil
633 "Display keymap in Arabic-mode."
634 (interactive)
635 (let ((arabic-help-buffer (get-buffer-create "*Help*")))
636 (set-buffer arabic-help-buffer)
637 (erase-buffer)
638 (insert arabic-help-string)
639 (goto-char (point-min))
640 (display-buffer (current-buffer))))
641
642
643 ;; arabic LR commands
644
645 (defun arabic-delete-left-char (arg)
646 "Kill N (1st arg; integer) characters on the left of visual point."
647 (interactive "*p")
648 (if display-direction
649 (arabic-delete-char arg)
650 (arabic-backward-delete-char arg)))
651
652 (defun arabic-delete-right-char (arg)
653 "Kill N (1st arg; integer) characters on the right of visual point."
654 (interactive "*p")
655 (if display-direction
656 (arabic-backward-delete-char arg)
657 (arabic-delete-char arg)))
658
659 (defun arabic-kill-left-word (arg)
660 "Kill N (1st arg; integer) words on the left of visual point."
661 (interactive "*p")
662 (if display-direction
663 (arabic-kill-word arg)
664 (arabic-backward-kill-word arg)))
665
666 (defun arabic-kill-right-word (arg)
667 "Kill N (1st arg; integer) words on the right of visual point."
668 (interactive "*p")
669 (if display-direction
670 (arabic-backward-kill-word arg)
671 (arabic-kill-word arg)))
672
673 ;;;
674 (provide 'arabic)
675 ;;; arabic-util.el ends here