aboutsummaryrefslogtreecommitdiff
path: root/emacs.rc
blob: 6f99f7be5f54898955f37957c632a0b6e3bceffb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
;	EMACS.RC / .emascrc
;
;	Startup file for MicroEMACS 3.9 and uEmacs/PK 4.0
;	This file is executed every time the editor is entered.
;
;	Modified by Petri Kutvonen, last edited September 1991.

set $discmd "FALSE"

;	First, try to resolve if we are on a PC ... yes, this is a kludge

!if &seq $sres "NORMAL"
	set %system "OTHER"
!else
	set %system "PC"
!endif

!if &seq %system "PC"

;	PC specific initialization

write-message "(Setting up)"

;	Comment out or change this line if you want more than 25 lines,
;	other possible $sres values include EGA and VGA

set $sres "CGA"

;	Uncomment next line if your old screen "snows"

;set $flicker "TRUE"

;	If your screen "snows" you'll not like scrolling

!if &seq $flicker "TRUE"
	set $scroll "FALSE"
!endif

;	Function keys (unshifted)
;	f1  f2  f3  f4  f5  f6  f7  f8  f9  f10
;	FN; FN< FN= FN> FN? FN@ FNA FNB FNC FND

bind-to-key help			FN;	
bind-to-key exit-emacs			FND

;	Function keys (shifted)
;	F1  F2  F3  F4  F5  F6  F7  F8  F9  F10
;	FNT FNU FNV FNW FNX FNY FNZ FN[ FN\ FN]

;	Other special keys (unshifted)
;	Home End  Ins  Del  PgUp PgDn  
;	FNG  FNO  FNR  FNS  FNI  FNQ

;       Some common Alt-keys
;	Alt-X Alt-Z Alt-C Alt-F Alt-O
;	FN-   FN,   FN.   FN!   FN^X

bind-to-key exit-emacs			FN-
bind-to-key quick-exit			FN,
bind-to-key i-shell			FN.
bind-to-key find-file			FN!
bind-to-key view-file			FN/
bind-to-key next-window			FN^X

;	Set screen colors

;	You can define a DOS environment variable EMACS_BW (any value)
;	if you don't like colors, e.g. if you have a LCD screen

!if &seq &env "EMACS_BW" ""
	add-global-mode "blue"
	add-global-mode "HIGH"
!endif

!endif

;	Help facility

40 	store-macro
	set $discmd "FALSE"
	!if &not &seq $cbufname "emacs.hlp"
		write-message "(Loading Help)"
		!force help
		!force 8 resize-window
		!if &seq %system "PC"
			!if &seq &env "EMACS_BW" ""
				add-mode "red"
			!endif
			bind-to-key execute-macro-38 FNI
			bind-to-key execute-macro-37 FNQ
		!else
			bind-to-key execute-macro-38 FN5
			bind-to-key execute-macro-37 FN6
		!endif
		beginning-of-line
		2 forward-character
		1 redraw-display
		save-window
		!if &seq %system "PC"
			set %hlpupdn "<PgUp> / <PgDn>"
			set %hlphelp "<F1>"
		!else
			set %hlpupdn "<Prev Scrn> / <Next Scrn>"
			set %hlphelp "<Help>"
		!endif
		execute-macro-39
	!else
		set %hlpcode &lef $line 2 
		!if &seq %hlpcode ".."
			set %hlptopic &mid $line 4 99
			end-of-line
			!force search-forward %hlptopic
			beginning-of-line
			2 forward-character
			1 redraw-display
			execute-macro-39
		!else
			!if &seq %system "PC"
				bind-to-key previous-page FNI
				bind-to-key next-page FNQ
			!else
				bind-to-key previous-page FN5
				bind-to-key next-page FN6
			!endif
			!force restore-window
			!force delete-window
			clear-message-line
		!endif
	!endif
	set $discmd "TRUE"
!endm

