annotate lisp/egg/egg.el @ 153:25f70ba0133c r20-3b3

Import from CVS: tag r20-3b3
author cvs
date Mon, 13 Aug 2007 09:38:25 +0200
parents 1856695b1fa9
children bfd6434d15b3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1 ;; Japanese Character Input Package for Egg
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2 ;; Coded by S.Tomura, Electrotechnical Lab. (tomura@etl.go.jp)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
3
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
4 ;; This file is part of Egg on Mule (Multilingal Environment)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
5
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
6 ;; Egg is free software; you can redistribute it and/or modify
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
7 ;; it under the terms of the GNU General Public License as published by
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
8 ;; the Free Software Foundation; either version 2, or (at your option)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
9 ;; any later version.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
10
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
11 ;; Egg is distributed in the hope that it will be useful,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
12 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
13 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
14 ;; GNU General Public License for more details.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
15
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
16 ;; You should have received a copy of the GNU General Public License
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
17 ;; along with GNU Emacs; see the file COPYING. If not, write to
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
18 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
19
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
20 ;;;==================================================================
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
21 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
22 ;;; $BF|K\8l4D6-(B $B!V$?$^$4!W(B $BBh#3HG(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
23 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
24 ;;;===================================================================
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
25
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
26 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
27 ;;;$B!V$?$^$4!W$O%M%C%H%o!<%/$+$J4A;zJQ49%5!<%P$rMxMQ$7!"(BMule $B$G$NF|K\(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
28 ;;; $B8l4D6-$rDs6!$9$k%7%9%F%`$G$9!#!V$?$^$4!WBh#2HG$G$O(B Wnn V3 $B$*$h$S(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
29 ;;; Wnn V4 $B$N$+$J4A;zJQ49%5!<%P$r;HMQ$7$F$$$^$9!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
30 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
31
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
32 ;;; $BL>A0$O(B $B!VBt;3(B/$BBT$?$;$F(B/$B$4$a$s$J$5$$!W$N3FJ8@a$N@hF,#12;$G$"$k!V$?!W(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
33 ;;; $B$H!V$^!W$H!V$4!W$r<h$C$F!"!V$?$^$4!W$H8@$$$^$9!#EE;R5;=QAm9g8&5f=j(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
34 ;;; $B$N6S8+(B $BH~5.;R;a$NL?L>$K0M$k$b$N$G$9!#(Begg $B$O!V$?$^$4!W$N1QLu$G$9!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
35
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
36 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
37 ;;; $B;HMQK!$O(B info/egg-jp $B$r8+$F2<$5$$!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
38 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
39
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
40 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
41 ;;; $B!V$?$^$4!W$K4X$9$kDs0F!"Cn>pJs$O(B tomura@etl.go.jp $B$K$*Aw$j2<$5$$!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
42 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
43
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
44 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
45 ;;; $B")(B 305 $B0q>k8)$D$/$P;TG_1`(B1-1-4
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
46 ;;; $BDL;:>J9)6H5;=Q1!EE;R5;=QAm9g8&5f=j(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
47 ;;; $B>pJs%"!<%-%F%/%A%cIt8@8l%7%9%F%`8&5f<<(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
48 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
49 ;;; $B8MB<(B $BE/(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
50
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
51 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
52 ;;; ($BCm0U(B)$B$3$N%U%!%$%k$O4A;z%3!<%I$r4^$s$G$$$^$9!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
53 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
54 ;;; $BBh#3HG(B $B#1#9#9#1G/#27n(B $B#4F|(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
55 ;;; $BBh#2HG(B $B#1#9#8#9G/#67n(B $B#1F|(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
56 ;;; $BBh#1HG(B $B#1#9#8#8G/#77n#1#4F|(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
57 ;;; $B;CDjHG(B $B#1#9#8#8G/#67n#2#4F|(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
58
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
59 ;;;===================================================================
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
60 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
61 ;;; (eval-when (load) (require 'wnn-client))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
62 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
63
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
64 ; last master version
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
65 ;;; (defvar egg-version "3.09" "Version number of this version of Egg. ")
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
66 ;;; Last modified date: Fri Sep 25 12:59:00 1992
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
67 (defvar egg-version "3.09 xemacs" "Version number of this version of Egg. ")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
68 ;;; Last modified date: Wed Feb 05 20:45:00 1997
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
69
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
70 ;;;; $B=$@5MW5a%j%9%H(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
71
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
72 ;;;; read-hiragana-string, read-kanji-string $B$G;HMQ$9$kJ?2>L>F~NO%^%C%W$r(B roma-kana $B$K8GDj$7$J$$$GM_$7$$!%(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
73
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
74 ;;;; $B=$@5%a%b(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
75
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
76 ;;; 97.2.05 modified by J.Hein <jhod@po.iijnet.or.jp>
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
77 ;;; Lots of mods to make it XEmacs workable. Most fixes revolve around the fact that
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
78 ;;; Mule/et al assumes that all events are keypress events unless specified otherwise.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
79 ;;; Also modified to work with the new charset names and API
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
80
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
81 ;;; 95.6.5 modified by S.Tomura <tomura@etl.go.jp>
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
82 ;;; $BJQ49D>8e$KO"B3$7$FJQ49$9$k>l9g$rG'<1$9$k$?$a$K!"(B"-in-cont" $B$K4XO"$7$?(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
83 ;;; $BItJ,$rDI2C$7$?!#!J$3$NItJ,$O>-Mh:F=$@5$9$kM=Dj!#!K(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
84
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
85 ;;; 93.6.19 modified by T.Shingu <shingu@cpr.canon.co.jp>
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
86 ;;; egg:*in-fence-mode* should be buffer local.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
87
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
88 ;;; 93.6.4 modified by T.Shingu <shingu@cpr.canon.co.jp>
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
89 ;;; In its-defrule**, length is called instead of chars-in-string.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
90
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
91 ;;; 93.3.15 modified by T.Enami <enami@sys.ptg.sony.co.jp>
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
92 ;;; egg-self-insert-command simulates the original more perfectly.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
93
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
94 ;;; 92.12.20 modified by S.Tomura <tomura@etl.go.jp>
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
95 ;;; In its:simulate-input, sref is called instead of aref.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
96
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
97 ;;; 92.12.20 modified by T.Enami <enami@sys.ptg.sony.co.jp>
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
98 ;;; egg-self-insert-command calls cancel-undo-boundary to simulate original.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
99
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
100 ;;; 92.11.4 modified by M.Higashida <manabu@sigmath.osaka-u.ac.jp>
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
101 ;;; read-hiragana-string sets minibuffer-preprompt correctly.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
102
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
103 ;;; 92.10.26, 92.10.30 modified by T.Saneto sanewo@pdp.crl.sony.co.jp
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
104 ;;; typo fixed.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
105
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
106 ;;; 92.10.18 modified by K. Handa <handa@etl.go.jp>
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
107 ;;; special-symbol-input $BMQ$N%F!<%V%k$r(B autoload $B$K!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
108 ;;; busyu.el $B$N(B autoload $B$N;XDj$r(B mule-init.el $B$+$i(B egg.el $B$K0\$9!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
109
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
110 ;;; 92.9.20 modified by S. Tomura
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
111 ;;;; hiragana-region $B$NCn$N=$@5(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
112
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
113 ;;;; 92.9.19 modified by Y. Kawabe
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
114 ;;;; some typos
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
115
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
116 ;;;; 92.9.19 modified by Y. Kawabe<kawabe@sramhc.sra.co.jp>
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
117 ;;;; menu $B$NI=<(4X78$N(B lenght $B$r(B string-width $B$KCV$-49$($k!%(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
118
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
119 ;;; 92.8.19 modified for Mule Ver.0.9.6 by K.Handa <handa@etl.go.jp>
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
120 ;;;; menu:select-from-menu calls string-width instead of length.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
121
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
122 ;;;; 92.8.1 modified by S. Tomura
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
123 ;;;; internal mode $B$rDI2C!%(Bits:*internal-mode-alist* $BDI2C!%(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
124
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
125 ;;;; 92.7.31 modified by S. Tomura
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
126 ;;;; its-mode-map $B$,(B super mode map $B$r;}$D$h$&$KJQ99$7$?!%$3$l$K$h$j(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
127 ;;;; mode map $B$,6&M-$G$-$k!%(B its-define-mode, get-next-map $B$J$I$rJQ99!%(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
128 ;;;; get-next-map-locally $B$rDI2C!%(Bits-defrule** $B$rJQ99!%(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
129
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
130 ;;;; 92.7.31 modified by S. Tomura
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
131 ;;;; its:make-kanji-buffer , its:*kanji* $B4XO"%3!<%I$r:o=|$7$?!%(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
132
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
133 ;;;; 92.7.31 modified by S. Tomura
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
134 ;;;; egg:select-window-hook $B$r=$@5$7!$(Bminibuffer $B$+$i(B exit $B$9$k$H$-$K!$(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
135 ;;;; $B3F<oJQ?t$r(B default-value $B$KLa$9$h$&$K$7$?!%$3$l$K$h$C$F(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
136 ;;;; minibufffer $B$KF~$kA0$K3F<o@_Dj$,2DG=$H$J$k!%(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
137
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
138 ;;; 92.7.14 modified for Mule Ver.0.9.5 by T.Ito <toshi@his.cpl.melco.co.jp>
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
139 ;;; Attribute bold can be used.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
140 ;;; Unnecessary '*' in comments of variables deleted.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
141 ;;; 92.7.8 modified for Mule Ver.0.9.5 by Y.Kawabe <kawabe@sra.co.jp>
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
142 ;;; special-symbol-input keeps the position selected last.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
143 ;;; 92.7.8 modified for Mule Ver.0.9.5 by T.Shingu <shingu@cpr.canon.co.jp>
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
144 ;;; busyu-input and kakusuu-input are added in *symbol-input-menu*.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
145 ;;; 92.7.7 modified for Mule Ver.0.9.5 by K.Handa <handa@etl.go.jp>
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
146 ;;; In egg:quit-mode, overwrite-mode is supported correctly.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
147 ;;; egg:*overwrite-mode-deleted-chars* is not used now.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
148 ;;; 92.6.26 modified for Mule Ver.0.9.5 by K.Handa <handa@etl.go.jp>
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
149 ;;; Funtion dump-its-mode-map gets obsolete.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
150 ;;; 92.6.26 modified for Mule Ver.0.9.5 by M.Shikida <shikida@cs.titech.ac.jp>
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
151 ;;; Backquote ` is registered in *hankaku-alist* and *zenkaku-alist*.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
152 ;;; 92.6.17 modified for Mule Ver.0.9.5 by T.Shingu <shingu@cpr.canon.co.jp>
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
153 ;;; Bug in make-jis-second-level-code-alist fixed.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
154 ;;; 92.6.14 modified for Mule Ver.0.9.5 by T.Enami <enami@sys.ptg.sony.co.jp>
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
155 ;;; menu:select-from-menu is replaced with new version.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
156 ;;; 92.5.18 modified for Mule Ver.0.9.4 by T.Shingu <shingu@cpr.canon.co.jp>
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
157 ;;; lisp/wnn-egg.el is devided into two parts: this file and wnn*-egg.el.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
158
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
159 ;;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
160 ;;;; Mule Ver.0.9.3 $B0JA0(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
161 ;;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
162
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
163 ;;;; April-15-92 for Mule Ver.0.9.3
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
164 ;;;; by T.Enami <enami@sys.ptg.sony.co.jp> and K.Handa <handa@etl.go.jp>
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
165 ;;;; notify-internal calls 'message' with correct argument.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
166
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
167 ;;;; April-11-92 for Mule Ver.0.9.3
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
168 ;;;; by T.Enami <enami@sys.ptg.sony.co.jp> and K.Handa <handa@etl.go.jp>
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
169 ;;;; minibuffer $B$+$iH4$1$k;~(B egg:select-window-hook $B$G(B egg:*input-mode* $B$r(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
170 ;;;; t $B$K$9$k!#(Bhook $B$N7A$rBgI}=$@5!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
171
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
172 ;;;; April-3-92 for Mule Ver.0.9.2 by T.Enami <enami@sys.ptg.sony.co.jp>
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
173 ;;;; minibuffer $B$+$iH4$1$k;~(B egg:select-window-hook $B$,(B new-buffer $B$N(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
174 ;;;; egg:*mode-on* $B$J$I$r(B nil $B$K$7$F$$$k$N$r=$@5!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
175
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
176 ;;;; Mar-22-92 by K.Handa
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
177 ;;;; etags $B$,:n$k(B TAGS $B$KITI,MW$J$b$N$rF~$l$J$$$h$&$K$9$k$?$a4X?tL>JQ99(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
178 ;;;; define-its-mode -> its-define-mode, defrule -> its-defrule
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
179
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
180 ;;;; Mar-16-92 by K.Handa
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
181 ;;;; global-map $B$X$N(B define-key $B$r(B mule-keymap $B$KJQ99!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
182
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
183 ;;;; Mar-13-92 by K.Handa
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
184 ;;;; Language specific part $B$r(B japanese.el,... $B$K0\$7$?!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
185
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
186 ;;;; Feb-*-92 by K. Handa
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
187 ;;;; nemacs 4 $B$G$O(B minibuffer-window-selected $B$,GQ;_$K$J$j!$4XO"$9$k%3!<%I$r:o=|$7$?!%(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
188
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
189 ;;;; Jan-13-92 by S. Tomura
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
190 ;;;; mc-emacs or nemacs 4 $BBP1~:n6H3+;O!%(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
191
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
192 ;;;; Aug-9-91 by S. Tomura
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
193 ;;;; ?\^ $B$r(B ?^ $B$K=$@5!%(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
194
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
195 ;;;; menu $B$r(B key map $B$r8+$k$h$&$K$9$k!%(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
196
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
197 ;;;; Jul-6-91 by S. Tomura
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
198 ;;;; setsysdict $B$N(B error $B%a%C%;!<%8$rJQ99!%(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
199
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
200 ;;;; Jun-11-91 by S. Tomura
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
201 ;;;; its:*defrule-verbose* $B$rDI2C!%(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
202 ;;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
203
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
204 ;;;; Mar-25-91 by S. Tomura
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
205 ;;;; reset-its-mode $B$rGQ;_(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
206
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
207 ;;;; Mar-23-91 by S. Tomura
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
208 ;;;; read-hiragana-string $B$r=$@5!$(B read-kanji-string $B$rDI2C!$(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
209 ;;;; isearch:read-kanji-string $B$r@_Dj!%(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
210
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
211 ;;;; Mar-22-91 by S. Tomura
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
212 ;;;; defrule-conditional, defrule-select-mode-temporally $B$rDI2C!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
213 ;;;; for-each $B$N4J0WHG$H$7$F(B dolist $B$rDI2C!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
214 ;;;; enable-double-n-syntax $B$r3hMQ!%$[$+$K(B use-kuten-for-comma, use-touten-for-period $B$rDI2C(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
215
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
216 ;;;; Mar-5-91 by S. Tomura
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
217 ;;;; roma-kana-word, henkan-word, roma-kanji-word $B$rDI2C$7$?!%(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
218
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
219 ;;;; Jan-14-91 by S. Tomura
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
220 ;;;; $BF~NOJ8;zJQ497O(B ITS(Input character Translation System) $B$r2~B$$9$k!%(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
221 ;;;; $BJQ49$O:G:8:GD9JQ49$r9T$J$$!$JQ49$N$J$$$b$N$O$b$H$N$^$^$H$J$k!%(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
222 ;;;; $B2~B$$NF05!$ON)LZ!w7D1~$5$s$N%O%s%0%kJ8;z$NF~NOMW5a$G$"$k!%(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
223 ;;;; its:* $B$rDI2C$7$?!%$^$?=>Mh(B fence-self-insert-command $B$H(B roma-kana-region
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
224 ;;;; $BFs2U=j$K$o$+$l$F$$$?%3!<%I$r(B its:translate-region $B$K$h$C$F0lK\2=$7$?!%(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
225
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
226 ;;;; July-30-90 by S. Tomura
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
227 ;;;; henkan-region $B$r(Boverwrite-mode $B$KBP1~$5$;$k!%JQ?t(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
228 ;;;; egg:*henkan-fence-mode*, egg:*overwrite-mode-deleted-chars*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
229 ;;;; $B$rDI2C$7!$(Bhenkan-fence-region, henkan-region-internal,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
230 ;;;; quit-egg-mode $B$rJQ99$9$k!%(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
231
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
232 ;;;; Mar-4-90 by K.Handa
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
233 ;;;; New variable alphabet-mode-indicator, transparent-mode-indicator,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
234 ;;;; and henkan-mode-indicator.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
235
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
236 ;;;; Feb-27-90 by enami@ptgd.sony.co.jp
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
237 ;;;; menu:select-from-menu $B$G#22U=j$"$k(B ((and (<= ?0 ch) (<= ch ?9)...
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
238 ;;;; $B$N0lJ}$r(B ((and (<= ?0 ch) (<= ch ?9)... $B$K=$@5(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
239
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
240 ;;;; Feb-07-89
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
241 ;;;; bunsetu-length-henko $B$NCf$N(B egg:*attribute-off $B$N0LCV$r(B KKCP $B$r8F$VA0$K(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
242 ;;;; $BJQ99$9$k!#(B wnn-client $B$G$O(B KKCP $B$r8F$V$HJ8@a>pJs$,JQ2=$9$k!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
243
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
244 ;;;; Feb-01-89
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
245 ;;;; henkan-goto-kouho $B$N(B egg:set-bunsetu-attribute $B$N0z?t(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
246 ;;;; $B$N=gHV$,4V0c$C$F$$$?$N$r=$@5$7$?!#!J(Btoshi@isvax.isl.melco.co.jp
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
247 ;;;; (Toshiyuki Ito)$B$N;XE&$K$h$k!#!K(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
248
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
249 ;;;; Dec-25-89
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
250 ;;;; meta-flag t $B$N>l9g$NBP1~$r:F=$@5$9$k!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
251 ;;;; overwrite-mode $B$G$N(B undo $B$r2~A1$9$k!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
252
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
253 ;;;; Dec-21-89
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
254 ;;;; bug fixed by enami@ptdg.sony.co.jp
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
255 ;;;; (fboundp 'minibuffer-window-selected )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
256 ;;;; -->(boundp 'minibuffer-window-selected )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
257 ;;;; self-insert-after-hook $B$r(B buffer local $B$K$7$FDj5A$r(B kanji.el $B$X0\F0!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
258
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
259 ;;;; Dec-15-89
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
260 ;;;; kill-all-local-variables $B$NDj5A$r(B kanji.el $B$X0\F0$9$k!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
261
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
262 ;;;; Dec-14-89
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
263 ;;;; meta-flag t $B$N>l9g$N=hM}$r=$@5$9$k(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
264 ;;;; overwrite-mode $B$KBP1~$9$k!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
265
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
266 ;;;; Dec-12-89
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
267 ;;;; egg:*henkan-open*, egg:*henkan-close* $B$rDI2C!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
268 ;;;; egg:*henkan-attribute* $B$rDI2C(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
269 ;;;; set-egg-fence-mode-format, set-egg-henkan-mode-format $B$rDI2C(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
270
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
271 ;;;; Dec-12-89
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
272 ;;;; *bunpo-code* $B$K(B 1000: "$B$=$NB>(B" $B$rDI2C(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
273
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
274 ;;;; Dec-11-89
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
275 ;;;; egg:*fence-attribute* $B$r?7@_(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
276 ;;;; egg:*bunsetu-attribute* $B$r?7@_(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
277
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
278 ;;;; Dec-11-89
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
279 ;;;; attribute-*-region $B$rMxMQ$9$k$h$&$KJQ99$9$k!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
280 ;;;; menu:make-selection-list $B$O(B width $B$,>.$5$$;~$K(Bloop $B$9$k!#$3$l$r=$@5$7$?!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
281
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
282 ;;;; Dec-10-89
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
283 ;;;; set-marker-type $B$rMxMQ$9$kJ}<0$KJQ99!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
284
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
285 ;;;; Dec-07-89
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
286 ;;;; egg:search-path $B$rDI2C!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
287 ;;;; egg-default-startup-file $B$rDI2C$9$k!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
288
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
289 ;;;; Nov-22-89
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
290 ;;;; egg-startup-file $B$rDI2C$9$k!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
291 ;;;; eggrc-search-path $B$r(B egg-startup-file-search-path $B$KL>A0JQ99!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
292
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
293 ;;;; Nov-21-89
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
294 ;;;; Nemacs 3.2 $B$KBP1~$9$k!#(Bkanji-load* $B$rGQ;_$9$k!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
295 ;;;; wnnfns.c $B$KBP1~$7$?=$@5$r2C$($k!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
296 ;;;; *Notification* buffer $B$r8+$($J$/$9$k!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
297
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
298 ;;;; Oct-2-89
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
299 ;;;; *zenkaku-alist* $B$N(B $BJ8;zDj?t$N=q$-J}$,4V0c$C$F$$$?!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
300
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
301 ;;;; Sep-19-89
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
302 ;;;; toggle-egg-mode $B$N=$@5!J(Bkanji-flag$B!K(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
303 ;;;; egg-self-insert-command $B$N=$@5(B $B!J(Bkanji-flag$B!K(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
304
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
305 ;;;; Sep-18-89
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
306 ;;;; self-insert-after-hook $B$NDI2C(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
307
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
308 ;;;; Sep-15-89
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
309 ;;;; EGG:open-wnn bug fix
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
310 ;;;; provide wnn-egg feature
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
311
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
312 ;;;; Sep-13-89
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
313 ;;;; henkan-kakutei-before-point $B$r=$@5$7$?!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
314 ;;;; enter-fence-mode $B$NDI2C!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
315 ;;;; egg-exit-hook $B$NDI2C!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
316 ;;;; henkan-region-internal $B$NDI2C!#(Bhenkan-region$B$O(B point $B$r(Bmark $B$9$k!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
317 ;;;; eggrc-search-path $B$NDI2C!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
318
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
319 ;;;; Aug-30-89
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
320 ;;;; kanji-kanji-1st $B$rD{@5$7$?!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
321
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
322 ;;;; May-30-89
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
323 ;;;; EGG:open-wnn $B$O(B get-wnn-host-name $B$,(B nil $B$N>l9g!"(B(system-name) $B$r;HMQ$9$k!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
324
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
325 ;;;; May-9-89
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
326 ;;;; KKCP:make-directory added.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
327 ;;;; KKCP:file-access bug fixed.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
328 ;;;; set-default-usr-dic-directory modified.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
329
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
330 ;;;; Mar-16-89
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
331 ;;;; minibuffer-window-selected $B$r;H$C$F(B minibuffer $B$N(B egg-mode$BI=<(5!G=DI2C(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
332
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
333 ;;;; Mar-13-89
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
334 ;;;; mode-line-format changed.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
335
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
336 ;;;; Feb-27-89
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
337 ;;;; henkan-saishou-bunsetu added
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
338 ;;;; henkan-saichou-bunsetu added
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
339 ;;;; M-< henkan-saishou-bunsetu
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
340 ;;;; M-> henkan-saichou-bunsetu
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
341
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
342 ;;;; Feb-14-89
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
343 ;;;; C-h in henkan mode: help-command added
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
344
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
345 ;;;; Feb-7-89
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
346 ;;;; egg-insert-after-hook is added.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
347
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
348 ;;;; M-h fence-hiragana
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
349 ;;;; M-k fence-katakana
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
350 ;;;; M-> fence-zenkaku
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
351 ;;;; M-< fence-hankaku
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
352
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
353 ;;;; Dec-19-88 henkan-hiragana, henkan-katakara$B$rDI2C!'(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
354 ;;;; M-h henkan-hiragana
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
355 ;;;; M-k henkan-katakana
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
356
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
357 ;;;; Ver. 2.00 kana2kanji.c $B$r;H$o$:(B wnn-client.el $B$r;HMQ$9$k$h$&$KJQ99!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
358 ;;;; $B4XO"$7$F0lIt4X?t$rJQ99(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
359
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
360 ;;;; Dec-2-88 special-symbol-input $B$rDI2C!((B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
361 ;;;; C-^ special-symbol-input
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
362
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
363 ;;;; Nov-18-88 henkan-mode-map $B0lItJQ99!((B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
364 ;;;; M-i henkan-inspect-bunsetu
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
365 ;;;; M-s henkan-select-kouho
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
366 ;;;; C-g henkan-quit
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
367
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
368 ;;;; Nov-18-88 jserver-henkan-kakutei $B$N;EMMJQ99$KH<$$!"(Bkakutei $B$N%3!<(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
369 ;;;; $B%I$rJQ99$7$?!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
370
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
371 ;;;; Nov-17-88 kakutei-before-point $B$G(B point $B0J9_$N4V0c$C$?ItJ,$NJQ49(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
372 ;;;; $B$,IQEY>pJs$KEPO?$5$l$J$$$h$&$K=$@5$7$?!#$3$l$K$O(BKKCC:henkan-end
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
373 ;;;; $B$N0lIt;EMM$HBP1~$9$k(Bkana2kanji.c$B$bJQ99$7$?!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
374
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
375 ;;;; Nov-17-88 henkan-inspect-bunsetu $B$rDI2C$7$?!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
376
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
377 ;;;; Nov-17-88 $B?7$7$$(B kana2kanji.c $B$KJQ99$9$k!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
378
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
379 ;;;; Sep-28-88 defrule$B$,CM$H$7$F(Bnil$B$rJV$9$h$&$KJQ99$7$?!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
380
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
381 ;;;; Aug-25-88 $BJQ493X=,$r@5$7$/9T$J$&$h$&$KJQ99$7$?!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
382 ;;;; KKCP:henkan-kakutei$B$O(BKKCP:jikouho-list$B$r8F$s$@J8@a$KBP$7$F$N$_E,(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
383 ;;;; $BMQ$G$-!"$=$l0J30$N>l9g$N7k2L$OJ]>Z$5$l$J$$!#$3$N>r7o$rK~$?$9$h$&(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
384 ;;;; $B$K(BKKCP:jikouho-list$B$r8F$s$G$$$J$$J8@a$KBP$7$F$O(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
385 ;;;; KKCP:henkan-kakutei$B$r8F$P$J$$$h$&$K$7$?!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
386
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
387 ;;;; Aug-25-88 egg:do-auto-fill $B$r=$@5$7!"J#?t9T$K$o$?$k(Bauto-fill$B$r@5(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
388 ;;;; $B$7$/9T$J$&$h$&$K=$@5$7$?!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
389
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
390 ;;;; Aug-25-88 menu command$B$K(B\C-l: redraw $B$rDI2C$7$?!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
391
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
392 ;;;; Aug-25-88 toroku-region$B$GEPO?$9$kJ8;zNs$+$i(Bno graphic character$B$r(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
393 ;;;; $B<+F0E*$K=|$/$3$H$K$7$?!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
394
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
395 ;; XEmacs addition: (and remove disable-undo variable)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
396 ;; For Emacs V18/Nemacs compatibility
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
397 ;(and (not (fboundp 'buffer-disable-undo))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
398 ; (fboundp 'buffer-flush-undo)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
399 ; (defalias 'buffer-disable-undo 'buffer-flush-undo))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
400
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
401 ;; 97.2.4 Created by J.Hein to simulate Mule-2.3
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
402 (defun egg-read-event ()
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
403 "FSFmacs event emulator that shoves non key events into
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
404 unread-command-events to facilitate translation from Mule-2.3"
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
405 (let ((event (make-event))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
406 (ch nil))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
407 (next-command-event event)
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
408 (if (key-press-event-p event)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
409 (if (eq 0 (event-modifier-bits event))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
410 (setq ch (event-key event))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
411 (if (eq 1 (event-modifier-bits event))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
412 (setq ch (int-to-char (- (char-to-int (event-key event)) 96)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
413 (setq unread-command-events (list event))))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
414 (setq unread-command-events (list event)))
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
415 ch))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
416
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
417 (eval-when-compile (require 'egg-jsymbol))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
418
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
419 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
420 ;;;----------------------------------------------------------------------
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
421 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
422 ;;; Utilities
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
423 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
424 ;;;----------------------------------------------------------------------
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
425
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
426 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
427 ;;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
428
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
429 (defun coerce-string (form)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
430 (cond((stringp form) form)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
431 ((characterp form) (char-to-string form))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
432
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
433 (defun coerce-internal-string (form)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
434 (cond((stringp form)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
435 (if (= (length form) 1)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
436 (string-to-char form)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
437 form))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
438 ((characterp form) form)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
439
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
440 ;;; kill-all-local-variables $B$+$iJ]8n$9$k(B local variables $B$r;XDj$G$-$k(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
441 ;;; $B$h$&$KJQ99$9$k!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
442
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
443 (put 'egg:*input-mode* 'permanent-local t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
444 (put 'egg:*mode-on* 'permanent-local t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
445 (put 'its:*current-map* 'permanent-local t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
446 (put 'mode-line-egg-mode 'permanent-local t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
447
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
448 ;;;----------------------------------------------------------------------
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
449 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
450 ;;; 16$B?JI=8=$N(BJIS $B4A;z%3!<%I$r(B minibuffer $B$+$iFI$_9~$`(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
451 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
452 ;;;----------------------------------------------------------------------
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
453
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
454 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
455 ;;; User entry: jis-code-input
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
456 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
457
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
458 (defun jis-code-input ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
459 (interactive)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
460 (insert-jis-code-from-minibuffer "JIS $B4A;z%3!<%I(B(16$B?J?tI=8=(B): "))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
461
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
462 (defun insert-jis-code-from-minibuffer (prompt)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
463 (let ((str (read-from-minibuffer prompt)) val)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
464 (while (null (setq val (read-jis-code-from-string str)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
465 (beep)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
466 (setq str (read-from-minibuffer prompt str)))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
467 (insert (make-char (find-charset 'japanese-jisx0208) (car val) (cdr val)))))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
468
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
469 (defun hexadigit-value (ch)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
470 (cond((and (<= ?0 ch) (<= ch ?9))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
471 (- ch ?0))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
472 ((and (<= ?a ch) (<= ch ?f))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
473 (+ (- ch ?a) 10))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
474 ((and (<= ?A ch) (<= ch ?F))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
475 (+ (- ch ?A) 10))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
476
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
477 (defun read-jis-code-from-string (str)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
478 (if (and (= (length str) 4)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
479 (<= 2 (hexadigit-value (aref str 0)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
480 (hexadigit-value (aref str 1))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
481 (<= 2 (hexadigit-value (aref str 2)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
482 (hexadigit-value (aref str 3)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
483 (cons (+ (* 16 (hexadigit-value (aref str 0)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
484 (hexadigit-value (aref str 1)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
485 (+ (* 16 (hexadigit-value (aref str 2)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
486 (hexadigit-value (aref str 3))))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
487
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
488 ;;;----------------------------------------------------------------------
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
489 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
490 ;;; $B!V$?$^$4!W(B Notification System
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
491 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
492 ;;;----------------------------------------------------------------------
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
493
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
494 (defconst *notification-window* " *Notification* ")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
495
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
496 ;;;(defmacro notify (str &rest args)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
497 ;;; (list 'notify-internal
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
498 ;;; (cons 'format (cons str args))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
499
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
500 (defun notify (str &rest args)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
501 (notify-internal (apply 'format (cons str args))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
502
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
503 (defun notify-internal (message &optional noerase)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
504 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
505 (let ((notify-buff (get-buffer-create *notification-window*)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
506 (set-buffer notify-buff)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
507 (goto-char (point-max))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
508 (setq buffer-read-only nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
509 (insert (substring (current-time-string) 4 19) ":: " message ?\n )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
510 (setq buffer-read-only t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
511 (bury-buffer notify-buff)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
512 (message "%s" message) ; 92.4.15 by T.Enami
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
513 (if noerase nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
514 (sleep-for 1) (message "")))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
515
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
516 ;;;(defmacro notify-yes-or-no-p (str &rest args)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
517 ;;; (list 'notify-yes-or-no-p-internal
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
518 ;;; (cons 'format (cons str args))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
519
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
520 (defun notify-yes-or-no-p (str &rest args)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
521 (notify-yes-or-no-p-internal (apply 'format (cons str args))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
522
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
523 (defun notify-yes-or-no-p-internal (message)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
524 (save-window-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
525 (pop-to-buffer *notification-window*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
526 (goto-char (point-max))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
527 (setq buffer-read-only nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
528 (insert (substring (current-time-string) 4 19) ":: " message ?\n )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
529 (setq buffer-read-only t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
530 (yes-or-no-p "$B$$$$$G$9$+!)(B")))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
531
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
532 (defun notify-y-or-n-p (str &rest args)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
533 (notify-y-or-n-p-internal (apply 'format (cons str args))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
534
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
535 (defun notify-y-or-n-p-internal (message)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
536 (save-window-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
537 (pop-to-buffer *notification-window*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
538 (goto-char (point-max))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
539 (setq buffer-read-only nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
540 (insert (substring (current-time-string) 4 19) ":: " message ?\n )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
541 (setq buffer-read-only t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
542 (y-or-n-p "$B$$$$$G$9$+!)(B")))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
543
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
544 (defun select-notification ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
545 (interactive)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
546 (pop-to-buffer *notification-window*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
547 (setq buffer-read-only t))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
548
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
549 ;;;----------------------------------------------------------------------
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
550 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
551 ;;; $B!V$?$^$4!W(B Menu System
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
552 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
553 ;;;----------------------------------------------------------------------
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
554
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
555 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
556 ;;; minibuffer $B$K(B menu $B$rI=<(!&A*Br$9$k(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
557 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
558
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
559 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
560 ;;; menu $B$N;XDjJ}K!!'(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
561 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
562 ;;; <menu item> ::= ( menu <prompt string> <menu-list> )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
563 ;;; <menu list> ::= ( <menu element> ... )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
564 ;;; <menu element> ::= ( <string> . <value> ) | <string>
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
565 ;;; ( <char> . <value> ) | <char>
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
566
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
567 ;;; select-menu-in-minibuffer
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
568
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
569 (defvar menu:*select-items* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
570 (defvar menu:*select-menus* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
571 (defvar menu:*select-item-no* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
572 (defvar menu:*select-menu-no* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
573 (defvar menu:*select-menu-stack* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
574 (defvar menu:*select-start* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
575 (defvar menu:*select-positions* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
576
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
577 (defvar menu-mode-map (make-keymap))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
578
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
579 (define-key menu-mode-map "\C-a" 'menu:begining-of-menu)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
580 (define-key menu-mode-map "\C-e" 'menu:end-of-menu)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
581 (define-key menu-mode-map "\C-f" 'menu:next-item)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
582 (define-key menu-mode-map "\C-b" 'menu:previous-item)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
583 (define-key menu-mode-map "\C-n" 'menu:next-item-old)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
584 (define-key menu-mode-map "\C-g" 'menu:quit)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
585 (define-key menu-mode-map "\C-p" 'menu:previous-item-old)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
586 (define-key menu-mode-map "\C-l" 'menu:refresh)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
587 ;;; 0 .. 9 a .. z A .. z
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
588 (define-key menu-mode-map "\C-m" 'menu:select)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
589 (define-key menu-mode-map [return] 'menu:select)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
590 (define-key menu-mode-map [left] 'menu:previous-item)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
591 (define-key menu-mode-map [right] 'menu:next-item)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
592 (define-key menu-mode-map [up] 'menu:previous-item-old)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
593 (define-key menu-mode-map [down] 'menu:next-item-old)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
594
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
595 ;; 92.6.14 by T.Enami -- This function was completely modified.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
596 (defun menu:select-from-menu (menu &optional initial position)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
597 (let ((echo-keystrokes 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
598 (inhibit-quit t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
599 (menubuffer (get-buffer-create " *menu*"))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
600 (minibuffer (window-buffer (minibuffer-window)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
601 value)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
602 (save-window-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
603 (set-window-buffer (minibuffer-window) menubuffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
604 (select-window (minibuffer-window))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
605 (set-buffer menubuffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
606 (delete-region (point-min) (point-max))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
607 (insert (nth 1 menu))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
608 (let* ((window-width (window-width (selected-window)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
609 (finished nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
610 (setq menu:*select-menu-stack* nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
611 menu:*select-positions* nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
612 menu:*select-start* (point)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
613 menu:*select-menus*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
614 (menu:make-selection-list (nth 2 menu)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
615 (- window-width
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
616 ;;; 92.8.19 by K.Handa
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
617 (string-width (nth 1 menu)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
618 ;; 92.7.8 by Y.Kawabe
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
619 (cond
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
620 ((and (numberp initial)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
621 (<= 0 initial)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
622 (< initial (length (nth 2 menu))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
623 (menu:select-goto-item-position initial))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
624 ((and (listp initial) (car initial)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
625 (<= 0 (car initial))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
626 (< (car initial) (length (nth 2 menu))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
627 (menu:select-goto-item-position (car initial))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
628 (while (and (setq initial (cdr initial))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
629 (setq value (menu:item-value (nth menu:*select-item-no*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
630 menu:*select-items*)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
631 (listp value) (eq (car value) 'menu))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
632 (setq menu:*select-positions*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
633 (cons (menu:select-item-position) menu:*select-positions*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
634 (setq menu:*select-menu-stack*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
635 (cons (list menu:*select-items* menu:*select-menus*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
636 menu:*select-item-no* menu:*select-menu-no*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
637 menu)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
638 menu:*select-menu-stack*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
639 (setq menu value)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
640 (delete-region (point-min) (point-max)) (insert (nth 1 menu))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
641 (setq menu:*select-start* (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
642 (setq menu:*select-menus*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
643 (menu:make-selection-list
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
644 ;;; 92.9.19 by Y. Kawabe
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
645 (nth 2 menu) (- window-width (string-width (nth 1 menu)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
646 (if (and (numberp (car initial))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
647 (<= 0 (car initial))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
648 (< (car initial) (length (nth 2 menu))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
649 (menu:select-goto-item-position (car initial))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
650 (setq menu:*select-item-no* 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
651 (menu:select-goto-menu 0)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
652 (setq value nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
653 (t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
654 (setq menu:*select-item-no* 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
655 (menu:select-goto-menu 0))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
656 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
657 ;; end of patch
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
658 (while (not finished)
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
659 (let ((ch (egg-read-event)))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
660 (setq quit-flag nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
661 (cond
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
662 ((eq ch ?\C-a)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
663 (menu:select-goto-item 0))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
664 ((eq ch ?\C-e)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
665 (menu:select-goto-item (1- (length menu:*select-items*))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
666 ((or (eq ch ?\C-f) (eq ch 'right))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
667 ;;(menu:select-goto-item (1+ menu:*select-item-no*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
668 (menu:select-next-item)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
669 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
670 ((or (eq ch ?\C-b) (eq ch 'left))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
671 ;;(menu:select-goto-item (1- menu:*select-item-no*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
672 (menu:select-previous-item)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
673 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
674 ((or (eq ch ?\C-n) (eq ch 'down))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
675 (menu:select-goto-menu (1+ menu:*select-menu-no*)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
676 ((eq ch ?\C-g)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
677 (if menu:*select-menu-stack*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
678 (let ((save (car menu:*select-menu-stack*)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
679 (setq menu:*select-menu-stack*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
680 (cdr menu:*select-menu-stack*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
681 (setq menu:*select-items* (nth 0 save);92.10.26 by T.Saneto
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
682 menu:*select-menus* (nth 1 save)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
683 menu:*select-item-no* (nth 2 save)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
684 menu:*select-menu-no* (nth 3 save)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
685 menu (nth 4 save))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
686 (setq menu:*select-positions*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
687 (cdr menu:*select-positions*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
688 (delete-region (point-min) (point-max))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
689 (insert (nth 1 menu))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
690 (setq menu:*select-start* (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
691 (menu:select-goto-menu menu:*select-menu-no*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
692 (menu:select-goto-item menu:*select-item-no*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
693 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
694 (setq finished t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
695 value nil)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
696 ((or (eq ch ?\C-p) (eq ch 'up))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
697 (menu:select-goto-menu (1- menu:*select-menu-no*)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
698 ((eq ch ?\C-l) ;;; redraw menu
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
699 (menu:select-goto-menu menu:*select-menu-no*))
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 126
diff changeset
700 ((and (characterp ch) (<= ?0 ch) (<= ch ?9)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
701 (<= ch (+ ?0 (1- (length menu:*select-items*)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
702 (menu:select-goto-item (- ch ?0)))
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 126
diff changeset
703 ((and (characterp ch) (<= ?a ch) (<= ch ?z)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
704 (<= (+ 10 ch) (+ ?a (1- (length menu:*select-items*)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
705 (menu:select-goto-item (+ 10 (- ch ?a))))
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 126
diff changeset
706 ((and (characterp ch) (<= ?A ch) (<= ch ?Z)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
707 (<= (+ 10 ch) (+ ?A (1- (length menu:*select-items*)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
708 (menu:select-goto-item (+ 10 (- ch ?A))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
709 ((or (eq ch ?\C-m) (eq ch 'return))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
710 (setq value (menu:item-value (nth menu:*select-item-no*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
711 menu:*select-items*)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
712 (setq menu:*select-positions*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
713 (cons (menu:select-item-position)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
714 menu:*select-positions*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
715 (if (and (listp value)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
716 (eq (car value) 'menu))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
717 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
718 (setq menu:*select-menu-stack*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
719 (cons
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
720 (list menu:*select-items* menu:*select-menus*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
721 menu:*select-item-no* menu:*select-menu-no*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
722 menu)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
723 menu:*select-menu-stack*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
724 (setq menu value)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
725 (delete-region (point-min) (point-max))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
726 (insert (nth 1 menu))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
727 (setq menu:*select-start* (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
728 (setq menu:*select-menus*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
729 ;;; 92.9.19 by Y. Kawabe
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
730 (menu:make-selection-list
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
731 (nth 2 menu)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
732 (- window-width
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
733 (string-width (nth 1 menu)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
734 (setq menu:*select-item-no* 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
735 (menu:select-goto-menu 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
736 (setq value nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
737 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
738 (setq finished t)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
739 (t (beep))))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
740 (delete-region (point-min) (point-max))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
741 (setq menu:*select-positions*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
742 (nreverse menu:*select-positions*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
743 (set-window-buffer (minibuffer-window) minibuffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
744 (if (null value)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
745 (setq quit-flag t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
746 (if position
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
747 (cons value menu:*select-positions*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
748 value)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
749
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
750 (defun menu:select-item-position ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
751 (let ((p 0) (m 0))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
752 (while (< m menu:*select-menu-no*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
753 (setq p (+ p (length (nth m menu:*select-menus*))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
754 (setq m (1+ m)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
755 (+ p menu:*select-item-no*)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
756
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
757 (defun menu:select-goto-item-position (pos)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
758 (let ((m 0) (p 0))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
759 (while (<= (+ p (length (nth m menu:*select-menus*))) pos)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
760 (setq p (+ p (length (nth m menu:*select-menus*))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
761 (setq m (1+ m)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
762 (setq menu:*select-item-no* (- pos p))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
763 (menu:select-goto-menu m)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
764
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
765 (defun menu:select-goto-menu (no)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
766 (setq menu:*select-menu-no*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
767 (check-number-range no 0 (1- (length menu:*select-menus*))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
768 (setq menu:*select-items* (nth menu:*select-menu-no* menu:*select-menus*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
769 (delete-region menu:*select-start* (point-max))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
770 (if (<= (length menu:*select-items*) menu:*select-item-no*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
771 (setq menu:*select-item-no* (1- (length menu:*select-items*))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
772 (goto-char menu:*select-start*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
773 (let ((l menu:*select-items*) (i 0))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
774 (while l
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
775 (insert (if (<= i 9) (format " %d." i)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
776 (format " %c." (+ (- i 10) ?a)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
777 (menu:item-string (car l)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
778 (setq l (cdr l)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
779 i (1+ i))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
780 (menu:select-goto-item menu:*select-item-no*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
781
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
782 (defun menu:select-goto-item (no)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
783 (setq menu:*select-item-no*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
784 (check-number-range no 0
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
785 (1- (length menu:*select-items*))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
786 (let ((p (+ 2 menu:*select-start*)) (i 0))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
787 (while (< i menu:*select-item-no*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
788 (setq p (+ p (length (menu:item-string (nth i menu:*select-items*))) 4))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
789 (setq i (1+ i)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
790 (goto-char p)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
791
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
792 (defun menu:select-next-item ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
793 (if (< menu:*select-item-no* (1- (length menu:*select-items*)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
794 (menu:select-goto-item (1+ menu:*select-item-no*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
795 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
796 (setq menu:*select-item-no* 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
797 (menu:select-goto-menu (1+ menu:*select-menu-no*)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
798
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
799 (defun menu:select-previous-item ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
800 (if (< 0 menu:*select-item-no*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
801 (menu:select-goto-item (1- menu:*select-item-no*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
802 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
803 (setq menu:*select-item-no* 1000)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
804 (menu:select-goto-menu (1- menu:*select-menu-no*)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
805
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
806 (defvar menu:*display-item-value* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
807
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
808 (defun menu:item-string (item)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
809 (cond((stringp item) item)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
810 ((characterp item) (char-to-string item))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
811 ((consp item)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
812 (if menu:*display-item-value*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
813 (format "%s [%s]"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
814 (cond ((stringp (car item)) (car item))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
815 ((characterp (car item)) (char-to-string (car item)))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
816 (t ""))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
817 (cdr item))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
818 (cond ((stringp (car item))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
819 (car item))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
820 ((characterp (car item))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
821 (char-to-string (car item)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
822 (t ""))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
823 (t "")))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
824
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
825 (defun menu:item-value (item)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
826 (cond((stringp item) item)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
827 (t (cdr item))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
828
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
829 (defun menu:make-selection-list (items width)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
830 (let ((whole nil) (line nil) (size 0))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
831 (while items
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
832 ;;; 92.9.19 by Y. Kawabe
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
833 (if (<= width (+ size 4 (string-width (menu:item-string(car items)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
834 (if line
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
835 (setq whole (cons (reverse line) whole)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
836 line nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
837 size 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
838 (setq whole (cons (list (car items)) whole)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
839 size 0
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
840 items (cdr items)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
841 ;;; 92.9.19 by Y. Kawabe
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
842 (setq line (cons (car items) line)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
843 size (+ size 4 (string-width(menu:item-string (car items))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
844 items (cdr items))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
845 (if line
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
846 (reverse (cons (reverse line) whole))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
847 (reverse whole))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
848
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
849
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
850 ;;;----------------------------------------------------------------------
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
851 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
852 ;;; $B0l3g7?JQ495!G=(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
853 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
854 ;;;----------------------------------------------------------------------
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
855
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
856
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
857 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
858 ;;; $B$R$i$,$JJQ49(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
859 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
860
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
861 (defun hiragana-region (start end)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
862 (interactive "r")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
863 (goto-char start)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
864 (while (re-search-forward kanji-katakana end end)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
865 (let ((ch (preceding-char)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
866 (cond( (<= ch ?$B%s(B)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
867 (delete-char -1)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
868 (insert (make-char (find-charset 'japanese-jisx0208) 36 (char-octet ch 1))))))))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
869
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
870 (defun hiragana-paragraph ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
871 "hiragana paragraph at or after point."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
872 (interactive )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
873 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
874 (forward-paragraph)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
875 (let ((end (point)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
876 (backward-paragraph)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
877 (hiragana-region (point) end ))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
878
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
879 (defun hiragana-sentence ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
880 "hiragana sentence at or after point."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
881 (interactive )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
882 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
883 (forward-sentence)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
884 (let ((end (point)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
885 (backward-sentence)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
886 (hiragana-region (point) end ))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
887
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
888 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
889 ;;; $B%+%?%+%JJQ49(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
890 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
891
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
892 (defun katakana-region (start end)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
893 (interactive "r")
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
894 (goto-char start)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
895 (while (re-search-forward kanji-hiragana end end)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
896 (let ((ch (char-octet (preceding-char) 1)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
897 (delete-char -1)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
898 (insert (make-char (find-charset 'japanese-jisx0208) 37 ch)))))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
899
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
900 (defun katakana-paragraph ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
901 "katakana paragraph at or after point."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
902 (interactive )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
903 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
904 (forward-paragraph)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
905 (let ((end (point)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
906 (backward-paragraph)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
907 (katakana-region (point) end ))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
908
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
909 (defun katakana-sentence ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
910 "katakana sentence at or after point."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
911 (interactive )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
912 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
913 (forward-sentence)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
914 (let ((end (point)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
915 (backward-sentence)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
916 (katakana-region (point) end ))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
917
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
918 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
919 ;;; $BH>3QJQ49(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
920 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
921
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
922 (defun hankaku-region (start end)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
923 (interactive "r")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
924 (save-restriction
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
925 (narrow-to-region start end)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
926 (goto-char (point-min))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
927 (while (re-search-forward "\\cS\\|\\cA" (point-max) (point-max))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
928 (let* ((ch (preceding-char))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
929 (ch1 (char-octet ch 0))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
930 (ch2 (char-octet ch 1)))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
931 (cond ((= ?\241 ch1)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
932 (let ((val (cdr (assq ch2 *hankaku-alist*))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
933 (if val (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
934 (delete-char -1)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
935 (insert val)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
936 ((= ?\243 ch1)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
937 (delete-char -1)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
938 (insert (- ch2 ?\200 ))))))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
939
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
940 (defun hankaku-paragraph ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
941 "hankaku paragraph at or after point."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
942 (interactive )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
943 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
944 (forward-paragraph)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
945 (let ((end (point)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
946 (backward-paragraph)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
947 (hankaku-region (point) end ))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
948
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
949 (defun hankaku-sentence ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
950 "hankaku sentence at or after point."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
951 (interactive )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
952 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
953 (forward-sentence)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
954 (let ((end (point)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
955 (backward-sentence)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
956 (hankaku-region (point) end ))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
957
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
958 (defun hankaku-word (arg)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
959 (interactive "p")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
960 (let ((start (point)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
961 (forward-word arg)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
962 (hankaku-region start (point))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
963
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
964 (defvar *hankaku-alist*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
965 '(( 161 . ?\ )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
966 ( 170 . ?\! )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
967 ( 201 . ?\" )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
968 ( 244 . ?\# )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
969 ( 240 . ?\$ )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
970 ( 243 . ?\% )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
971 ( 245 . ?\& )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
972 ( 199 . ?\' )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
973 ( 202 . ?\( )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
974 ( 203 . ?\) )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
975 ( 246 . ?\* )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
976 ( 220 . ?\+ )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
977 ( 164 . ?\, )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
978 ( 221 . ?\- )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
979 ( 165 . ?\. )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
980 ( 191 . ?\/ )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
981 ( 167 . ?\: )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
982 ( 168 . ?\; )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
983 ( 227 . ?\< )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
984 ( 225 . ?\= )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
985 ( 228 . ?\> )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
986 ( 169 . ?\? )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
987 ( 247 . ?\@ )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
988 ( 206 . ?\[ )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
989 ( 239 . ?\\ )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
990 ( 207 . ?\] )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
991 ( 176 . ?^ )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
992 ( 178 . ?\_ )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
993 ( 208 . ?\{ )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
994 ( 195 . ?\| )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
995 ( 209 . ?\} )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
996 ( 177 . ?\~ )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
997 ( 198 . ?` ) ; 92.6.26 by M.Shikida
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
998 ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
999
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1000 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1001 ;;; $BA43QJQ49(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1002 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1003
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1004 (defun zenkaku-region (start end)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1005 (interactive "r")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1006 (save-restriction
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1007 (narrow-to-region start end)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1008 (goto-char (point-min))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1009 (while (re-search-forward "[ -~]" (point-max) (point-max))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1010 (let ((ch (preceding-char)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1011 (if (and (<= ? ch) (<= ch ?~))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1012 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1013 (delete-char -1)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1014 (let ((zen (cdr (assq ch *zenkaku-alist*))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1015 (if zen (insert zen)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1016 (insert (make-char (find-charset 'japanese-jisx0208) 38 ch))))))))))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1017
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1018 (defun zenkaku-paragraph ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1019 "zenkaku paragraph at or after point."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1020 (interactive )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1021 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1022 (forward-paragraph)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1023 (let ((end (point)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1024 (backward-paragraph)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1025 (zenkaku-region (point) end ))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1026
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1027 (defun zenkaku-sentence ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1028 "zenkaku sentence at or after point."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1029 (interactive )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1030 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1031 (forward-sentence)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1032 (let ((end (point)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1033 (backward-sentence)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1034 (zenkaku-region (point) end ))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1035
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1036 (defun zenkaku-word (arg)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1037 (interactive "p")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1038 (let ((start (point)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1039 (forward-word arg)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1040 (zenkaku-region start (point))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1041
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1042 (defvar *zenkaku-alist*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1043 '((? . "$B!!(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1044 (?! . "$B!*(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1045 (?\" . "$B!I(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1046 (?# . "$B!t(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1047 (?$ . "$B!p(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1048 (?% . "$B!s(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1049 (?& . "$B!u(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1050 (?' . "$B!G(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1051 (?( . "$B!J(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1052 (?) . "$B!K(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1053 (?* . "$B!v(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1054 (?+ . "$B!\(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1055 (?, . "$B!$(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1056 (?- . "$B!](B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1057 (?. . "$B!%(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1058 (?/ . "$B!?(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1059 (?: . "$B!'(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1060 (?\; . "$B!((B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1061 (?< . "$B!c(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1062 (?= . "$B!a(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1063 (?> . "$B!d(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1064 (?? . "$B!)(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1065 (?@ . "$B!w(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1066 (?[ . "$B!N(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1067 (?\\ . "$B!o(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1068 (?] . "$B!O(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1069 (?^ . "$B!0(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1070 (?_ . "$B!2(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1071 (?{ . "$B!P(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1072 (?| . "$B!C(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1073 (?} . "$B!Q(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1074 (?~ . "$B!1(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1075 (?` . "$B!F(B"))) ; 92.6.26 by M.Shikida
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1076
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1077 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1078 ;;; $B%m!<%^;z$+$JJQ49(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1079 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1080
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1081 (defun roma-kana-region (start end )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1082 (interactive "r")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1083 (its:translate-region start end nil (its:get-mode-map "roma-kana")))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1084
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1085 (defun roma-kana-paragraph ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1086 "roma-kana paragraph at or after point."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1087 (interactive )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1088 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1089 (forward-paragraph)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1090 (let ((end (point)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1091 (backward-paragraph)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1092 (roma-kana-region (point) end ))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1093
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1094 (defun roma-kana-sentence ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1095 "roma-kana sentence at or after point."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1096 (interactive )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1097 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1098 (forward-sentence)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1099 (let ((end (point)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1100 (backward-sentence)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1101 (roma-kana-region (point) end ))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1102
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1103 (defun roma-kana-word ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1104 "roma-kana word at or after point."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1105 (interactive)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1106 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1107 (re-search-backward "\\b\\w" nil t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1108 (let ((start (point)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1109 (re-search-forward "\\w\\b" nil t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1110 (roma-kana-region start (point)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1111
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1112 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1113 ;;; $B%m!<%^;z4A;zJQ49(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1114 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1115
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1116 (defun roma-kanji-region (start end)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1117 (interactive "r")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1118 (roma-kana-region start end)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1119 (save-restriction
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1120 (narrow-to-region start (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1121 (goto-char (point-min))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1122 (replace-regexp "\\($B!!(B\\| \\)" "")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1123 (goto-char (point-max)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1124 (henkan-region-internal start (point)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1125
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1126 (defun roma-kanji-paragraph ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1127 "roma-kanji paragraph at or after point."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1128 (interactive )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1129 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1130 (forward-paragraph)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1131 (let ((end (point)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1132 (backward-paragraph)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1133 (roma-kanji-region (point) end ))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1134
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1135 (defun roma-kanji-sentence ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1136 "roma-kanji sentence at or after point."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1137 (interactive )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1138 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1139 (forward-sentence)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1140 (let ((end (point)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1141 (backward-sentence)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1142 (roma-kanji-region (point) end ))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1143
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1144 (defun roma-kanji-word ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1145 "roma-kanji word at or after point."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1146 (interactive)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1147 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1148 (re-search-backward "\\b\\w" nil t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1149 (let ((start (point)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1150 (re-search-forward "\\w\\b" nil t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1151 (roma-kanji-region start (point)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1152
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1153
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1154 ;;;----------------------------------------------------------------------
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1155 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1156 ;;; $B!V$?$^$4!WF~NOJ8;zJQ497O(B ITS
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1157 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1158 ;;;----------------------------------------------------------------------
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1159
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1160 (defun egg:member (elt list)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1161 (while (not (or (null list) (equal elt (car list))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1162 (setq list (cdr list)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1163 list)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1164
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1165 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1166 ;;; Mode name --> map
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1167 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1168 ;;; ITS mode name: string
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1169
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1170 (defvar its:*mode-alist* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1171 (defvar its:*internal-mode-alist* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1172
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1173 (defun its:get-mode-map (name)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1174 (or (cdr (assoc name its:*mode-alist*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1175 (cdr (assoc name its:*internal-mode-alist*))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1176
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1177 (defun its:set-mode-map (name map &optional internalp)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1178 (let ((place (assoc name
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1179 (if internalp its:*internal-mode-alist*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1180 its:*mode-alist*))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1181 (if place (let ((mapplace (cdr place)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1182 (setcar mapplace (car map))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1183 (setcdr mapplace (cdr map)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1184 (progn (setq place (cons name map))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1185 (if internalp
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1186 (setq its:*internal-mode-alist*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1187 (append its:*internal-mode-alist* (list place)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1188 (setq its:*mode-alist*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1189 (append its:*mode-alist* (list place))))))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1190
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1191 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1192 ;;; ITS mode indicators
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1193 ;;; Mode name --> indicator
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1194 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1195
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1196 (defun its:get-mode-indicator (name)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1197 (let ((map (its:get-mode-map name)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1198 (if map (map-indicator map)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1199 name)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1200
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1201 (defun its:set-mode-indicator (name indicator)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1202 (let ((map (its:get-mode-map name)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1203 (if map
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1204 (map-set-indicator map indicator)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1205 (its-define-mode name indicator))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1206
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1207 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1208 ;;; ITS mode declaration
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1209 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1210
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1211 (defvar its:*processing-map* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1212
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1213 (defun its-define-mode (name &optional indicator reset supers internalp)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1214 "its-mode NAME $B$rDj5AA*Br$9$k!%B>$N(B its-mode $B$,A*Br$5$l$k$^$G$O(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1215 its-defrule $B$J$I$O(B NAME $B$KBP$7$F5,B'$rDI2C$9$k!%(BINDICATOR $B$,(B non-nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1216 $B$N;~$K$O(B its-mode NAME $B$rA*Br$9$k$H(B mode-line $B$KI=<($5$l$k!%(BRESET $B$,(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1217 non-nil $B$N;~$K$O(B its-mode $B$NDj5A$,6u$K$J$k!%(BSUPERS $B$O>e0L$N(B its-mode
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1218 $BL>$r%j%9%H$G;XDj$9$k!%(BINTERNALP $B$O(B mode name $B$rFbItL>$H$9$k!%(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1219 its-defrule, its-defrule-conditional, defule-select-mode-temporally $B$r(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1220 $B;2>H(B"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1221
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1222 (if (null(its:get-mode-map name))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1223 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1224 (setq its:*processing-map*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1225 (make-map nil (or indicator name) nil (mapcar 'its:get-mode-map supers)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1226 (its:set-mode-map name its:*processing-map* internalp)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1227 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1228 (progn (setq its:*processing-map* (its:get-mode-map name))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1229 (if indicator
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1230 (map-set-indicator its:*processing-map* indicator))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1231 (if reset
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1232 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1233 (map-set-state its:*processing-map* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1234 (map-set-alist its:*processing-map* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1235 ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1236 (if supers
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1237 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1238 (map-set-supers its:*processing-map* (mapcar 'its:get-mode-map supers))))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1239 nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1240
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1241 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1242 ;;; defrule related utilities
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1243 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1244
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1245 (put 'for-each 'lisp-indent-hook 1)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1246
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1247 (defmacro for-each (vars &rest body)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1248 "(for-each ((VAR1 LIST1) ... (VARn LISTn)) . BODY) $B$OJQ?t(B VAR1 $B$NCM(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1249 $B$r%j%9%H(B LIST1 $B$NMWAG$KB+G{$7!$!%!%!%JQ?t(B VARn $B$NCM$r%j%9%H(B LISTn $B$NMW(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1250 $BAG$KB+G{$7$F(B BODY $B$r<B9T$9$k!%(B"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1251
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1252 (for-each* vars (cons 'progn body)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1253
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1254 (defun for-each* (vars body)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1255 (cond((null vars) body)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1256 (t (let((tvar (make-symbol "temp"))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1257 (var (car (car vars)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1258 (val (car (cdr (car vars)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1259 (list 'let (list (list tvar val)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1260 var)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1261 (list 'while tvar
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1262 (list 'setq var (list 'car tvar))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1263 (for-each* (cdr vars) body)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1264 (list 'setq tvar (list 'cdr tvar))))))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1265
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1266 (put 'dolist 'lisp-indent-hook 1)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1267
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1268 (defmacro dolist (pair &rest body)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1269 "(dolist (VAR LISTFORM) . BODY) $B$O(BVAR $B$K=g<!(B LISTFORM $B$NMWAG$rB+G{$7(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1270 $B$F(B BODY $B$r<B9T$9$k(B"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1271
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1272 (for-each* (list pair) (cons 'progn body)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1273
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1274 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1275 ;;; defrule
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1276 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1277
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1278 (defun its:make-standard-action (output next)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1279 "OUTPUT $B$H(B NEXT $B$+$i$J$k(B standard-action $B$r:n$k!%(B"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1280
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1281 (if (and (stringp output) (string-equal output ""))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1282 (setq output nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1283 (if (and (stringp next) (string-equal next ""))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1284 (setq next nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1285 (cond((null output)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1286 (cond ((null next) nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1287 (t (list nil next))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1288 ((consp output)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1289 ;;; alternative output
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1290 (list (cons 0 output) next))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1291 ((null next) output)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1292 (t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1293 (list output next))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1294
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1295 (defun its:standard-actionp (action)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1296 "ACITION $B$,(B standard-action $B$G$"$k$+$I$&$+$rH=Dj$9$k!%(B"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1297 (or (stringp action)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1298 (and (consp action)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1299 (or (stringp (car action))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1300 (and (consp (car action))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1301 (characterp (car (car action))))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1302 (null (car action)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1303 (or (null (car (cdr action)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1304 (stringp (car (cdr action)))))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1305
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1306 (defvar its:make-terminal-state 'its:default-make-terminal-state
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1307 "$B=*C<$N>uBV$G$NI=<($r:n@.$9$k4X?t$r;XDj$9$k(B. $B4X?t$O(B map input
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1308 action state $B$r0z?t$H$7$F8F$P$l!$>uBVI=<($NJ8;zNs$rJV$9!%(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1309
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1310 (defun its:default-make-terminal-state (map input action state)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1311 (cond(state state)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1312 (t input)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1313
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1314 (defun its:make-terminal-state-hangul (map input action state)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1315 (cond((its:standard-actionp action) (action-output action))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1316 (t nil)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1317
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1318 (defvar its:make-non-terminal-state 'its:default-make-standard-non-terminal-state
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1319 "$BHs=*C<$N>uBV$G$NI=<($r:n@.$9$k4X?t$r;XDj$9$k!%4X?t$O(B map input $B$r(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1320 $B0z?t$H$7$F8F$P$l!$>uBVI=<($NJ8;zNs$rJV$9(B" )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1321
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1322 (defun its:default-make-standard-non-terminal-state (map input)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1323 " ****"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1324 (concat
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1325 (map-state-string map)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1326 (char-to-string (aref input (1- (length input))))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1327
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1328 (defun its-defrule (input output &optional next state map)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1329
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1330 "INPUT $B$,F~NO$5$l$k$H(B OUTPUT $B$KJQ49$9$k!%(BNEXT $B$,(B nil $B$G$J$$$H$-$OJQ(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1331 $B49$7$?8e$K(B NEXT $B$,F~NO$5$l$?$h$&$KJQ49$rB3$1$k!%(BINPUT$B$,F~NO$5$l$?;~E@(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1332 $B$GJQ49$,3NDj$7$F$$$J$$;~$O(B STATE $B$r%U%'%s%9>e$KI=<($9$k!%JQ49$,3NDj$7(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1333 $B$F$$$J$$;~$KI=<($9$kJ8;zNs$OJQ?t(B its:make-terminal-state $B$*$h$S(B $BJQ?t(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1334 its:make-non-terminal-state $B$K;X<($5$l$?4X?t$K$h$C$F@8@.$5$l$k!%JQ495,(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1335 $BB'$O(B MAP $B$G;XDj$5$l$?JQ49I=$KEPO?$5$l$k!%(BMAP $B$,(B nil $B$N>l9g$O$b$C$H$b:G(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1336 $B6a$K(B its-define-mode $B$5$l$?JQ49I=$KEPO?$5$l$k!%$J$*(B OUTPUT $B$,(B nil $B$N>l(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1337 $B9g$O(B INPUT $B$KBP$9$kJQ495,B'$,:o=|$5$l$k!%(B"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1338
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1339 (its-defrule* input
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1340 (its:make-standard-action output next) state
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1341 (if (stringp map) map
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1342 its:*processing-map*)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1343
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1344 (defmacro its-defrule-conditional (input &rest conds)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1345 "(its-defrule-conditional INPUT ((COND1 OUTPUT1) ... (CONDn OUTPUTn)))$B$O(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1346 INPUT $B$,F~NO$5$l$?;~$K>r7o(B CONDi $B$r=g<!D4$Y!$@.N)$7$?;~$K$O(B OUTPUTi $B$r(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1347 $B=PNO$9$k!%(B"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1348 (list 'its-defrule* input (list 'quote (cons 'cond conds))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1349
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1350 (defmacro its-defrule-conditional* (input state map &rest conds)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1351 "(its-defrule-conditional INPUT STATE MAP ((COND1 OUTPUT1) ... (CONDn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1352 OUTPUTn)))$B$O(B INPUT $B$,F~NO$5$l$?;~$K>uBV(B STATE $B$rI=<($7!$>r7o(B CONDi $B$r(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1353 $B=g<!D4$Y!$@.N)$7$?;~$K$O(B OUTPUTi $B$r=PNO$9$k!%(B"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1354 (list 'its-defrule* input (list 'quote (cons 'cond conds)) state map))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1355
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1356 (defun its-defrule-select-mode-temporally (input name)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1357 "INPUT $B$,F~NO$5$l$k$H(B temporally-mode $B$H$7$F(B NAME $B$,A*Br$5$l$k!%(B"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1358
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1359 (its-defrule* input (list 'quote (list 'its:select-mode-temporally name))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1360
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1361 (defun its-defrule* (input action &optional state map)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1362 (its:resize (length input))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1363 (setq map (cond((stringp map) (its:get-mode-map map))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1364 ((null map) its:*processing-map*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1365 (t map)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1366 (its-defrule** 0 input action state map)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1367 map)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1368
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1369 (defvar its:*defrule-verbose* t "nil$B$N>l9g(B, its-defrule $B$N7Y9p$rM^@)$9$k(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1370
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1371 (defun its-defrule** (i input action state map)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1372 (cond((= (length input) i) ;93.6.4 by T.Shingu
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1373 (map-set-state
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1374 map
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1375 (coerce-internal-string
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1376 (funcall its:make-terminal-state map input action state)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1377 (if (and its:*defrule-verbose* (map-action map))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1378 (if action
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1379 (notify "(its-defrule \"%s\" \"%s\" ) $B$r:FDj5A$7$^$7$?!%(B"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1380 input action)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1381 (notify "(its-defrule \"%s\" \"%s\" )$B$r:o=|$7$^$7$?!%(B"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1382 input (map-action map))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1383 (if (and (null action) (map-terminalp map)) nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1384 (progn (map-set-action map action)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1385 map)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1386 (t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1387 (let((newmap
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1388 (or (get-next-map-locally map (sref input i))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1389 (make-map (funcall its:make-non-terminal-state
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1390 map
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1391 (substring input 0 (+ i (char-bytes (sref input i)))))))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1392 (set-next-map map (sref input i)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1393 (its-defrule** (+ i (char-bytes (sref input i))) input action state newmap)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1394 (if (and (null (map-action map))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1395 (map-terminalp map))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1396 nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1397 map))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1398
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1399 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1400 ;;; map:
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1401 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1402 ;;; <map-alist> ::= ( ( <char> . <map> ) ... )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1403 ;;; <topmap> ::= ( nil <indicator> <map-alist> <supers> )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1404 ;;; <supers> ::= ( <topmap> .... )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1405 ;;; <map> ::= ( <state> <action> <map-alist> )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1406 ;;; <action> ::= <output> | ( <output> <next> ) ....
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1407
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1408 (defun make-map (&optional state action alist supers)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1409 (list state action alist supers))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1410
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1411 (defun map-topmap-p (map)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1412 (null (map-state map)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1413
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1414 (defun map-supers (map)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1415 (nth 3 map))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1416
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1417 (defun map-set-supers (map val)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1418 (setcar (nthcdr 3 map) val))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1419
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1420 (defun map-terminalp (map)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1421 (null (map-alist map)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1422
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1423 (defun map-state (map)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1424 (nth 0 map))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1425
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1426 (defun map-state-string (map)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1427 (coerce-string (map-state map)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1428
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1429 (defun map-set-state (map val)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1430 (setcar (nthcdr 0 map) val))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1431
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1432 (defun map-indicator (map)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1433 (map-action map))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1434 (defun map-set-indicator (map indicator)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1435 (map-set-action map indicator))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1436
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1437 (defun map-action (map)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1438 (nth 1 map))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1439 (defun map-set-action (map val)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1440 (setcar (nthcdr 1 map) val))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1441
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1442 (defun map-alist (map)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1443 (nth 2 map))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1444
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1445 (defun map-set-alist (map alist)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1446 (setcar (nthcdr 2 map) alist))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1447
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1448 (defun get-action (map)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1449 (if (null map) nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1450 (let ((action (map-action map)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1451 (cond((its:standard-actionp action)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1452 action)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1453 ((symbolp action) (condition-case nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1454 (funcall action)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1455 (error nil)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1456 (t (condition-case nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1457 (eval action)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1458 (error nil)))))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1459
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1460 (defun action-output (action)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1461 (cond((stringp action) action)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1462 (t (car action))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1463
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1464 (defun action-next (action)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1465 (cond((stringp action) nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1466 (t (car (cdr action)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1467
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1468 (defun get-next-map (map ch)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1469 (or (cdr (assq ch (map-alist map)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1470 (if (map-topmap-p map)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1471 (let ((supers (map-supers map))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1472 (result nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1473 (while supers
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1474 (setq result (get-next-map (car supers) ch))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1475 (if result
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1476 (setq supers nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1477 (setq supers (cdr supers))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1478 result))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1479
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1480 (defun get-next-map-locally (map ch)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1481 (cdr (assq ch (map-alist map))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1482
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1483 (defun set-next-map (map ch val)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1484 (let ((place (assq ch (map-alist map))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1485 (if place
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1486 (if val
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1487 (setcdr place val)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1488 (map-set-alist map (delq place (map-alist map))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1489 (if val
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1490 (map-set-alist map (cons (cons ch val)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1491 (map-alist map)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1492 val))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1493
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1494 (defun its:simple-actionp (action)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1495 (stringp action))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1496
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1497 (defun collect-simple-action (map)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1498 (if (map-terminalp map)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1499 (if (its:simple-actionp (map-action map))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1500 (list (map-action map))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1501 nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1502 (let ((alist (map-alist map))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1503 (result nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1504 (while alist
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1505 (setq result
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1506 ;;; 92.9.19 by Y. Kawabe
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1507 (append (collect-simple-action (cdr (car alist)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1508 result))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1509 (setq alist (cdr alist)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1510 result)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1511
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1512 ;;;----------------------------------------------------------------------
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1513 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1514 ;;; Runtime translators
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1515 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1516 ;;;----------------------------------------------------------------------
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1517
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1518 (defun its:simulate-input (i j input map)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1519 (while (<= i j)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1520 (setq map (get-next-map map (sref input i))) ;92.12.26 by S.Tomura
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1521 (setq i (+ i (char-bytes (sref input i))))) ;92.12.26 by S.Tomura
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1522 map)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1523
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1524 ;;; meta-flag $B$,(B on $B$N;~$K$O!"F~NO%3!<%I$K(B \200 $B$r(B or $B$7$?$b$N$,F~NO$5(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1525 ;;; $B$l$k!#$3$NItJ,$N;XE&$OEl9)Bg$NCf@n(B $B5.G7$5$s$K$h$k!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1526 ;;; pointted by nakagawa@titisa.is.titech.ac.jp Dec-11-89
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1527 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1528 ;;; emacs $B$G$O(B $BJ8;z%3!<%I$O(B 0-127 $B$G07$&!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1529 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1530
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1531 (defvar its:*buff-s* (make-marker))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1532 (defvar its:*buff-e* (make-marker))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1533 (set-marker-insertion-type its:*buff-e* t)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1534
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1535 ;;; STATE unread
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1536 ;;; |<-s p->|<- e ->|
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1537 ;;; s : ch0 state0 map0
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1538 ;;; +1: ch1 state1 map1
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1539 ;;; ....
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1540 ;;; (point):
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1541
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1542 ;;; longest matching region : [s m]
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1543 ;;; suspending region: [m point]
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1544 ;;; unread region : [point e]
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1545
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1546
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1547 (defvar its:*maxlevel* 10)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1548 (defvar its:*maps* (make-vector its:*maxlevel* nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1549 (defvar its:*actions* (make-vector its:*maxlevel* nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1550 (defvar its:*inputs* (make-vector its:*maxlevel* 0))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1551 (defvar its:*level* 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1552
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1553 (defun its:resize (size)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1554 (if (<= its:*maxlevel* size)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1555 (setq its:*maxlevel* size
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1556 its:*maps* (make-vector size nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1557 its:*actions* (make-vector size nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1558 its:*inputs* (make-vector size 0))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1559
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1560 (defun its:reset-maps (&optional init)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1561 (setq its:*level* 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1562 (if init
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1563 (aset its:*maps* its:*level* init)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1564
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1565 (defun its:current-map () (aref its:*maps* its:*level*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1566 (defun its:previous-map () (aref its:*maps* (max 0 (1- its:*level*))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1567
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1568 (defun its:level () its:*level*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1569
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1570 (defun its:enter-newlevel (map ch output)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1571 (setq its:*level* (1+ its:*level*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1572 (aset its:*maps* its:*level* map)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1573 (aset its:*inputs* its:*level* ch)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1574 (aset its:*actions* its:*level* output))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1575
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1576 (defvar its:*char-from-buff* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1577 (defvar its:*interactive* t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1578
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1579 (defun its:reset-input ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1580 (setq its:*char-from-buff* nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1581
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1582 (defun its:flush-input-before-point (from)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1583 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1584 (while (<= from its:*level*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1585 (its:insert-char (aref its:*inputs* from))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1586 (setq from (1+ from)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1587
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1588 (defun its:peek-char ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1589 (if (= (point) its:*buff-e*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1590 (if its:*interactive*
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
1591 (let ((ch (egg-read-event)))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
1592 (if ch
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
1593 (progn
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
1594 (setq unread-command-events (list (character-to-event ch)))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
1595 ch)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
1596 nil))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1597 nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1598 (following-char)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1599
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1600 (defun its:read-char ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1601 (if (= (point) its:*buff-e*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1602 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1603 (setq its:*char-from-buff* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1604 (if its:*interactive*
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
1605 (egg-read-event)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1606 nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1607 (let ((ch (following-char)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1608 (setq its:*char-from-buff* t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1609 (delete-char 1)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1610 ch)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1611
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1612 (defun its:push-char (ch)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1613 (if its:*char-from-buff*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1614 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1615 (its:insert-char ch))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1616 (if ch (setq unread-command-events (list (character-to-event ch))))))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1617
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1618 (defun its:insert-char (ch)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1619 (insert ch))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1620
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1621 (defun its:ordinal-charp (ch)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1622 (and (characterp ch) (<= ch 127)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1623 (eq (lookup-key fence-mode-map (char-to-string ch)) 'fence-self-insert-command)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1624
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1625 (defun its:delete-charp (ch)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1626 (and (characterp ch) (<= ch 127)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1627 (eq (lookup-key fence-mode-map (char-to-string ch)) 'fence-backward-delete-char)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1628
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
1629 (defvar egg:fence-buffer nil "Buffer fence is active in")
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
1630
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1631 (defun fence-self-insert-command ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1632 (interactive)
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
1633 (if (not (eq (current-buffer) egg:fence-buffer))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
1634 nil ;; #### This is to bandaid a deep event-handling bug
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
1635 (let ((ch (event-to-character last-command-event)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
1636 (cond((or (not egg:*input-mode*)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
1637 (null (get-next-map its:*current-map* ch)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
1638 (insert ch))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
1639 (t
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
1640 (insert ch)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
1641 (its:translate-region (1- (point)) (point) t))))))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1642
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1643 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1644 ;;; its: completing-read system
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1645 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1646
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1647 (defun its:all-completions (string alist &optional pred)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1648 "A variation of all-completions.\n\
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1649 Arguments are STRING, ALIST and optional PRED. ALIST must be no obarray."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1650 (let ((tail alist) (allmatches nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1651 (while tail
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1652 (let* ((elt (car tail))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1653 (eltstring (car elt)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1654 (setq tail (cdr tail))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1655 (if (and (stringp eltstring)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1656 (<= (length string) (length eltstring))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1657 ;;;(not (= (aref eltstring 0) ? ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1658 (string-equal string (substring eltstring 0 (length string))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1659 (if (or (and pred
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1660 (if (if (eq pred 'commandp)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1661 (commandp elt)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1662 (funcall pred elt))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1663 (null pred))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1664 (setq allmatches (cons elt allmatches))))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1665 (nreverse allmatches)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1666
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1667 (defun its:temp-echo-area-contents (message)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1668 (let ((inhibit-quit inhibit-quit)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1669 (point-max (point-max)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1670 (goto-char point-max)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1671 (insert message)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1672 (goto-char point-max)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1673 (setq inhibit-quit t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1674 (sit-for 2 nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1675 ;;; 92.9.19 by Y. Kawabe, 92.10.30 by T.Saneto
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1676 (delete-region (point) (point-max))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1677 (if quit-flag
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1678 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1679 (setq quit-flag nil)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1680 (setq unread-command-events (list (character-to-event ?\^G)))))))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1681
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1682 (defun car-string-lessp (item1 item2)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1683 (string-lessp (car item1) (car item2)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1684
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1685 (defun its:minibuffer-completion-help ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1686 "Display a list of possible completions of the current minibuffer contents."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1687 (interactive)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1688 (let ((completions))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1689 (message "Making completion list...")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1690 (setq completions (its:all-completions (buffer-string)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1691 minibuffer-completion-table
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1692 minibuffer-completion-predicate))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1693 (if (null completions)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1694 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1695 ;;; 92.9.19 by Y. Kawabe
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1696 (beep)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1697 (its:temp-echo-area-contents " [No completions]"))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1698 (with-output-to-temp-buffer "*Completions*"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1699 (display-completion-list
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1700 (sort completions 'car-string-lessp))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1701 nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1702
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1703 (defconst its:minibuffer-local-completion-map
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1704 (copy-keymap minibuffer-local-completion-map))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1705 (define-key its:minibuffer-local-completion-map "?" 'its:minibuffer-completion-help)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1706 (define-key its:minibuffer-local-completion-map " " 'its:minibuffer-completion-help)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1707
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1708 (defconst its:minibuffer-local-must-match-map
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1709 (copy-keymap minibuffer-local-must-match-map))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1710 (define-key its:minibuffer-local-must-match-map "?" 'its:minibuffer-completion-help)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1711 (define-key its:minibuffer-local-must-match-map " " 'its:minibuffer-completion-help)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1712
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1713 (fset 'si:all-completions (symbol-function 'all-completions))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1714 (fset 'si:minibuffer-completion-help (symbol-function 'minibuffer-completion-help))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1715
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1716 (defun its:completing-read (prompt table &optional predicate require-match initial-input)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1717 "See completing-read"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1718 (let ((minibuffer-local-completion-map its:minibuffer-local-completion-map)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1719 (minibuffer-local-must-match-map its:minibuffer-local-must-match-map)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1720 (completion-auto-help nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1721 (completing-read prompt table predicate t initial-input)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1722
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1723 (defvar its:*completing-input-menu* '(menu "Which?" nil)) ;92.10.26 by T.Saneto
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1724
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1725 (defun its:completing-input (map)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1726 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1727 (let ((action (get-action map)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1728 (cond((and (null action)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1729 (= (length (map-alist map)) 1))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1730 (its:completing-input (cdr (nth 0 (map-alist map)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1731 (t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1732 (setcar (nthcdr 2 its:*completing-input-menu*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1733 (map-alist map))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1734 (let ((values
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1735 (menu:select-from-menu its:*completing-input-menu*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1736 0 t)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1737 (cond((consp values)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1738 ;;; get input char from menu
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1739 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1740 (t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1741 (its:completing-input map))))))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1742
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1743 (defvar its:*make-menu-from-map-result* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1744
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1745 (defun its:make-menu-from-map (map)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1746 (let ((its:*make-menu-from-map-result* nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1747 (its:make-menu-from-map* map "")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1748 (list 'menu "Which?" (reverse its:*make-menu-from-map-result*) )))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1749
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1750 (defun its:make-menu-from-map* (map string)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1751 (let ((action (get-action map)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1752 (if action
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1753 (setq its:*make-menu-from-map-result*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1754 (cons (format "%s[%s]" string (action-output action))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1755 its:*make-menu-from-map-result*)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1756 (let ((alist (map-alist map)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1757 (while alist
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1758 (its:make-menu-from-map*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1759 (cdr (car alist))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1760 (concat string (char-to-string (car (car alist)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1761 (setq alist (cdr alist))))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1762
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1763 (defvar its:*make-alist-from-map-result* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1764
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1765 (defun its:make-alist-from-map (map &optional string)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1766 (let ((its:*make-alist-from-map-result* nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1767 (its:make-alist-from-map* map (or string ""))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1768 (reverse its:*make-alist-from-map-result*)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1769
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1770 (defun its:make-alist-from-map* (map string)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1771 (let ((action (get-action map)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1772 (if action
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1773 (setq its:*make-alist-from-map-result*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1774 (cons (list string
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1775 (let ((action-output (action-output action)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1776 (cond((and (consp action-output)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1777 (characterp (car action-output)))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1778 (format "%s..."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1779 (nth (car action-output) (cdr action-output))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1780 ((stringp action-output)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1781 action-output)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1782 (t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1783 (format "%s" action-output)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1784 its:*make-alist-from-map-result*)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1785 (let ((alist (map-alist map)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1786 (while alist
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1787 (its:make-alist-from-map*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1788 (cdr (car alist))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1789 (concat string (char-to-string (car (car alist)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1790 (setq alist (cdr alist))))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1791
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1792 (defvar its:*select-alternative-output-menu* '(menu "Which?" nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1793
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1794 (defun its:select-alternative-output (action-output)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1795 ;;;; action-output : (pos item1 item2 item3 ....)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1796 (let ((point (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1797 (output (cdr action-output))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1798 (ch 0))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1799 (while (not (eq ch ?\^L))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1800 (insert "<" (nth (car action-output)output) ">")
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
1801 (setq ch (egg-read-event))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1802 (cond ((eq ch ?\^N)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1803 (setcar action-output
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1804 (mod (1+ (car action-output)) (length output))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1805 ((eq ch ?\^P)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1806 (setcar action-output
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1807 (if (= 0 (car action-output))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1808 (1- (length output))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1809 (1- (car action-output)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1810 ((eq ch ?\^M)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1811 (setcar (nthcdr 2 its:*select-alternative-output-menu* )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1812 output)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1813 (let ((values
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1814 (menu:select-from-menu its:*select-alternative-output-menu*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1815 (car action-output)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1816 t)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1817 (cond((consp values)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1818 (setcar action-output (nth 1 values))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1819 (setq ch ?\^L)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1820 ((eq ch ?\^L)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1821 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1822 (t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1823 (beep)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1824 ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1825 (delete-region point (point)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1826 (if its:*insert-output-string*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1827 (funcall its:*insert-output-string* (nth (car action-output) output))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1828 (insert (nth (car action-output) output)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1829
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1830
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1831
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1832 ;;; translate until
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1833 ;;; interactive --> not ordinal-charp
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1834 ;;; or
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1835 ;;; not interactive --> end of input
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1836
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1837 (defvar its:*insert-output-string* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1838 (defvar its:*display-status-string* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1839
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1840 (defun its:translate-region (start end its:*interactive* &optional topmap)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1841 (set-marker its:*buff-s* start)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1842 (set-marker its:*buff-e* end)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1843 (its:reset-input)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1844 (goto-char its:*buff-s*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1845 (let ((topmap (or topmap its:*current-map*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1846 (map nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1847 (ch nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1848 (action nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1849 (newmap nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1850 (inhibit-quit t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1851 (its-quit-flag nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1852 (echo-keystrokes 0))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1853 (setq map topmap)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1854 (its:reset-maps topmap)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1855 (while (not its-quit-flag)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1856 (setq ch (its:read-char))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1857 (setq newmap (get-next-map map ch))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1858 (setq action (get-action newmap))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1859
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1860 (cond
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1861 ((and its:*interactive* (not its:*char-from-buff*) (characterp ch) (= ch ?\^@))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1862 (delete-region its:*buff-s* (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1863 (let ((i 1))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1864 (while (<= i its:*level*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1865 (insert (aref its:*inputs* i))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1866 (setq i (1+ i))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1867 (let ((inputs (its:completing-read "ITS:>"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1868 (its:make-alist-from-map topmap)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1869 nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1870 t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1871 (buffer-substring its:*buff-s* (point)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1872 (delete-region its:*buff-s* (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1873 (save-excursion (insert inputs))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1874 (its:reset-maps)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1875 (setq map topmap)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1876 ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1877 ((or (null newmap)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1878 (and (map-terminalp newmap)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1879 (null action)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1880
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1881 (cond((and its:*interactive* (its:delete-charp ch))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1882 (delete-region its:*buff-s* (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1883 (cond((= its:*level* 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1884 (setq its-quit-flag t))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1885 ((= its:*level* 1)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1886 (its:insert-char (aref its:*inputs* 1))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1887 (setq its-quit-flag t))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1888 (t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1889 (its:flush-input-before-point (1+ its:*level*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1890 (setq its:*level* (1- its:*level*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1891 (setq map (its:current-map))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1892 (if (and its:*interactive*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1893 its:*display-status-string*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1894 (funcall its:*display-status-string* (map-state map))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1895 (insert (map-state map)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1896 )))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1897 (t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1898 (let ((output nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1899 (let ((i its:*level*) (newlevel (1+ its:*level*)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1900 (aset its:*inputs* newlevel ch)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1901 (while (and (< 0 i) (null output))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1902 (if (and (aref its:*actions* i)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1903 (its:simulate-input (1+ i) newlevel its:*inputs* topmap))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1904 (setq output i))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1905 (setq i (1- i)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1906 (if (null output)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1907 (let ((i its:*level*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1908 (while (and (< 0 i) (null output))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1909 (if (aref its:*actions* i)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1910 (setq output i))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1911 (setq i (1- i)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1912
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1913 (cond(output
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1914 (delete-region its:*buff-s* (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1915 (cond((its:standard-actionp (aref its:*actions* output))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1916 (let ((action-output (action-output (aref its:*actions* output))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1917 (if (and (not its:*interactive*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1918 (consp action-output))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1919 (setq action-output (nth (car action-output) (cdr action-output))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1920 (cond((stringp action-output)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1921 (if (and its:*interactive*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1922 its:*insert-output-string*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1923 (funcall its:*insert-output-string* action-output)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1924 (insert action-output)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1925 ((consp action-output)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1926 (its:select-alternative-output action-output)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1927 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1928 (t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1929 (beep) (beep)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1930 )))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1931 (set-marker its:*buff-s* (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1932 (its:push-char ch)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1933 (its:flush-input-before-point (1+ output))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1934 (if (action-next (aref its:*actions* output))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1935 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1936 (insert (action-next (aref its:*actions* output)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1937 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1938 ((symbolp (aref its:*actions* output))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1939 (its:push-char ch)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1940 (funcall (aref its:*actions* output))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1941 (its:reset-maps its:*current-map*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1942 (setq topmap its:*current-map*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1943 (set-marker its:*buff-s* (point)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1944 (t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1945 (its:push-char ch)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1946 ;92.10.26 by T.Saneto
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1947 (eval (aref its:*actions* output))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1948 (its:reset-maps its:*current-map*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1949 (setq topmap its:*current-map*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1950 (set-marker its:*buff-s* (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1951 ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1952 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1953 ((= 0 its:*level*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1954 (cond ((or (its:ordinal-charp ch)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1955 its:*char-from-buff*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1956 (its:insert-char ch))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1957 (t (setq its-quit-flag t))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1958
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1959 ((< 0 its:*level*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1960 (delete-region its:*buff-s* (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1961 (its:insert-char (aref its:*inputs* 1))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1962 (set-marker its:*buff-s* (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1963 (its:push-char ch)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1964 (its:flush-input-before-point 2)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1965
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1966 (cond((null ch)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1967 (setq its-quit-flag t))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1968 ((not its-quit-flag)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1969 (its:reset-maps)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1970 (set-marker its:*buff-s* (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1971 (setq map topmap))))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1972
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1973 ((map-terminalp newmap)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1974 (its:enter-newlevel (setq map newmap) ch action)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1975 (delete-region its:*buff-s* (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1976 (let ((output nil) (m nil) (i (1- its:*level*)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1977 (while (and (< 0 i) (null output))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1978 (if (and (aref its:*actions* i)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1979 (setq m (its:simulate-input (1+ i) its:*level* its:*inputs* topmap))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1980 (not (map-terminalp m)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1981 (setq output i))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1982 (setq i (1- i)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1983
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1984 (cond((null output)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1985 (cond ((its:standard-actionp action)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1986 (let ((action-output (action-output action)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1987 (if (and (not its:*interactive*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1988 (consp action-output))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1989 (setq action-output (nth (car action-output) (cdr action-output))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1990 (cond((stringp action-output)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1991 (if (and its:*interactive*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1992 its:*insert-output-string*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1993 (funcall its:*insert-output-string* action-output)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1994 (insert action-output)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1995 ((consp action-output)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1996 (its:select-alternative-output action-output)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1997 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1998 (t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1999 (beep) (beep)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2000 )))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2001 (cond((null (action-next action))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2002 (cond ((and (= (point) its:*buff-e*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2003 its:*interactive*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2004 (its:delete-charp (its:peek-char)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2005 nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2006 (t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2007 (set-marker its:*buff-s* (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2008 (its:reset-maps)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2009 (setq map topmap)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2010 )))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2011 (t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2012 (save-excursion (insert (action-next action)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2013 (set-marker its:*buff-s* (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2014 (its:reset-maps)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2015 (setq map topmap))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2016 ((symbolp action)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2017 (funcall action)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2018 (its:reset-maps its:*current-map*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2019 (setq topmap its:*current-map*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2020 (setq map topmap)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2021 (set-marker its:*buff-s* (point)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2022 (t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2023 (eval action)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2024 (its:reset-maps its:*current-map*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2025 (setq topmap its:*current-map*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2026 (setq map topmap)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2027 (set-marker its:*buff-s* (point)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2028 (t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2029 (if (and its:*interactive*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2030 its:*display-status-string*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2031 (funcall its:*display-status-string* (map-state map))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2032 (insert (map-state map)))))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2033
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2034 ((null action)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2035 (delete-region its:*buff-s* (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2036 (if (and its:*interactive*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2037 its:*display-status-string*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2038 (funcall its:*display-status-string* (map-state newmap))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2039 (insert (map-state newmap)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2040 (its:enter-newlevel (setq map newmap)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2041 ch action))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2042
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2043 (t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2044 (its:enter-newlevel (setq map newmap) ch action)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2045 (delete-region its:*buff-s* (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2046 (if (and its:*interactive*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2047 its:*display-status-string*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2048 (funcall its:*display-status-string* (map-state map))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2049 (insert (map-state map))))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2050
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2051 (set-marker its:*buff-s* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2052 (set-marker its:*buff-e* nil)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2053 (if (and its:*interactive* ch) (setq unread-command-events (list (character-to-event ch))))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2054 ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2055
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2056 ;;;----------------------------------------------------------------------
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2057 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2058 ;;; ITS-map dump routine:
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2059 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2060 ;;;----------------------------------------------------------------------
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2061
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2062 ;;;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2063 ;;;;; User entry: dump-its-mode-map
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2064 ;;;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2065
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2066 ;; 92.6.26 by K.Handa
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2067 (defun dump-its-mode-map (name filename)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2068 "Obsolete."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2069 (interactive)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2070 (message "This function is obsolete in the current version of Mule."))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2071 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2072 ;;; EGG mode variables
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2073 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2074
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2075 (defvar egg:*mode-on* nil "T if egg mode is on.")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2076 (make-variable-buffer-local 'egg:*mode-on*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2077 (set-default 'egg:*mode-on* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2078
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2079 (defvar egg:*input-mode* t "T if egg map is active.")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2080 (make-variable-buffer-local 'egg:*input-mode*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2081 (set-default 'egg:*input-mode* t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2082
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2083 (defvar egg:*in-fence-mode* nil "T if in fence mode.")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2084 (make-variable-buffer-local 'egg:*in-fence-mode*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2085 (set-default 'egg:*in-fence-mode* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2086
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2087 ;;(load-library "its-dump/roma-kana") ;;;(define-its-mode "roma-kana" " a$B$"(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2088 ;;(load-library "its-dump/roma-kata") ;;;(define-its-mode "roma-kata" " a$B%"(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2089 ;;(load-library "its-dump/downcase") ;;;(define-its-mode "downcase" " a a")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2090 ;;(load-library "its-dump/upcase") ;;;(define-its-mode "upcase" " a A")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2091 ;;(load-library "its-dump/zenkaku-downcase") ;;;(define-its-mode "zenkaku-downcase" " a$B#a(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2092 ;;(load-library "its-dump/zenkaku-upcase") ;;;(define-its-mode "zenkaku-upcase" " a$B#A(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2093 ;; 92.3.13 by K.Handa
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2094 ;; (load "its-hira")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2095 ;; (load-library "its-kata")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2096 ;; (load-library "its-hankaku")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2097 ;; (load-library "its-zenkaku")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2098
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2099 (defvar its:*current-map* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2100 (make-variable-buffer-local 'its:*current-map*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2101 ;; 92.3.13 by K.Handa
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2102 ;; moved to each language specific setup files (japanese.el, ...)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2103 ;; (setq-default its:*current-map* (its:get-mode-map "roma-kana"))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2104
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2105 (defvar its:*previous-map* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2106 (make-variable-buffer-local 'its:*previous-map*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2107 (setq-default its:*previous-map* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2108
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2109 ;;;----------------------------------------------------------------------
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2110 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2111 ;;; Mode line control functions;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2112 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2113 ;;;----------------------------------------------------------------------
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2114
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2115 (defconst mode-line-egg-mode "--")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2116 (make-variable-buffer-local 'mode-line-egg-mode)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2117
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2118 (defvar mode-line-egg-mode-in-minibuffer "--" "global variable")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2119
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2120 (defun egg:find-symbol-in-tree (item tree)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2121 (if (consp tree)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2122 (or (egg:find-symbol-in-tree item (car tree))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2123 (egg:find-symbol-in-tree item (cdr tree)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2124 (equal item tree)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2125
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2126 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2127 ;;; nemacs Ver. 3.0 $B$G$O(B Fselect_window $B$,JQ99$K$J$j!"(Bminibuffer-window
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2128 ;;; $BB>$N(B window $B$H$N4V$G=PF~$j$,$"$k$H!"(Bmode-line $B$N99?7$r9T$J$$!"JQ?t(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2129 ;;; minibuffer-window-selected $B$NCM$,99?7$5$l$k(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2130 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2131
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2132 ;;; nemacs Ver. 4 $B$G$O(B Fselect_window $B$,JQ99$K$J$j!$(Bselect-window-hook
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2133 ;;; $B$,Dj5A$5$l$?!%$3$l$K$H$b$J$$=>Mh!$:FDj5A$7$F$$$?(B select-window,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2134 ;;; other-window, keyborad-quit, abort-recursive-edit, exit-minibuffer
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2135 ;;; $B$r:o=|$7$?!%(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2136
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2137 (defconst display-minibuffer-mode-in-minibuffer t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2138
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2139 (defvar minibuffer-window-selected nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2140
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2141 (defun egg:select-window-hook (old new)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2142 (if (and (eq old (minibuffer-window))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2143 (not (eq new (minibuffer-window))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2144 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2145 (set-buffer (window-buffer (minibuffer-window)))
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
2146 (set-minibuffer-preprompt nil)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
2147 (setq egg:*mode-on* (default-value 'egg:*mode-on*)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2148 egg:*input-mode* (default-value 'egg:*input-mode*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2149 egg:*in-fence-mode* (default-value 'egg:*in-fence-mode*))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2150 (if (eq new (minibuffer-window))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2151 (setq minibuffer-window-selected t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2152 (setq minibuffer-window-selected nil)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2153
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
2154 (defun egg:minibuffer-entry-hook ()
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
2155 (setq minibuffer-window-selected t))
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
2156
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
2157 (defun egg:minibuffer-exit-hook ()
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
2158 "Call upon exit from minibufffer"
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
2159 (set-minibuffer-preprompt nil)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
2160 (setq minibuffer-window-selected nil)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
2161 (save-excursion
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
2162 (set-buffer (window-buffer (minibuffer-window)))
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
2163 (setq egg:*mode-on* (default-value 'egg:*mode-on*)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
2164 egg:*input-mode* (default-value 'egg:*input-mode*)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
2165 egg:*in-fence-mode* (default-value 'egg:*in-fence-mode*))))
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
2166
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
2167 (if (boundp 'select-window-hook)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
2168 (add-hook 'select-window-hook 'egg:select-window-hook)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
2169 (add-hook 'minibuffer-exit-hook 'egg:minibuffer-exit-hook)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
2170 (add-hook 'minibuffer-entry-hook 'egg:minibuffer-entry-hook))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2171
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2172 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2173 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2174 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2175
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2176 (defvar its:*reset-modeline-format* nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2177
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2178 (if its:*reset-modeline-format*
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2179 (setq-default modeline-format
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2180 (cdr modeline-format)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2181
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2182 (if (not (egg:find-symbol-in-tree 'mode-line-egg-mode modeline-format))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2183 (setq-default
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2184 modeline-format
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2185 (cons (list 'display-minibuffer-mode-in-minibuffer
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2186 ;;; minibuffer mode in minibuffer
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2187 (list
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2188 (list 'its:*previous-map* "<" "[")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2189 'mode-line-egg-mode
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2190 (list 'its:*previous-map* ">" "]")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2191 )
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2192 ;;;; minibuffer mode in mode line
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2193 (list
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2194 (list 'minibuffer-window-selected
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2195 (list 'display-minibuffer-mode
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2196 "m"
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2197 " ")
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2198 " ")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2199 (list 'its:*previous-map* "<" "[")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2200 (list 'minibuffer-window-selected
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2201 (list 'display-minibuffer-mode
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2202 'mode-line-egg-mode-in-minibuffer
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2203 'mode-line-egg-mode)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2204 'mode-line-egg-mode)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2205 (list 'its:*previous-map* ">" "]")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2206 ))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2207 modeline-format)))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2208
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2209 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2210 ;;; minibuffer $B$G$N%b!<%II=<($r$9$k$?$a$K(B nemacs 4 $B$GDj5A$5$l$?(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2211 ;;; minibuffer-preprompt $B$rMxMQ$9$k!%(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2212 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2213
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2214 (defconst egg:minibuffer-preprompt '("[" nil "]"))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2215
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2216 (defun mode-line-egg-mode-update (str)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2217 (if (eq (current-buffer) (window-buffer (minibuffer-window)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2218 (if display-minibuffer-mode-in-minibuffer
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2219 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2220 (aset (nth 0 egg:minibuffer-preprompt) 0
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2221 (if its:*previous-map* ?\< ?\[))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2222 (setcar (nthcdr 1 egg:minibuffer-preprompt)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2223 str)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2224 (aset (nth 2 egg:minibuffer-preprompt) 0
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2225 (if its:*previous-map* ?\> ?\]))
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
2226 (set-minibuffer-preprompt (concat
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
2227 (car egg:minibuffer-preprompt)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
2228 (car (nthcdr 1 egg:minibuffer-preprompt))
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
2229 (car (nthcdr 2 egg:minibuffer-preprompt)))))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2230 (setq display-minibuffer-mode t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2231 mode-line-egg-mode-in-minibuffer str))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2232 (setq display-minibuffer-mode nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2233 mode-line-egg-mode str))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2234 (redraw-modeline t))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2235
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2236 (mode-line-egg-mode-update mode-line-egg-mode)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2237
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2238 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2239 ;;; egg mode line display
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2240 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2241
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2242 (defvar alphabet-mode-indicator "aA")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2243 (defvar transparent-mode-indicator "--")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2244
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2245 (defun egg:mode-line-display ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2246 (mode-line-egg-mode-update
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2247 (cond((and egg:*in-fence-mode* (not egg:*input-mode*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2248 alphabet-mode-indicator)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2249 ((and egg:*mode-on* egg:*input-mode*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2250 (map-indicator its:*current-map*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2251 (t transparent-mode-indicator))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2252
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2253 (defun egg:toggle-egg-mode-on-off ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2254 (interactive)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2255 (setq egg:*mode-on* (not egg:*mode-on*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2256 (egg:mode-line-display))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2257
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2258 (defun its:select-mode (name)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2259 (interactive (list (completing-read "ITS mode: " its:*mode-alist*)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2260 (if (its:get-mode-map name)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2261 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2262 (setq its:*current-map* (its:get-mode-map name))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2263 (egg:mode-line-display))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2264 (beep)))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2265
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2266 (defvar its:*select-mode-menu* '(menu "Mode:" nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2267
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2268 (defun its:select-mode-from-menu ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2269 (interactive)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2270 (setcar (nthcdr 2 its:*select-mode-menu*) its:*mode-alist*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2271 (setq its:*current-map* (menu:select-from-menu its:*select-mode-menu*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2272 (egg:mode-line-display))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2273
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2274 (defvar its:*standard-modes* nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2275 "List of standard mode-map of EGG."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2276 ;; 92.3.13 by K.Handa
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2277 ;; moved to each language specific setup files (japanese.el, ...)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2278 ;; (list (its:get-mode-map "roma-kana")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2279 ;; (its:get-mode-map "roma-kata")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2280 ;; (its:get-mode-map "downcase")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2281 ;; (its:get-mode-map "upcase")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2282 ;; (its:get-mode-map "zenkaku-downcase")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2283 ;; (its:get-mode-map "zenkaku-upcase"))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2284 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2285
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2286 (defun its:find (map list)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2287 (let ((n 0))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2288 (while (and list (not (eq map (car list))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2289 (setq list (cdr list)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2290 n (1+ n)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2291 (if list n nil)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2292
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2293 (defun its:next-mode ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2294 (interactive)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2295 (let ((pos (its:find its:*current-map* its:*standard-modes*)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2296 (setq its:*current-map*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2297 (nth (% (1+ pos) (length its:*standard-modes*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2298 its:*standard-modes*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2299 (egg:mode-line-display)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2300
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2301 (defun its:previous-mode ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2302 (interactive)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2303 (let ((pos (its:find its:*current-map* its:*standard-modes*)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2304 (setq its:*current-map*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2305 (nth (1- (if (= pos 0) (length its:*standard-modes*) pos))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2306 its:*standard-modes*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2307 (egg:mode-line-display)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2308
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2309 (defun its:select-hiragana () (interactive) (its:select-mode "roma-kana"))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2310 (defun its:select-katakana () (interactive) (its:select-mode "roma-kata"))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2311 (defun its:select-downcase () (interactive) (its:select-mode "downcase"))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2312 (defun its:select-upcase () (interactive) (its:select-mode "upcase"))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2313 (defun its:select-zenkaku-downcase () (interactive) (its:select-mode "zenkaku-downcase"))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2314 (defun its:select-zenkaku-upcase () (interactive) (its:select-mode "zenkaku-upcase"))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2315
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2316 (defun its:select-mode-temporally (name)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2317 (interactive (list (completing-read "ITS mode: " its:*mode-alist*)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2318 (let ((map (its:get-mode-map name)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2319 (if map
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2320 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2321 (if (null its:*previous-map*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2322 (setq its:*previous-map* its:*current-map*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2323 (setq its:*current-map* map)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2324 (egg:mode-line-display))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2325 (beep))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2326
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2327 (defun its:select-previous-mode ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2328 (interactive)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2329 (if (null its:*previous-map*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2330 (beep)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2331 (setq its:*current-map* its:*previous-map*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2332 its:*previous-map* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2333 (egg:mode-line-display)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2334
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2335
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2336 (defun toggle-egg-mode ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2337 (interactive)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2338 (if egg:*mode-on* (fence-toggle-egg-mode)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2339 (progn
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2340 (setq egg:*mode-on* t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2341 (egg:mode-line-display))))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2342
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2343 (defun fence-toggle-egg-mode ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2344 (interactive)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2345 (if its:*current-map*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2346 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2347 (setq egg:*input-mode* (not egg:*input-mode*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2348 (egg:mode-line-display))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2349 (beep)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2350
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2351 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2352 ;;; Changes on Global map
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2353 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2354
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2355 (defvar si:*global-map* (copy-keymap global-map))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2356
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2357 (substitute-key-definition 'self-insert-command
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2358 'egg-self-insert-command
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2359 global-map)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2360
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
2361 ;; wire us into pending-delete
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
2362 (put 'egg-self-insert-command 'pending-delete t)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
2363
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2364 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2365 ;;; Currently entries C-\ and C-^ at global-map are undefined.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2366 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2367
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2368 (define-key global-map "\C-\\" 'toggle-egg-mode)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2369 (define-key global-map "\C-x " 'henkan-region)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2370
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2371 ;; 92.3.16 by K.Handa
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2372 ;; global-map => mule-keymap
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2373 (define-key mule-keymap "m" 'its:select-mode-from-menu)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2374 (define-key mule-keymap ">" 'its:next-mode)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2375 (define-key mule-keymap "<" 'its:previous-mode)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2376 (define-key mule-keymap "h" 'its:select-hiragana)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2377 (define-key mule-keymap "k" 'its:select-katakana)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2378 (define-key mule-keymap "q" 'its:select-downcase)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2379 (define-key mule-keymap "Q" 'its:select-upcase)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2380 (define-key mule-keymap "z" 'its:select-zenkaku-downcase)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2381 (define-key mule-keymap "Z" 'its:select-zenkaku-upcase)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2382
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2383 ;;;
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
2384 ;;; auto fill control
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2385 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2386
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2387 (defun egg:do-auto-fill ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2388 (if (and auto-fill-function (not buffer-read-only)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2389 (> (current-column) fill-column))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2390 (let ((ocolumn (current-column)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2391 (funcall auto-fill-function)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2392 (while (and (< fill-column (current-column))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2393 (< (current-column) ocolumn))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2394 (setq ocolumn (current-column))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2395 (funcall auto-fill-function)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2396
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2397 ;;;----------------------------------------------------------------------
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2398 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2399 ;;; Egg fence mode
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2400 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2401 ;;;----------------------------------------------------------------------
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2402
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2403 (defconst egg:*fence-open* "|" "*$B%U%'%s%9$N;OE@$r<($9J8;zNs(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2404 (defconst egg:*fence-close* "|" "*$B%U%'%s%9$N=*E@$r<($9J8;zNs(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2405 (defconst egg:*fence-face* nil "*$B%U%'%s%9I=<($KMQ$$$k(B face $B$^$?$O(B nil")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2406 (make-variable-buffer-local
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2407 (defvar egg:*fence-extent* nil "$B%U%'%s%9I=<(MQ(B extent"))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2408
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2409 (defvar egg:*face-alist*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2410 '(("nil" . nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2411 ("highlight" . highlight) ("modeline" . modeline)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2412 ("inverse" . modeline) ("underline" . underline) ("bold" . bold)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2413 ("region" . region)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2414
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2415 (defun set-egg-fence-mode-format (open close &optional face)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2416 "fence mode $B$NI=<(J}K!$r@_Dj$9$k!#(BOPEN $B$O%U%'%s%9$N;OE@$r<($9J8;zNs$^$?$O(B nil$B!#(B\n\
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2417 CLOSE$B$O%U%'%s%9$N=*E@$r<($9J8;zNs$^$?$O(B nil$B!#(B\n\
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2418 $BBh(B3$B0z?t(B FACE $B$,;XDj$5$l$F(B nil $B$G$J$1$l$P!"%U%'%s%96h4V$NI=<($K$=$l$r;H$&!#(B"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2419 (interactive (list (read-string "$B%U%'%s%93+;OJ8;zNs(B: ")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2420 (read-string "$B%U%'%s%9=*N;J8;zNs(B: ")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2421 (cdr (assoc (completing-read "$B%U%'%s%9I=<(B0@-(B: " egg:*face-alist*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2422 egg:*face-alist*))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2423
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2424 (if (and (or (stringp open) (null open))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2425 (or (stringp close) (null close))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2426 (or (null face) (memq face (face-list))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2427 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2428 (setq egg:*fence-open* (or open "")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2429 egg:*fence-close* (or close "")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2430 egg:*fence-face* face)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2431 (if (extentp egg:*fence-extent*)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2432 (set-extent-property egg:*fence-extent* 'face egg:*fence-face*))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2433 t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2434 (error "Wrong type of argument: %s %s %s" open close face)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2435
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2436 (defvar egg:*region-start* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2437 (make-variable-buffer-local 'egg:*region-start*)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2438 (set-default 'egg:*region-start* nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2439 (defvar egg:*region-end* nil)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2440 (make-variable-buffer-local 'egg:*region-end*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2441 (set-default 'egg:*region-end* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2442 (defvar egg:*global-map-backup* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2443 (defvar egg:*local-map-backup* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2444
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2445
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2446 ;;; Moved to kanji.el
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2447 ;;; (defvar self-insert-after-hook nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2448 ;;; "Hook to run when extended self insertion command exits. Should take
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2449 ;;; two arguments START and END correspoding to character position.")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2450
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2451 (defvar egg:*self-insert-non-undo-count* 0
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2452 "counter to hold repetition of egg-self-insert-command.")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2453
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2454 (defun egg-self-insert-command (arg)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2455 (interactive "p")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2456 (if (and (not buffer-read-only)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2457 egg:*mode-on* egg:*input-mode*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2458 (not egg:*in-fence-mode*) ;;; inhibit recursive fence mode
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2459 (not (= (event-to-character last-command-event) ? )))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2460 (egg:enter-fence-mode-and-self-insert)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2461 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2462 ;; treat continuous 20 self insert as a single undo chunk.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2463 ;; `20' is a magic number copied from keyboard.c
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2464 (if (or ;92.12.20 by T.Enami
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2465 (not (eq last-command 'egg-self-insert-command))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2466 (>= egg:*self-insert-non-undo-count* 20))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2467 (setq egg:*self-insert-non-undo-count* 1)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2468 (cancel-undo-boundary)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2469 (setq egg:*self-insert-non-undo-count*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2470 (1+ egg:*self-insert-non-undo-count*)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2471 (self-insert-command arg)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2472 (if egg-insert-after-hook
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2473 (run-hooks 'egg-insert-after-hook))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2474 (if self-insert-after-hook
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2475 (if (<= 1 arg)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2476 (funcall self-insert-after-hook
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2477 (- (point) arg) (point)))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2478 (if (= (event-to-character last-command-event) ? ) (egg:do-auto-fill))))))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2479
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2480 ;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2481 ;; $BA03NDjJQ49=hM}4X?t(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2482 ;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2483 (defvar egg:*fence-open-backup* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2484 (defvar egg:*fence-close-backup* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2485 (defvar egg:*fence-face-backup* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2486
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2487 (defconst egg:*fence-open-in-cont* "+" "*$BA03NDj>uBV$G$N(B *fence-open*")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2488 (defconst egg:*fence-close-in-cont* t "*$BA03NDj>uBV$G$N(B *fence-close*")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2489 (defconst egg:*fence-face-in-cont* t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2490 "*$BA03NDj>uBV$G$N(B *fence-face*")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2491
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2492 (defun set-egg-fence-mode-format-in-cont (open close face)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2493 "$BA03NDj>uBV$G$N(B fence mode $B$NI=<(J}K!$r@_Dj$9$k!#(BOPEN $B$O%U%'%s%9$N;OE@$r<($9J8(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2494 $B;zNs!"(Bt $B$^$?$O(B nil$B!#(B\n\
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2495 CLOSE$B$O%U%'%s%9$N=*E@$r<($9J8;zNs!"(Bt $B$^$?$O(B nil$B!#(B\n\
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2496 FACE $B$O(B nil $B$G$J$1$l$P!"%U%'%s%96h4V$NI=<($K$=$l$r;H$&!#(B\n\
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2497 $B$=$l$>$l$NCM$,(B t $B$N>l9g!"DL>o$N(B egg:*fence-open* $BEy$NCM$r0z$-7Q$0!#(B"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2498 (interactive (list (read-string "$B%U%'%s%93+;OJ8;zNs(B: ")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2499 (read-string "$B%U%'%s%9=*N;J8;zNs(B: ")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2500 (cdr (assoc (completing-read "$B%U%'%s%9I=<(B0@-(B: " egg:*face
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2501 -alist*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2502 egg:*face-alist*))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2503
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2504 (if (and (or (stringp open) (eq open t) (null open))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2505 (or (stringp close) (eq close t) (null close))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2506 (or (null face) (eq face t) (memq face (face-list))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2507 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2508 (setq egg:*fence-open-in-cont* (or open "")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2509 egg:*fence-close-in-cont* (or close "")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2510 egg:*fence-face-in-cont* face)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2511 (if (extentp egg:*fence-extent*)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2512 (set-extent-property egg:*fence-extent* 'face egg:*fence-face*))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2513 t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2514 (error "Wrong type of argument: %s %s %s" open close face)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2515
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2516 (defvar *in-cont-flag* nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2517 "$BD>A0$KJQ49$7$?D>8e$NF~NO$+$I$&$+$r<($9!#(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2518
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2519 (defvar *in-cont-backup-flag* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2520
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2521 (defun egg:check-fence-in-cont ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2522 (if *in-cont-flag*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2523 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2524 (setq *in-cont-backup-flag* t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2525 (setq egg:*fence-open-backup* egg:*fence-open*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2526 (setq egg:*fence-close-backup* egg:*fence-close*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2527 (setq egg:*fence-face-backup* egg:*fence-face*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2528 (or (eq egg:*fence-open-in-cont* t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2529 (setq egg:*fence-open* egg:*fence-open-in-cont*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2530 (or (eq egg:*fence-close-in-cont* t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2531 (setq egg:*fence-close* egg:*fence-close-in-cont*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2532 (or (eq egg:*fence-face-in-cont* t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2533 (setq egg:*fence-face* egg:*fence-face-in-cont*)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2534
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2535 (defun egg:restore-fence-in-cont ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2536 "Restore egg:*fence-open* and egg:*fence-close*"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2537 (if *in-cont-backup-flag*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2538 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2539 (setq egg:*fence-open* egg:*fence-open-backup*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2540 (setq egg:*fence-close* egg:*fence-close-backup*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2541 (setq egg:*fence-face* egg:*fence-face-backup*)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2542 (setq *in-cont-backup-flag* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2543 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2544
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2545 (defun egg:enter-fence-mode-and-self-insert ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2546 (setq *in-cont-flag*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2547 (memq last-command '(henkan-kakutei henkan-kakutei-and-self-insert)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2548 (enter-fence-mode)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2549 (setq unread-command-events (list last-command-event)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2550
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2551 (defun egg:fence-face-on ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2552 (if egg:*fence-face*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2553 (progn
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2554 (if (extentp egg:*fence-extent*)
153
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 142
diff changeset
2555 (set-extent-endpoints egg:*fence-extent* egg:*region-start* egg:*region-end*)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 142
diff changeset
2556 (setq egg:*fence-extent* (make-extent egg:*region-start* egg:*region-end*))
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 142
diff changeset
2557 (set-extent-property egg:*fence-extent* 'start-open nil)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 142
diff changeset
2558 (set-extent-property egg:*fence-extent* 'end-open nil)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 142
diff changeset
2559 (set-extent-property egg:*fence-extent* 'detachable nil))
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 142
diff changeset
2560 (set-extent-face egg:*fence-extent* egg:*fence-face*))))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2561
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2562 (defun egg:fence-face-off ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2563 (and egg:*fence-face*
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2564 (extentp egg:*fence-extent*)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2565 (detach-extent egg:*fence-extent*) ))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2566
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2567 (defun enter-fence-mode ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2568 ;; XEmacs change:
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
2569 ; (buffer-disable-undo (current-buffer))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
2570 (undo-boundary)
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 138
diff changeset
2571 (setq egg:*in-fence-mode* t
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 138
diff changeset
2572 egg:fence-buffer (current-buffer))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2573 (egg:mode-line-display)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2574 ;;;(setq egg:*global-map-backup* (current-global-map))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2575 (setq egg:*local-map-backup* (current-local-map))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2576 ;;;(use-global-map fence-mode-map)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2577 ;;;(use-local-map nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2578 (use-local-map fence-mode-map)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2579 (egg:check-fence-in-cont) ; for Wnn6
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2580 (insert egg:*fence-open*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2581 (or (markerp egg:*region-start*) (setq egg:*region-start* (make-marker)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2582 (set-marker egg:*region-start* (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2583 (insert egg:*fence-close*)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2584 (or (markerp egg:*region-end*) (set-marker-insertion-type (setq egg:*region-end* (make-marker)) t))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2585 (set-marker egg:*region-end* egg:*region-start*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2586 (egg:fence-face-on)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2587 (goto-char egg:*region-start*)
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2588 (add-hook 'post-command-hook 'fence-post-command-hook)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2589 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2590
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2591 (defun henkan-fence-region-or-single-space ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2592 (interactive)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2593 (if egg:*input-mode*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2594 (henkan-fence-region)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2595 (insert ? )))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2596
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2597 (defvar egg:*henkan-fence-mode* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2598
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2599 (defun henkan-fence-region ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2600 (interactive)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2601 (setq egg:*henkan-fence-mode* t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2602 (egg:fence-face-off)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2603 (henkan-region-internal egg:*region-start* egg:*region-end* ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2604
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2605 (defun fence-katakana ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2606 (interactive)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2607 (katakana-region egg:*region-start* egg:*region-end* ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2608
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2609 (defun fence-hiragana ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2610 (interactive)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2611 (hiragana-region egg:*region-start* egg:*region-end*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2612
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2613 (defun fence-hankaku ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2614 (interactive)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2615 (hankaku-region egg:*region-start* egg:*region-end*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2616
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2617 (defun fence-zenkaku ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2618 (interactive)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2619 (zenkaku-region egg:*region-start* egg:*region-end*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2620
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2621 (defun fence-backward-char ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2622 (interactive)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2623 (if (< egg:*region-start* (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2624 (backward-char)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2625 (beep)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2626
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2627 (defun fence-forward-char ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2628 (interactive)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2629 (if (< (point) egg:*region-end*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2630 (forward-char)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2631 (beep)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2632
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2633 (defun fence-beginning-of-line ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2634 (interactive)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2635 (goto-char egg:*region-start*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2636
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2637 (defun fence-end-of-line ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2638 (interactive)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2639 (goto-char egg:*region-end*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2640
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2641 (defun fence-transpose-chars (arg)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2642 (interactive "P")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2643 (if (and (< egg:*region-start* (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2644 (< (point) egg:*region-end*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2645 (transpose-chars arg)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2646 (beep)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2647
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2648 (defun egg:exit-if-empty-region ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2649 (if (= egg:*region-start* egg:*region-end*)
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2650 (fence-exit-internal)))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2651
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2652 (defun fence-delete-char ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2653 (interactive)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2654 (if (< (point) egg:*region-end*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2655 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2656 (delete-char 1)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2657 (egg:exit-if-empty-region))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2658 (beep)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2659
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2660 (defun fence-backward-delete-char ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2661 (interactive)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2662 (if (< egg:*region-start* (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2663 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2664 (delete-char -1)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2665 (egg:exit-if-empty-region))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2666 (beep)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2667
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2668 (defun fence-kill-line ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2669 (interactive)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2670 (delete-region (point) egg:*region-end*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2671 (egg:exit-if-empty-region))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2672
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2673 (defun fence-exit-mode ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2674 (interactive)
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2675 (fence-exit-internal))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2676
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2677 (defun fence-exit-internal ()
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2678 (delete-region (- egg:*region-start* (length egg:*fence-open*)) egg:*region-start*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2679 (delete-region egg:*region-end* (+ egg:*region-end* (length egg:*fence-close*)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2680 (egg:fence-face-off)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2681 (if its:*previous-map*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2682 (setq its:*current-map* its:*previous-map*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2683 its:*previous-map* nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2684 (egg:quit-egg-mode))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2685
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
2686 ;; jhod: This seems bogus to me, as it should be called either after each
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
2687 ;; egg-self-insert, or after accepting input, but not both. Otherwise, I can't
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
2688 ;; really think of a use for it.
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
2689 (defvar egg-insert-after-hook nil "Hook to run when egg inserts a character
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
2690 in the buffer")
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2691 (make-variable-buffer-local 'egg-insert-after-hook)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2692
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2693 (defvar egg-exit-hook nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2694 "Hook to run when egg exits. Should take two arguments START and END
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2695 correspoding to character position.")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2696
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2697 (defun egg:quit-egg-mode ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2698 ;;;(use-global-map egg:*global-map-backup*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2699 (use-local-map egg:*local-map-backup*)
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2700 (remove-hook 'post-command-hook 'fence-post-command-hook)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2701 (setq egg:*in-fence-mode* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2702 (egg:mode-line-display)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2703 (if overwrite-mode
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2704 (let ((str (buffer-substring egg:*region-end* egg:*region-start*)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2705 (delete-text-in-column nil (+ (current-column) (string-width str)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2706 (egg:restore-fence-in-cont) ; for Wnn6
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2707 (setq egg:*henkan-fence-mode* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2708 (if self-insert-after-hook
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2709 (funcall self-insert-after-hook egg:*region-start* egg:*region-end*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2710 (if egg-exit-hook
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2711 (funcall egg-exit-hook egg:*region-start* egg:*region-end*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2712 (if (not (= egg:*region-start* egg:*region-end*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2713 (egg:do-auto-fill))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2714 (set-marker egg:*region-start* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2715 (set-marker egg:*region-end* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2716 ;; XEmacs change:
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
2717 ; (buffer-enable-undo (current-buffer))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2718 (if egg-insert-after-hook
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2719 (run-hooks 'egg-insert-after-hook))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2720 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2721
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2722 (defun fence-cancel-input ()
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2723 "Cancel all fence operations in the current buffer"
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2724 (interactive)
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2725 (fence-kill-operation))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2726
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2727 (defun fence-kill-operation ()
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2728 "Internal method to remove fences"
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2729 (delete-region egg:*region-start* egg:*region-end*)
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2730 (fence-exit-internal))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2731
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2732 (defun fence-post-command-hook ()
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2733 ;; For use as the value of `post-command-hook' when fence is active.
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2734 ;; If we got out of the region specified by the fence,
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 138
diff changeset
2735 ;; kill the fence before that command is executed.
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 138
diff changeset
2736 ;;
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 138
diff changeset
2737 (cond ((not (eq (current-buffer) egg:fence-buffer))
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 138
diff changeset
2738 ;; If the buffer (likely meaning "frame") has changed, bail.
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 138
diff changeset
2739 ;; This can also happen if a proc filter has popped up another
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 138
diff changeset
2740 ;; buffer, which is arguably a bad thing for it to have done,
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 138
diff changeset
2741 ;; but the way in which egg would have hosed you in that
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 138
diff changeset
2742 ;; case is unarguably even worse.
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 138
diff changeset
2743 (save-excursion
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 138
diff changeset
2744 (set-buffer egg:fence-buffer)
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 138
diff changeset
2745 (its:reset-input)
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2746 (fence-kill-operation)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2747 ((or (< (point) egg:*region-start*)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2748 (> (point) egg:*region-end*))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2749 (save-excursion
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2750 (its:reset-input)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2751 (fence-kill-operation)))))
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 138
diff changeset
2752
138
6608ceec7cf8 Import from CVS: tag r20-2b3
cvs
parents: 134
diff changeset
2753 (defun egg-lang-switch-callback ()
6608ceec7cf8 Import from CVS: tag r20-2b3
cvs
parents: 134
diff changeset
2754 "Do whatever processing is necessary when the language-environment changes."
6608ceec7cf8 Import from CVS: tag r20-2b3
cvs
parents: 134
diff changeset
2755 (if egg:*in-fence-mode*
6608ceec7cf8 Import from CVS: tag r20-2b3
cvs
parents: 134
diff changeset
2756 (progn
6608ceec7cf8 Import from CVS: tag r20-2b3
cvs
parents: 134
diff changeset
2757 (its:reset-input)
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2758 (fence-kill-operation)))
138
6608ceec7cf8 Import from CVS: tag r20-2b3
cvs
parents: 134
diff changeset
2759 (let ((func (get current-language-environment 'set-egg-environ)))
6608ceec7cf8 Import from CVS: tag r20-2b3
cvs
parents: 134
diff changeset
2760 (if (not (null func))
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 138
diff changeset
2761 (funcall func)))
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 138
diff changeset
2762 (egg:mode-line-display))
138
6608ceec7cf8 Import from CVS: tag r20-2b3
cvs
parents: 134
diff changeset
2763
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2764 (defun fence-mode-help-command ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2765 "Display documentation for fence-mode."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2766 (interactive)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2767 (let ((buf "*Help*"))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2768 (if (eq (get-buffer buf) (current-buffer))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2769 (henkan-quit)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2770 (with-output-to-temp-buffer buf
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2771 (princ (substitute-command-keys "The keys that are defined for the fence mode here are:\\{fence-mode-map}"))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2772 (print-help-return-message)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2773
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2774 (defvar fence-mode-map (make-keymap))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2775
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2776 (substitute-key-definition 'egg-self-insert-command
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2777 'fence-self-insert-command
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2778 fence-mode-map global-map)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2779
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2780 (define-key fence-mode-map "\eh" 'fence-hiragana)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2781 (define-key fence-mode-map "\ek" 'fence-katakana)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2782 (define-key fence-mode-map "\e<" 'fence-hankaku)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2783 (define-key fence-mode-map "\e>" 'fence-zenkaku)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2784 (define-key fence-mode-map "\e\C-h" 'its:select-hiragana)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2785 (define-key fence-mode-map "\e\C-k" 'its:select-katakana)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2786 (define-key fence-mode-map "\eq" 'its:select-downcase)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2787 (define-key fence-mode-map "\eQ" 'its:select-upcase)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2788 (define-key fence-mode-map "\ez" 'its:select-zenkaku-downcase)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2789 (define-key fence-mode-map "\eZ" 'its:select-zenkaku-upcase)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2790 (define-key fence-mode-map " " 'henkan-fence-region-or-single-space)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2791 (define-key fence-mode-map "\C-@" 'henkan-fence-region)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2792 (define-key fence-mode-map [(control \ )] 'henkan-fence-region)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2793 (define-key fence-mode-map "\C-a" 'fence-beginning-of-line)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2794 (define-key fence-mode-map "\C-b" 'fence-backward-char)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2795 (define-key fence-mode-map "\C-c" 'fence-cancel-input)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2796 (define-key fence-mode-map "\C-d" 'fence-delete-char)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2797 (define-key fence-mode-map "\C-e" 'fence-end-of-line)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2798 (define-key fence-mode-map "\C-f" 'fence-forward-char)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2799 (define-key fence-mode-map "\C-g" 'fence-cancel-input)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2800 (define-key fence-mode-map "\C-h" 'fence-mode-help-command)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2801 (define-key fence-mode-map "\C-k" 'fence-kill-line)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2802 (define-key fence-mode-map "\C-l" 'fence-exit-mode)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2803 (define-key fence-mode-map "\C-m" 'fence-exit-mode) ;;; RET
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2804 (define-key fence-mode-map [return] 'fence-exit-mode)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2805 (define-key fence-mode-map "\C-q" 'its:select-previous-mode)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2806 (define-key fence-mode-map "\C-t" 'fence-transpose-chars)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2807 (define-key fence-mode-map "\C-w" 'henkan-fence-region)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2808 (define-key fence-mode-map "\C-z" 'eval-expression)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2809 (define-key fence-mode-map "\C-\\" 'fence-toggle-egg-mode)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2810 (define-key fence-mode-map "\C-_" 'jis-code-input)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2811 (define-key fence-mode-map "\177" 'fence-backward-delete-char)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2812 (define-key fence-mode-map [delete] 'fence-backward-delete-char)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2813 (define-key fence-mode-map [backspace] 'fence-backward-delete-char)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2814 (define-key fence-mode-map [right] 'fence-forward-char)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2815 (define-key fence-mode-map [left] 'fence-backward-char)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2816
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2817 ;;;----------------------------------------------------------------------
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2818 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2819 ;;; Read hiragana from minibuffer
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2820 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2821 ;;;----------------------------------------------------------------------
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2822
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2823 (defvar egg:*minibuffer-local-hiragana-map* (copy-keymap minibuffer-local-map))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2824
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2825 (substitute-key-definition 'self-insert-command
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2826 'fence-self-insert-command
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2827 egg:*minibuffer-local-hiragana-map*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2828 minibuffer-local-map)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2829
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2830 (defun read-hiragana-string (prompt &optional initial-input)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2831 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2832 (let ((minibuff (window-buffer (minibuffer-window))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2833 (set-buffer minibuff)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2834 (setq egg:*input-mode* t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2835 egg:*mode-on* t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2836 its:*current-map* (its:get-mode-map "roma-kana"))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2837 (mode-line-egg-mode-update (its:get-mode-indicator its:*current-map*))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2838 (read-from-minibuffer prompt initial-input
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2839 egg:*minibuffer-local-hiragana-map*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2840
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2841 (defun read-kanji-string (prompt &optional initial-input)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2842 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2843 (let ((minibuff (window-buffer (minibuffer-window))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2844 (set-buffer minibuff)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2845 (setq egg:*input-mode* t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2846 egg:*mode-on* t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2847 its:*current-map* (its:get-mode-map "roma-kana"))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2848 (mode-line-egg-mode-update (its:get-mode-indicator "roma-kana"))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2849 (read-from-minibuffer prompt initial-input))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2850
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2851 (defconst isearch:read-kanji-string 'read-kanji-string)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2852
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2853 ;;; $B5-9fF~NO(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2854
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2855 (defvar special-symbol-input-point nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2856
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2857 (defun special-symbol-input ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2858 (interactive)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2859 (require 'egg-jsymbol)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2860 ;; 92.7.8 by Y.Kawabe
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2861 (let ((item (menu:select-from-menu
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2862 *symbol-input-menu* special-symbol-input-point t))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2863 (code t))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2864 (and (listp item)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2865 (setq code (car item) special-symbol-input-point (cdr item)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2866 ;; end of patch
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2867 (cond((stringp code) (insert code))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2868 ((consp code) (eval code))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2869 )))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2870
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2871 (define-key global-map "\C-^" 'special-symbol-input)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2872
138
6608ceec7cf8 Import from CVS: tag r20-2b3
cvs
parents: 134
diff changeset
2873 (autoload 'busyu-input "egg-busyu" nil t)
6608ceec7cf8 Import from CVS: tag r20-2b3
cvs
parents: 134
diff changeset
2874 (autoload 'kakusuu-input "egg-busyu" nil t)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2875
142
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2876 ;; put us into all existing buffer's modelines
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2877 (if (not (featurep 'egg))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2878 (mapc-internal
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2879 (lambda (buf)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2880 (save-excursion
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2881 (set-buffer buf)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2882 (setq modeline-format (cons (list 'display-minibuffer-mode-in-minibuffer
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2883 ;;; minibuffer mode in minibuffer
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2884 (list
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2885 (list 'its:*previous-map* "<" "[")
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2886 'mode-line-egg-mode
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2887 (list 'its:*previous-map* ">" "]")
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2888 )
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2889 ;;;; minibuffer mode in mode line
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2890 (list
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2891 (list 'minibuffer-window-selected
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2892 (list 'display-minibuffer-mode
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2893 "m"
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2894 " ")
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2895 " ")
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2896 (list 'its:*previous-map* "<" "[")
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2897 (list 'minibuffer-window-selected
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2898 (list 'display-minibuffer-mode
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2899 'mode-line-egg-mode-in-minibuffer
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2900 'mode-line-egg-mode)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2901 'mode-line-egg-mode)
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2902 (list 'its:*previous-map* ">" "]")
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2903 ))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2904 modeline-format))))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2905 (buffer-list)))
1856695b1fa9 Import from CVS: tag r20-2b5
cvs
parents: 140
diff changeset
2906
126
1370575f1259 Import from CVS: tag xemacs-20-1p1
cvs
parents: 114
diff changeset
2907 (provide 'egg)
1370575f1259 Import from CVS: tag xemacs-20-1p1
cvs
parents: 114
diff changeset
2908
138
6608ceec7cf8 Import from CVS: tag r20-2b3
cvs
parents: 134
diff changeset
2909 ;; if set-lang-environment has already been called, call egg-lang-switch-callback
6608ceec7cf8 Import from CVS: tag r20-2b3
cvs
parents: 134
diff changeset
2910 (if (not (null current-language-environment))
6608ceec7cf8 Import from CVS: tag r20-2b3
cvs
parents: 134
diff changeset
2911 (egg-lang-switch-callback))
6608ceec7cf8 Import from CVS: tag r20-2b3
cvs
parents: 134
diff changeset
2912
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2913 ;;; egg.el ends here