comparison lisp/mule/arabic.el @ 70:131b0175ea99 r20-0b30

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