bind-to-key execute-macro-40 M-?
!if &seq %system "PC"
	bind-to-key execute-macro-40 FN;
!else
	bind-to-key execute-macro-40 FNh
!endif

;	Help on Help

39	store-macro
	!if &seq &rig $line 5 "INDEX"
		write-message &cat "Select topic from list and press " %hlphelp
	!else
		write-message &cat "Use " &cat %hlpupdn &cat " to scan help file -- " &cat %hlphelp " to toggle help window"
	!endif
!endm

;	Previous help page

38 	store-macro
	!if &seq $cbufname "emacs.hlp"
		beginning-of-line
		!force search-reverse "=>"
		2 forward-character
		1 redraw-display
		execute-macro-39
	!else
		previous-page
	!endif
!endm

;	Next help page

37 	store-macro
	!if &seq $cbufname "emacs.hlp"
		beginning-of-line
		2 forward-character
		!force search-forward "=>"
		1 redraw-display
		execute-macro-39
	!else
		next-page
	!endif
!endm

;	Set up auto CMODE

36	store-macro
	!if &seq &mid $cfname 1 7 "/tmp/Re"
		add-mode "wrap"
		!return
	!endif
	!if &gre &sin $cfname "/.ed" 0
		add-mode "wrap"
		!return
	!endif
	!if &gre &sin $cfname "/.let" 0
		add-mode "wrap"
		!return
	!endif
	!if &gre &sin $cfname "/.art" 0
		add-mode "wrap"
		!return
	!endif
	!if &gre &sin $cfname "/nn." 0
		add-mode "wrap"
		!return
	!endif
	set %rctmp &sin $cfname "."
	!if &equ %rctmp 0
		!return
	!endif
	set %rctmp &mid $cfname &add %rctmp 1 5
	!if &or &seq %rctmp "c" &seq %rctmp "h"
		add-mode "cmode"
	!endif
	!if &or &seq %rctmp "txt" &or &seq %rctmp "doc" &or &seq %rctmp "tmp" &seq %rctmp "tex"
		add-mode "wrap"
	!endif

!endm
	
bind-to-key execute-macro-36	M-FNR

;	Setup for ASCII {|}[\] to ISO Latin-1 translation

21	store-macro
	insert-string "ä"
!endm
22	store-macro
	insert-string "ö"
!endm
23	store-macro
	insert-string "å"
!endm
24	store-macro
	insert-string "Ä"
!endm
25	store-macro
	insert-string "Ö"
!endm
26	store-macro
	insert-string "Å"
!endm

27	store-macro
	bind-to-key execute-macro-21 {
	bind-to-key execute-macro-22 |
	bind-to-key execute-macro-23 }
	bind-to-key execute-macro-24 [
	bind-to-key execute-macro-25 \
	bind-to-key execute-macro-26 ]
	write-message "ISO Latin-1 äöåÄÖÅ"
!endm

28	store-macro
	unbind-key {
	unbind-key |
	unbind-key }
	unbind-key [
	unbind-key \
	unbind-key ]
	write-message "ASCII {|}[\]"
!endm

bind-to-key execute-macro-27 ^X[
bind-to-key execute-macro-28 ^X]

;	Make cut-paste easier in window systems

bind-to-key	newline	^J

;	uEmacs/PK specific initialization

!if &seq $progname "uEmacs/PK"

;	Don't scroll on a Sun

	!if &or &seq $TERM "sun" &seq $TERM "sun-cmd"
		set $scroll "FALSE"
	!endif

;	Execute local initialization files

	!if &seq %system "PC"
		!force execute-file "EM.RC"
	!else
		!force execute-file &cat $HOME "/.emrc"
		!force execute-file ".emrc"
	!endif
!endif

!if &gre &sin $LANG "UTF-8" 0
	add-global-mode "utf-8"
!endif

!if &gre &sin $LANG "utf8" 0
	add-global-mode "utf-8"
!endif
add-global-mode "utf-8"

set $discmd "TRUE"