Source

XEmacs / etc / TUTORIAL

   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
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
You are looking at the XEmacs tutorial.  See end for copyrights and conditions.

XEmacs commands generally involve the CONTROL key (sometimes labeled
CTRL or CTL) or the META key. "META" is a traditional Emacs term; on
most keyboards, the key is labeled "Alt". (On Sun keyboards, the META
key is labeled with a diamond, and is *NOT* the Alt key, which also
exists.) On some TTY's, there is no META key; in this case, use ESC.
Rather than write out META or CONTROL each time we want you to prefix a
character, we'll use the following abbreviations:

 C-<chr>  means hold the CONTROL key while typing the character <chr>
	  Thus, C-f would be: hold the CONTROL key and type f.
 M-<chr>  means hold the META (i.e. Alt) key down while typing <chr>.
          (See above for Sun keyboards and TTY's.)

Important note: to end the XEmacs session, type C-x C-c.  (Two characters.)

To move to the next screen, type <Next> (often labeled PgDn).  On TTY's,
you may not have such a key; use C-v instead. (Hold down the CONTROL key
while typing v.)

To move to the previous screen, type <Prior> (often labeled PgUp).  On
TTY's, use M-v. (Remember, this means META + v; if you have no META or Alt
key that works, press and release ESC, then type v.)

The characters ">>" at the left margin indicate directions for you to
try using a command.  For instance:

>>  Try typing <Next> and then <Prior>, a few times. (Or C-v and M-v,
    on TTY's.)

Note that there is an overlap of two lines when you move from screen to
screen; this provides some continuity so you can continue reading the text.

In general, every "cursor key" (the arrows and similar keys set off to the
right side of the keyboard) has an equivalent binding that uses only the
alphanumeric keys in combination with CONTROL and/or META, so that TTY
users can use XEmacs.

(In fact, in olden days, this "older way" was the only way to do things,
and you will still often see references to these keys as the "recommended"
way of doing things.  We don't actually recommend that you use these older
bindings in preference to the more obvious cursor keys, since the cursor
keys are easier to remember and usually more convenient to use.  However,
it's useful to know the older bindings, either in case you ever use a TTY
or so that you can make sense of references to them.  From now on, we will
mention the TTY bindings in parentheses, and expect that TTY users will
substitute them whenever we mention a cursor key.)

Now you may ask, what is a TTY?  A TTY (or "TeleTYpe")is a text-only
connection, the kind you get when you use the "telnet" program to log into
a remote site.  Up till 20 years ago or so, such text-only connections were
all that existed to communicate with a computer, usually via a "terminal"
(a combination keyboard and monochrome screen) connected directly to a
computer.  Nowadays, such dedicated TTY's are increasingly rare, and most
people only run into them when using telnet.  Emacs began in those olden
days, and it still carries some baggage from that time, but things have
greatly improved since then.  Now, you are probably using XEmacs under MS
Windows or X Windows, collectively termed a "window system".


* SUMMARY
---------

The following commands are useful for viewing screenfuls:

	<Next>	 Move forward one screenful (C-v on TTY's)
	<Prior>	 Move backward one screenful (M-v on TTY's)
	 C-l	 Clear frame and redisplay all the text,
		 moving the text around the cursor
		 to the center of the window.
		 (That's CONTROL-L, not CONTROL-1.)

>> Find the cursor, and note what text is near it. Then type C-l.
   Find the cursor again and notice that the same text is still near
   the cursor, but now it is in the center of the screen.
   If you press C-l again, this piece of text will move to the top of
   the screen.  Press C-l again, and it moves to the bottom.

* SOME TERMINOLOGY
------------------

All aspects of computers have terminology associated with them, and until
you master the terminology, things can seem overwhelming.  To add to this,
however, XEmacs has its own terminology, some of which of course includes
terms for concepts new to XEmacs.  Some XEmacs terminology, however, is
just nonstandard terms for familiar objects and concepts. (This is because
Emacs began a long time ago, when many standard things in today's computers
didn't exist, and others that did exist had different names.)

To make things easier for you, the most common XEmacs terms that you will
find in this tutorial are defined here, even though some have already been
defined above and others aren't discussed in detail until later.  This way,
if you come across an unfamiliar term, you know exactly where to look to
find the definition.  Don't worry if you don't understand all the terms; if
you keep reading the tutorial, eventually all the terms will be explained
in detail.

Term		Definition
--------------------------
C-		A keystroke involving the CONTROL key.  C-k is sometimes
		indicated as CONTROL + k or (not in XEmacs) ^K, and means
		to hold down the CONTROL key and hit the k key.
Info		The name of XEmacs' online documentation, accessed through
		C-h i.
M-		A keystroke involving the META key.  See META.
META		An abstract name for a particular modifier key, which has
		different correspondences depending on your keyboard.  On
		most keyboards, META is the Alt key, but on Sun keyboards it's
		a key labeled with a diamond, and *NOT* the Alt key, which
		also exists.  META can also be simulated by pressing ESC before
		the other key, but in reality this is just two separate keys,
		not a modifier plus a key: If you want to do M-f M-f, normally
		you can hold down (e.g.) Alt, hit f twice, and release the Alt,
		but when using ESC as META, you'd have to type ESC f ESC f.
TTY		A text-only connection to a computer, such as when you
		telnet into a machine.  See the previous section for more
		explanation.
binding		The command that's bound to a particular key sequence; you
		can find out what the binding is and how the command works
		using C-h k; it's also possible to change the bindings of
		key sequences, but this isn't discussed in the tutorial
buffer		A block of memory holding some text, such as the text of a
		file, email message, list of files in a directory, etc.  All
		visible windows are always displaying the text of some buffer,
		and more than one window can be displaying the same buffer.
		In this case, each buffer has a different value for point
		(see definition).
cursor		A block or bar showing where in the text the current insertion
		point is.
cursor key	Any of the keys used for moving the cursor, such as the arrow
		keys, <Next> and <Prior> (often labeled PgUp and PgDn),
		<Home> and <End>, etc.  Usually set off to the right of the
		main part of the keyboard, often painted gray.
echo area	A one-line area at the bottom of the frame where messages are
		output.  It shares the same space as the minibuffer, which
		works because the minibuffer is not active most of the time
		and is active only for short intervals. (Even then, if a
		message needs to be displayed, the minibuffer will temporarily
		disappear, the message will be displayed, and then the
		minibuffer will appear again in a few seconds.)
frame		Same as what's standardly called a "window" in a window system.
		TTY's only have one visible frame, but it's possible to create
		others and switch between them (sort of like if, in a window
		system, all your windows were maximized to take up the whole
		screen, so you could only see one at once).
isearch		Incremental search.  An Emacs invention that is a special,
		extra-efficient way of searching.  Each time you type a
		character in a search string, XEmacs immediately finds the
		next match for what you've typed so far.  This way, you avoid
		typing more keys than necessary to find what you're looking
		for.
key sequence	A sequence of one or more keystrokes that together make a
		command.  C-x C-f, C-x 5 0, C-l, and <Next> are all key
		sequences.  See also "binding".
keystroke	A combination of a key and a modifier (e.g. CONTROL, SHIFT,
		META).
kill		Standardly known as "cut".  Remove text and remember it, so
                that it can be "yanked" (standardly, "pasted") later.  Multiple
		"kills" are remembered, not only the most recent, and can be
		accessed using M-y.  "kill" is also sometimes used in general
                to refer to deleting anything other than text, e.g. buffers,
		toolbar items, local variables, subprocesses, abbreviations,
		or to terminating the XEmacs process.
minibuffer	A small buffer (usually one line, but it may expand as
		necessary) at the bottom of the frame, used when commands need
		input such as file names.
modeline	A status line, near the bottom of a window, showing the
		current file being edited, the current mode, the line number,
		etc. (If you split a frame into two windows, you get two
		modelines.)
point		The location in the text where the cursor is. (Technically,
		the cursor is *BETWEEN* two text characters, not on one.
		This is most obvious when you use the bar cursor.)
prefix argument An extra piece of information typed just before a command to
		be executed, which changes how the command works.  Prefix
		arguments typically come in two types: Numeric arguments,
		which specify repeat counts, screen lines to move to, etc.
		are are specified using META plus a number before a command;
		and flag arguments, which are just simple yes/no-type
		indications to do something differently (e.g. put point at
		the beginning of inserted text rather than at the end) and
		are specified using C-u before the command.
recursive edit	Used when you are in the middle of executing a long command
		(e.g. a search and replace), and want to temporarily make
		an edit to some text.  Indicated with brackets around the
		mode name.  It's unlikely you'll use this much, if at all,
		but it's useful to know how to get out if you accidentally
		get into this mode: use ESC ESC.
screen		The totality of everything that can be seen on the display.
		Also used in some expressions: "on/off the screen" means
		currently visible or invisible.  A "screenful" is the amount
		of text in a particular window that can be viewed at one time.
window		Non-overlapping division of a frame, standardly called a
		"pane".  Most often, there is only one window in a frame, and
		then the two terms become essentially synonymous. (Technically,
		however, the window includes the modeline below it but not
		the minibuffer.)
yank		Standardly known as "paste".  Insert text that was previously
		removed and remembered, a process known as "killing", or more
		standardly "cutting".


* BASIC CURSOR CONTROL
----------------------

The first thing that you need to know is how to move around from place
to place in the text.  You already know how to move forward and backward
one screen, but how do you move to a specific place within the text on
the screen?

There are several ways you can do this.  The most basic way is to use
the arrow keys, which we refer to as <Left>, <Right>, <Up>, and <Down>.
Each of these commands moves the cursor one row or column in a
particular direction on the screen.

On a TTY, the arrow keys should, hopefully, work the same, but they
might not, since TTY's are easy to misconfigure.  As mentioned above,
for all cursor-key bindings, there are equivalent alphanumeric ones.  In
this case, the bindings are unfortunately not at all obvious, since they
were chosen mnemonically and not visually.  Here is a table showing the
TTY bindings:
 
			  Previous line, C-p
				  :
				  :
   Backward, C-b .... Current cursor position .... Forward, C-f
				  :
				  :
			    Next line, C-n

>> Move the cursor to the line in the middle of that diagram using <Down>
   or <Up>.  Then type C-l to see the whole diagram centered in the window.
   (Remember, TTY users should substitute the appropriate bindings whenever
   necessary.  In this case, use C-n and C-p.)

Note the mnemonic significance of the TTY bindings: P for previous, N
for next, B for backward and F for forward.  If you're on a TTY, you
really should spend some time now etching these cursor bindings into
your brain.  These cursor positioning commands are the most fundamental
way to move around and you'll be using them ALL the time, so you will be
completely lost without them.

Even if you are on a window system and are not forced to learn these
bindings, you should try to memorize at least these four commands and in
particular their associated words, since variations on them show up in
many different keyboard commands, and knowing what they stand for can be
of tremendous help.


>> Do a few <Down>'s to bring the cursor down to this line.

>> Move into the line with <Right>'s and then up with <Up>'s.
   See what <Up> does when the cursor is in the middle of the line.

The location of the cursor in the text is also called "point".  You will
often see such references to "point" in the documentation, so remember
this term.

Each line of text ends with a Newline character, which serves to separate
it from the following line.  The last line in your file ought to have a
Newline at the end.  XEmacs does not normally require it to have one, but
you can change this -- see the menu entry "Options->Editing->Newline at End
of File...". (More on menu entries later.)

>> Try to <Left> at the beginning of a line.  It should move to
   the end of the previous line.  This is because it moves back
   across the Newline character.

<Right> can move across a Newline just like <Left>.

>> Do a few more <Left>'s, so you get a feel for where the cursor is.
   Then do <Right>'s to return to the end of the line.
   Then do one more <Right> to move to the following line.

When you move past the top or bottom of the window, the text beyond
the edge shifts onto the screen.  This is called "scrolling".  It
enables XEmacs to move the cursor to the specified place in the text
without moving it off the screen.

>> Try to move the cursor off the bottom of the window with <Down>, and
   see what happens.

If moving by characters is too slow, you can move by words.  C-<Right>
(CONTROL + right-arrow key) moves forward a word and C-<Left> moves back a
word.  On TTY's, use M-f instead of C-<Right> and M-b instead of C-<Left>.

>> Type a few C-<Right>'s and C-<Left>'s.

When you are in the middle of a word, C-<Right> moves to the end of the
word.  When you are in whitespace between words, C-<Right> moves to the
end of the following word.  C-<Left> works likewise in the opposite
direction.

>> Type C-<Right> and C-<Left> a few times, interspersed with <Right>'s and
   <Left>'s so that you can observe the action of C-<Right> and C-<Left>
   from various places inside and between words.

Notice the parallel between <Right> and <Left> on the one hand, and
C-<Right> and C-<Left> on the other hand.  Also notice the parallel
between C-f and C-p on the one hand, and M-f and M-p on the other hand.
XEmacs tries fairly hard to maintain parallelism in keyboard commands to
make them easier to remember, and generally adding CONTROL or META to an
operation makes it "more so".  META goes beyond CONTROL, often making
the units of movement less basic in the process -- words vs. characters,
balanced parenthetical expressions vs. words, or sentences vs. lines.

Other important cursor motion commands are <Home> and <End> (beginning
and end of the line), and C-<Home> and C-<End> (beginning and end of the
whole text).  Note again the parallelism just mentioned.

On TTY's, use C-a and C-e for beginning and end of line, and M-< and M->
for beginning and end of text. (If it helps, think of A as the first
letter of the alphabet, and E as standing for "end".) Note that the <
and > chars (Less-than and Greater-than) are above the comma and period
on most keyboards, so you'll have to use the SHIFT key in conjunction
with META.  If you have no META, the order is very important: Type ESC
first, then type < or >.

>> Move the cursor to this line, then try <Home> and <End> a few times.

>> (Read this entire entry before doing anything!) Try C-<Home> now, to
   move to the beginning of the tutorial.  Then use <Next> repeatedly to
   move back here.

>> Try all of these commands now a few times for practice.
   These are the most often used commands.

Here is a summary of simple cursor-moving operations.  Don't worry if you
can't remember everything; you can always move back to this table for
reference.

        KEYSTROKE:      SEQUENCE                                TTY:

        <Prior> (PgUp)  Move backward a screen			M-v
        <Next> (PgDn)   Move forward a screen			C-v

	<Left>		Move backward a character		C-b
	<Right>		Move forward a character		C-f

	C-<Left>	Move backward a word			M-b
	C-<Right>	Move forward a word			M-f

	<Up>		Move to previous line			C-p
	<Down>		Move to next line			C-n

	C-<Up>		Move 6 lines up
	C-<Down>	Move 6 lines down

	<Home>		Move to beginning of line		C-a
	<End>		Move to end of line			C-e

	C-<Home>	Move to beginning of text		M-<
	C-<End>		Move to end of text			M->


* PREFIX ARGUMENTS
------------------

Most XEmacs commands accept a numeric argument; for most commands, this
serves as a repeat-count.  The way you give a command a repeat count is
by holding down the META key while typing the digits.  You really only
need to hold down META for the first digit; for this reason, an
alternative method is to simply hit the ESC key once, then type the
digits.  (This latter method works on TTY's as well.) The numeric
argument is also called a "prefix argument", because you type the
argument before the command it applies to.

For instance, M-8 <Right> moves forward eight characters.
	
>> Try using <Down> or <Up> with a numeric argument, to move the cursor
   to a line near this one with just one command.

Sometimes, commands use the term "prefix argument" to refer not to a
numeric argument, but to just a flag that makes the command do something
different if given. (We haven't encountered any such commands so far.) 
For such commands, the flag is normally given by typing C-u before the
command, but generally you can also specify any numeric argument -- the
actual number makes no difference.


* SCROLLBARS
------------

Unless you are on a TTY, there is probably a rectangular area called a
scroll bar at the right hand side of the XEmacs window.  You can scroll the
text by manipulating the scrollbar with the mouse.

The scrollbar has a button in the middle of it, called a thumb.  The
relative position of this thumb within the rectangle indicates where you
are within the file.  As you scroll up or down with the cursor keys, the
thumb will follow.

>> Try holding down the left button on the thumb and moving the mouse up
   and down.  You'll see that the text scrolls up and down as you move the
   mouse. (NOTE: Some scrollbars, such as the Athena scrollbars under X
   Windows, work differently.  On these, you will have to use the middle
   button, not the left one.)

>> Try clicking the left button in the area above the thumb.  This should
   scroll the text up by a screenful.  Similarly, clicking the button below
   the thumb will scroll down by a screenful. (NOTE: Under Athena, things
   work differently.) Holding the button down will cause the text to
   repeatedly scroll by a screenful.

>> Most scrollbars have arrows at the top and bottom of the rectangle.
   Clicking on these will scroll the text up or down by a line, and holding
   the button down will cause the text to repeatedly scroll by a line.


* USING THE MENU
----------------

Unless you are on a TTY, you will notice a menubar at the top of the
XEmacs frame.  You can use this menubar to access all the most common
XEmacs commands, such as "open a file".  You will find this easier at
first, because you don't need to remember the keystrokes necessary to
access any particular command.  Once you are comfortable with XEmacs, it
will be easy to begin using the keyboard commands because each menu item
with a corresponding keyboard command has the command listed next to it.

Note that there are many items in the menubar that have no exact
keyboard equivalents.  For example, the Buffers menu lists all of the
available buffers in most-recently used order.  You can switch to any
buffer by simply findings its name in the Buffers menu and selecting it.

You can also configure XEmacs so that you can use the META key to access
menu items -- the "accelerator" functionality that is standard under MS
Windows.  One easy way to do this in XEmacs is using the menu item
"Options->Menubars->Alt/Meta Selects Menu Items".

When this feature is on, you can select a menu or menu item using the
combination of META (i.e. Alt) plus the underlined letter of the menu item.
For example, to exit XEmacs, use M-f M-x.  We currently don't turn this on
by default because it interferes with the traditional usage of META in
XEmacs.  However, we may do this in the future: Only commands for which
there are top-level menus are shadowed by accelerator bindings, and for all
those commands, there are equivalents either using cursor keys or on the
menus.

When we mention a menu selection, it will be specified as just shown --
i.e. a string, with an arrow ("->") separating different submenus or items.
In this case, the menu entry just mentioned means "Click the Options menu
on the menubar, then the Menubars submenu, the the entry off of that
labeled "Alt/Meta Selects Menu Items".  In general, XEmacs is highly
customizable, and one of the easiest ways to make such customizations is
through the Options menu.

IMPORTANT: If you want a change on the Options menu to last beyond the
current XEmacs session, use "Options->Save Options to Init File".  This
way, it will be permanent.  Otherwise, all Options changes made in the
current session will be lost.


* WHEN XEMACS IS HUNG OR IN SOME STRANGE MODE
---------------------------------------------

If XEmacs stops responding to your commands, you can stop it safely by
typing C-g.  You can use C-g to stop a command which is taking too
long to execute.

You can also use C-g to discard a numeric argument or the beginning of
a command that you do not want to finish.

>> Type M-100 to make a numeric arg of 100 (remember, this means hold
   down META and type 100, or type ESC 1 0 0), then type C-g.  Now type
   <Right>.  It should move just one character, because you canceled the
   argument with C-g.

If XEmacs is in some strange mode and C-g isn't getting out of it, you
can use the all-purpose escape mechanism: ESC ESC. (On TTY's, you have
to use ESC ESC ESC.  The reasons for this are a bit complicated.)

Hitting ESC ESC will get you out of almost any weird mode, including
selected text, split windows, the minibuffer, recursive edits, "stranded
minibuffer requests", and the like.  If you have many problems at once,
each invocation of ESC ESC will get rid of one, so keep repeating until
everything's fixed.  REMEMBER: ESC ESC does not work if XEmacs is hung
doing some time-consuming operation or running broken code.  Use C-g for
that.


* DISABLED COMMANDS
-------------------

Some XEmacs commands are "disabled" so that beginning users cannot use
them by accident.

If you type one of the disabled commands, XEmacs displays a message
saying what the command was, and asking you whether you want to go
ahead and execute the command.

If you really want to try the command, type <Space> in answer to the
question.  Normally, if you do not want to execute the disabled
command, answer the question with "n".

>> Type `C-x n p' (which is a disabled command),
   then type n to answer the question.


* "WINDOWS", I.E. PANES
-----------------------

XEmacs can have several panes (i.e. non-overlapping divisions of a window
or a TTY screen), each displaying its own text.  For historical reasons,
these panes are called "windows", and what we normally think of as a
window is called a "frame".  XEmacs can also have multiple "frames"; this
is described later.  From now on, we omit the quotes around the XEmacs
terms, and if we need to use "window" in the standard sense, we will say
"window-system window".

At this stage it is better not to go too deeply into the techniques of
using multiple windows.  But you do need to know how to get rid of extra
windows that may appear to display help or output from certain commands.
Most of the time, your cursor will be in the new window; if this is the
case, simply type q.  Alternatively, you can type

	C-x 0	Delete window.

That is, CONTROL-x followed by the digit 0.  This command is unlike the
other commands you have learned in that it consists of two characters.  It
starts with the character CONTROL-x.  There is a whole series of commands
that start with CONTROL-x; many of them have to do with windows, files,
buffers, and related things.  These commands are two, three or four
characters long.

>> Move the cursor to this line and type M-0 C-l.
   (That's a zero, not an Oh.)
>> Type CONTROL-h k CONTROL-f.
   See how this window shrinks, while a new one appears
   to display documentation on the CONTROL-f command.
 
>> Type q and see the documentation listing window disappear.

(Remember that C-l redraws the frame.  If you give a numeric argument to
this command, it means "redraw the frame and put the current line that
many lines from the top of the window."  So M-0 C-l means "redraw the
frame, putting the current line at the top.")


* INSERTING AND DELETING
------------------------

If you want to insert text, just type the text.  Characters which you can
see, such as A, 7, *, etc. are taken by XEmacs as text and inserted
immediately.  Type <Return> (the carriage-return key) to insert a Newline
character.

You can delete the last character you typed by typing <Backspace>.
<Backspace> is a key on the keyboard, which may be labeled simply with a
left arrow sign.

(NOTE: On a few misconfigured TTY's, typing <Backspace> may try to invoke
the help system; the symptom of this is a line like "C-h (Type ? for
further options)" at the bottom of the frame.  If this is the case, type
C-g to get out of this, and try using <Delete> from now on in place of
<Backspace>.)

More generally, <Backspace> deletes the character immediately before the
current cursor position.

>> Do this now--type a few characters, then delete them
   by typing <Backspace> a few times.  Don't worry about this file
   being changed; you will not alter the master tutorial.  This is
   your personal copy of it.

When a line of text gets too big for one line on the window, the line of
text is "continued" onto a second window line.  An arrow at the right
margin that hooks down and to the left (or a backslash ("\") on TTY's)
indicates a line which has been continued.

>> Insert text until you reach the right margin, and keep on inserting.
   You'll see a continuation line appear.

>> Use <Backspace>s to delete the text until the line fits on one window
   line again.  The continuation line goes away.

You can delete a Newline character just like any other character.
Deleting the Newline character between two lines merges them into
one line.  If the resulting combined line is too long to fit in the
window width, it will be displayed with a continuation line.

>> Move the cursor to the beginning of a line and type <Backspace>.  This
   merges that line with the previous line.

>> Type <Return> to reinsert the Newline you deleted.

Remember that most XEmacs commands can be given a repeat count;
this includes text characters.  Repeating a text character inserts
it several times.

>>  Try that now -- type M-8 * to insert ********.

You've now learned the most basic way of typing something in
XEmacs and correcting errors.  You can delete by words or lines
as well.  Here is a summary of the delete operations:

	<Backspace>   delete the character just before the cursor
        <Delete>      delete the next character after the cursor
	C-d   	      same as <Delete> but works on TTY's

	M-<Backspace> cut ("kill") the word immediately before the cursor
	M-<Delete>    cut ("kill") the next word after the cursor
        M-d	      same as M-<Delete> but works on TTY's

	C-k	      cut ("kill") from the cursor position to end of line
	M-k	      cut ("kill") to the end of the current sentence

Notice again the parallelism with no modifier vs. CONTROL vs. META that
was mentioned earlier -- although the parallels are not perfect.

(In the violent old days when Emacs first began, removing text that
could later be re-inserted was called "killing", and re-inserting was
called "yanking" -- evidently the designers of Emacs must have been
thinking of role-playing games, where killed characters could be easily
resurrected with the wave [yank?] of a magic wand.  In the more genteel
[and realistic] times we live in, the preferred terms are "cut" and
"paste".)

You can also kill any part of the buffer with one uniform method.  Under
window systems, the preferred method is to move to one end of that part,
hold the SHIFT key down, and use the cursor keys to move to the other
end.  Then release the SHIFT key and type C-w.  That kills all the text
between the two positions.

An alternative method, which also works on TTY's, is to move to one end of
the text, and type C-@ or C-<Space> (either one).
Move to the other end and type C-w.

>> Move the cursor to the A at the start of the previous paragraph.
>> Hold the SHIFT key down.
>> Move the cursor to the n in "end", on the third line of the
   paragraph.
>> Release the SHIFT key and type C-w.  This will kill the text starting
   from the A, and ending just before the n.

Now try it the other way.

>> Type C-/ to undo the killing, or C-_ or C-x u on TTY's.
>> Move the cursor to the same A again.
>> Type C-<Space>.  XEmacs should display a message "Mark set"
   at the bottom of the frame.
>> Move the cursor to the n in "end", on the third line of the
   paragraph.
>> Type C-w.  You will get the same result as previously.

The difference between "killing" and "deleting" is that "killed" text
can be reinserted, whereas "deleted" things cannot be reinserted.
Reinsertion of killed text is called "yanking".  Generally, the
commands that can remove a lot of text kill the text (they set up so
that you can yank the text), while the commands that remove just one
character, or just blank lines and spaces, do deletion (so you cannot
yank that text).

Normally, on a window system "killing" text stores it internally but
also puts it on the clipboard, just like Cut in a word processor, and
"yanking" takes text from the clipboard if available, just like Paste.
(This connection to the clipboard can be turned off from the Options
menu.) There are also menu items, "Edit->Cut" and "Edit->Paste", that
always connect with the clipboard, and equivalent Cut and Paste keys on
Sun keyboards.

>> Move the cursor to the  beginning of a line which is not empty.
   Then type C-k to kill the text on that line.
>> Type C-k a second time.  You'll see that it kills the Newline
   which follows that line.

Note that a single C-k kills the contents of the line, and a second
C-k kills the line itself, and makes all the other lines move up.  C-k
treats a numeric argument specially: it kills that many lines AND
their contents.  This is not mere repetition.  M-2 C-k kills two
lines and their newlines; typing C-k twice would not do that.

Bringing back killed text is called "yanking".  (Think of it as
yanking back, or pulling back, some text that was taken away.)  You
can yank the killed text either at the same place where it was killed,
or at some other place in the buffer, or even in a different file.
You can yank the text several times, which makes multiple copies of
it.

The command for yanking is C-y.  It reinserts the last killed text,
after the current cursor position.

>> Try it; type C-y to yank the text back.

If you do several C-k's in a row, all of the killed text is saved
together, so that one C-y will yank all of the lines at once.

>> Do this now, type C-k several times.

Now to retrieve that killed text:

>> Type C-y.  Then move the cursor down a few lines and type C-y
   again.  You now see how to copy some text.

What do you do if you have some text you want to yank back, and then
you kill something else?  C-y would yank the more recent kill.  But
the previous text is not lost.  You can get back to it using the M-y
command.  After you have done C-y to get the most recent kill, typing
M-y replaces that yanked text with the previous kill.  Typing M-y
again and again brings in earlier and earlier kills.  When you have
reached the text you are looking for, you do not have to do anything to
keep it.  Just go on with your editing, leaving the yanked text where
it is.

If you M-y enough times, you come back to the starting point (the most
recent kill).

>> Kill a line, move around, kill another line.
   Then do C-y to get back the second killed line.
   Then do M-y and it will be replaced by the first killed line.
   Do more M-y's and see what you get.  Keep doing them until
   the second kill line comes back, and then a few more.
   If you like, you can try giving M-y positive and negative
   arguments.


* UNDO
------

If you make a change to the text, and then decide that it was a mistake,
you can undo the change with the undo command, C-/. (On TTY's, use C-_,
i.e. CONTROL + underscore, which is normally above the minus sign;
i.e. you will have to hold the SHIFT key down, as in CONTROL + SHIFT +
minus.  If that doesn't work, you can fall back to C-x u; but that has
the unfortunate property that it's difficult to execute several times in
a row.)

Normally, C-/ undoes the changes made by one command; if you repeat
the C-/ several times in a row, each repetition undoes one
additional command.

But there are two exceptions: commands that do not change the text do
not count (this includes cursor motion commands and scrolling
command), and self-inserting characters are usually handled in groups
of up to 20.  (This is to reduce the number of C-/'s you have to
type to undo insertion of text.)

>> Kill this line with C-k, then type C-/ and it should reappear.

A numeric argument to C-/ acts as a repeat count.

If you change your mind and want to redo changes that you've undone,
issue any command other than Undo (usually people move the cursor), and
then start undoing again.  This will undo your Undo changes; keep
hitting Undo, and you will eventually undo all the Undo's, and start
undoing your original changes.  Essentially, XEmacs treats each Undo as
a further change, and records them for undoing just like regular
commands; but as long as you keeping issuing Undo commands directly
after previous ones, XEmacs remembers where you are in the Undo history
so it can keep undoing.  Once you issue another command, XEmacs
"forgets" and resets its internal pointer to the end of the Undo
history.  This may seem confusing, so try it out:

>> Type a line of text above this one.
>> Move to the end of the line you just typed, and hit <Backspace>
   until you've deleted all characters.
>> Type C-/ a number of times to undo some of your deletions.
>> Move the cursor left.
>> Start typing C-/ again, and it will redo your deletions until there's
   no text left, then it will start undoing the original deletions.
   When all the text appears again, further C-/'s will undo the text you
   originally typed, in groups of up to 20 (see above).

As you just saw, you can undo deletion of text just as you can undo
killing of text.  The distinction between killing something and deleting
it affects whether you can yank it with C-y; it makes no difference for
undo.


* USING THE MOUSE
-----------------

On window systems, XEmacs is fully integrated with the mouse.  You can
position the text cursor by clicking the left button at the desired
location, and you can select text by dragging the left mouse button
across the text you want to select. (Or alternatively, click the left
mouse button at one end of the text, then move to the other end and use
Shift-click to select the text.)

The middle mouse button is commonly used to choose items that are
visible on the screen.  For example, if you enter Info (the on-line
XEmacs documentation) using C-h i or the Help menu, you can follow a
highlighted link by clicking the middle mouse button on it.  Similarly,
if you are typing a file name in (e.g. when prompted by "Find File") and
you hit <Tab> to show the possible completions, you can click the middle
mouse button on one of the completions to select it.  If you have a
two-button mouse, such as some MS Windows systems, you can click both
buttons simultaneously to simulate the middle button.

The right mouse button brings up a popup menu, called a "context menu"
because the contents vary depending on what context you're in, such as
the mode of the window you click in or the text under the mouse.  The
menu usually contains the commands most relevant to where you clicked,
so they're easier to access.

>> Press the right mouse button now.

Under X Windows, you may have to hold the button down in order to keep
the menu up.


* FILES
-------

In order to make the text you edit permanent, you must put it in a
file.  Otherwise, it will go away when your invocation of XEmacs goes
away.  In order to put your text in a file, you must "find" the file
before you enter the text.  (This is also called "visiting" the file.)

Finding a file means that you see the contents of the file within
XEmacs.  In many ways, it is as if you were editing the file itself.
However, the changes you make using XEmacs do not become permanent
until you "save" the file.  This is so you can avoid leaving a
half-changed file on the system when you do not want to.  Even when
you save, XEmacs leaves the original file under a changed name in case
you later decide that your changes were a mistake.

If you look near the bottom of the frame you will see a line that begins
and ends with dashes, and contains the string "XEmacs: TUTORIAL" or
something like that.  This part of the frame normally shows the name of
the file that you are visiting.  Right now, you are visiting a file called
"TUTORIAL" which is your personal scratch copy of the XEmacs tutorial.
When you find a file with XEmacs, that file's name will appear in that
precise spot.

One special thing about the command for finding a file is that you
have to say what file name you want.  We say the command "reads an
argument from the terminal" (in this case, the argument is the name of
the file).  After you type the command

	C-x C-f   Find a file

XEmacs asks you to type the file name.  The file name you type appears
on the bottom line of the frame.  The bottom line is called the
minibuffer when it is used for this sort of input.  You can use
ordinary XEmacs editing commands to edit the file name.

While you are entering the file name (or any minibuffer input),
you can cancel the command with C-g.

>> Type C-x C-f, then type C-g.  This cancels the minibuffer,
   and also cancels the C-x C-f command that was using the
   minibuffer.  So you do not find any file.

When you have finished entering the file name, type <Return> to
terminate it.  Then C-x C-f command goes to work, and finds the file
you chose.  The minibuffer disappears when the C-x C-f command is
finished.

In a little while the file contents appear on the screen, and you can
edit the contents.  When you wish to make your changes permanent,
type the command

	C-x C-s   Save the file

This copies the text within XEmacs into the file.  The first time you
do this, XEmacs renames the original file to a new name so that it is
not lost.  The new name is made by adding "~" to the end of the
original file's name.

When saving is finished, XEmacs displays the name of the file written.
You should save fairly often, so that you will not lose very much
work if the system should crash.

>> Type C-x C-s, saving your copy of the tutorial.
   This should show "Wrote ...TUTORIAL" at the bottom of the frame.

NOTE: On some older TTY connections, typing C-s will freeze the screen
and you will see no further output from XEmacs.  This indicates that an
operating system "feature" called "flow control" is intercepting the C-s
and not letting it get through to XEmacs.  To unfreeze the screen, type
C-q.  Then see the section "Spontaneous Entry to Incremental Search" in
the XEmacs manual for advice on dealing with this "feature".

You can find an existing file, to view it or edit it.  You can also
find a file which does not already exist.  This is the way to create a
file with XEmacs: find the file, which will start out empty, and then
begin inserting the text for the file.  When you ask to "save" the
file, XEmacs will really create the file with the text that you have
inserted.  From then on, you can consider yourself to be editing an
already existing file.


* BUFFERS
---------

If you find a second file with C-x C-f, the first file remains
inside XEmacs.  You can switch back to it by finding it again with
C-x C-f.  This way you can get quite a number of files inside XEmacs.

>> Create a file named "foo" by typing  C-x C-f foo <Return>.
   Then insert some text, edit it, and save "foo" by typing  C-x C-s.
   Finally, type C-x C-f TUTORIAL <Return>
   to come back to the tutorial.

XEmacs stores each file's text inside an object called a "buffer".
Finding a file makes a new buffer inside XEmacs.  To see a list of the
buffers that currently exist in your XEmacs job, type

	C-x C-b   List buffers

>> Try C-x C-b now.

See how each buffer has a name, and it may also have a file name
for the file whose contents it holds.  Some buffers do not correspond
to files.  For example, the buffer named "*Buffer List*" does
not have any file.  It is the buffer which contains the buffer
list that was made by C-x C-b.  ANY text you see in an XEmacs window
is always part of some buffer.

>> Type ESC ESC to get rid of the buffer list. (Remember, three ESC's
   under TTY's.)

If you make changes to the text of one file, then find another file,
this does not save the first file.  Its changes remain inside XEmacs,
in that file's buffer.  The creation or editing of the second file's
buffer has no effect on the first file's buffer.  This is very useful,
but it also means that you need a convenient way to save the first
file's buffer.  It would be a nuisance to have to switch back to
it with C-x C-f in order to save it with C-x C-s.  So we have

	C-x s     Save some buffers

C-x s asks you about each buffer which contains changes that you have
not saved.  It asks you, for each such buffer, whether to save the
buffer.

>> Insert a line of text, then type C-x s.
   It should ask you whether to save the buffer named TUTORIAL.
   Answer yes to the question by typing "y".


* EXTENDING THE COMMAND SET
---------------------------

There are many, many more XEmacs commands than could possibly be put
on all the control and meta characters.  XEmacs gets around this with
the X (eXtend) command.  This comes in two flavors:

	C-x	Character eXtend.  Followed by one character.
	M-x	Named command eXtend.  Followed by a long name.

These are commands that are generally useful but used less than the
commands you have already learned about.  You have already seen two of
them: the file commands C-x C-f to Find and C-x C-s to Save.  Another
example is the command to end the XEmacs session--this is the command
C-x C-c.  (Do not worry about losing changes you have made; C-x C-c
offers to save each changed file before it kills the XEmacs.)

If you have installed the sample init.el file (we highly recommend this,
once you've gotten some familiarity with XEmacs; see "Help->Samples->View
Sample init.el"), you will find that C-x C-c does not exit XEmacs, but
instead outputs a message.  This is intentional, since C-x C-c is easy to
hit accidentally.  Instead, use the "File->Exit XEmacs" menu item to exit.

If you are on a TTY, and you want to exit temporarily to execute a shell
command, you should use C-z instead of C-x C-c.  Under TTY's, C-z
"suspends" XEmacs; that is, it returns to the shell but does not destroy
the XEmacs.  In the most common shells, you can resume XEmacs with the
`fg' command or with `%xemacs'. (On systems which do not implement
suspending, C-z creates a subshell running under XEmacs to give you the
chance to run other programs and return to XEmacs afterward; it does not
truly "exit" from XEmacs.  In this case, the shell command `exit' is the
usual way to get back to XEmacs from the subshell.)

There are many C-x commands.  Here is a list of the ones you have learned:

	C-x C-f		Find file.
	C-x C-s		Save file.
	C-x C-b		List buffers.
	C-x C-c		Quit XEmacs.
	C-x 0		Delete the current window.
	C-x u		Undo (TTY version).

Named eXtended commands are commands which are used even less
frequently, or commands which are used only in certain modes.  An
example is the command replace-string, which globally replaces one
string with another.  When you type M-x, XEmacs prompts you at the
bottom of the frame with M-x and you should type the name of the
command; in this case, "replace-string".  Just type "repl s<Tab>" and
XEmacs will complete the name.  (<Tab> is the Tab key, usually found
above the CapsLock or Shift key near the left edge of the keyboard.)
End the command name with <Return>.

The replace-string command requires two arguments--the string to be
replaced, and the string to replace it with.  You must end each
argument with <Return>.

>> Move the cursor to the blank line two lines below this one.
   Then type M-x repl s<Return>changed<Return>altered<Return>.

   Notice how this line has changed: you've replaced
   the word c-h-a-n-g-e-d with "altered" wherever it occurred,
   after the initial position of the cursor.


* AUTO SAVE
-----------

When you have made changes in a file, but you have not saved them yet,
they could be lost if your computer crashes.  To protect you from this,
XEmacs periodically writes an "auto save" file for each file that you
are editing.  The auto save file name has a # at the beginning and the
end; for example, if your file is named "hello.c", its auto save file's
name is usually "#hello.c#".  When you save the file in the normal way,
XEmacs deletes its auto save file.

If the computer crashes, you can recover your auto-saved editing by
finding the file normally (the file you were editing, not the auto
save file) and then typing M-x recover file<Return>.  When it asks for
confirmation, type yes<Return> to go ahead and recover the auto-save
data.


* ECHO AREA
-----------

If XEmacs sees that you are typing multicharacter commands slowly, it
shows them to you at the bottom of the frame in an area called the
"echo area".  The echo area contains the bottom line of the frame.


* MODELINE
----------

The line immediately above the echo area it is called the "modeline".
The mode line says something like this:

--**-XEmacs: TUTORIAL          (Fundamental)--L670--58%----------------

This line gives useful information about the status of XEmacs and
the text you are editing.

You already know what the filename means--it is the file you have
found.  -NN%-- indicates your current position in the text; it means
that NN percent of the text is above the top of the window.  If the
top of the file is on the screen, it will say --Top-- instead of
--00%--.  If the bottom of the text is on the screen, it will say
--Bot--.  If you are looking at text so small that all of it fits on
the screen, the mode line says --All--.

The L and digits indicate position in another way: they give the
current line number of point.

The stars near the front mean that you have made changes to the text.
Right after you visit or save a file, that part of the mode line shows
no stars, just dashes.

The part of the mode line inside the parentheses is to tell you what
editing modes you are in.  The default mode is Fundamental which is
what you are using now.  It is an example of a "major mode".  

XEmacs has many different major modes.  Some of them are meant for
editing different languages and/or kinds of text, such as Lisp mode,
Text mode, etc.  At any time one and only one major mode is active,
and its name can always be found in the mode line just where
"Fundamental" is now.

Each major mode makes a few commands behave differently.  For example,
there are commands for creating comments in a program, and since each
programming language has a different idea of what a comment should
look like, each major mode has to insert comments differently.  Each
major mode is the name of an extended command, which is how you can
switch to that mode.  For example, M-x fundamental-mode is a command to
switch to Fundamental mode.

If you are going to be editing English text, such as this file, you
should probably use Text Mode.
>> Type M-x text-mode<Return>.

Don't worry, none of the XEmacs commands you have learned changes in
any great way.  But you can observe that C-<Right> and C-<Left> now treat
apostrophes as part of words.  Previously, in Fundamental mode,
C-<Right> and C-<Left> treated apostrophes as word-separators.

Major modes usually make subtle changes like that one: most commands
do "the same job" in each major mode, but they work a little bit
differently.

To view documentation on your current major mode, type C-h m.

>> Use M-4 C-l to bring this line near the top of the window.
>> Type C-h m, to see how Text mode differs from Fundamental mode.
>> Type q to remove the documentation from the screen.

Major modes are called major because there are also minor modes.
Minor modes are not alternatives to the major modes, just minor
modifications of them.  Each minor mode can be turned on or off by
itself, independent of all other minor modes, and independent of your
major mode.  So you can use no minor modes, or one minor mode, or any
combination of several minor modes.

One minor mode which is very useful, especially for editing English
text, is Auto Fill mode.  When this mode is on, XEmacs breaks the line
in between words automatically whenever you insert text and make a
line that is too wide.

You can turn Auto Fill mode on by doing M-x auto-fill-mode<Return>.
When the mode is on, you can turn it off again by doing M-x
auto-fill-mode<Return>.  If the mode is off, this command turns it on,
and if the mode is on, this command turns it off.  We say that the
command "toggles the mode".

>> Type M-x auto-fill-mode<Return> now.  Then insert a line of "asdf "
   over again until you see it divide into two lines.  You must put in
   spaces between them because Auto Fill breaks lines only at spaces.

The margin is usually set at 70 characters, but you can change it
with the C-x f command.  You should give the margin setting you want
as a numeric argument.

>> Type C-x f with an argument of 20.  (M-20 C-x f).
   Then type in some text and see XEmacs fill lines of 20
   characters with it.  Then set the margin back to 70 using
   C-x f again.

If you make changes in the middle of a paragraph, Auto Fill mode
does not re-fill it for you.
To re-fill the paragraph, type M-q (META-q) with the cursor inside
that paragraph.

>> Move the cursor into the previous paragraph and type M-q.


* SEARCHING
-----------

XEmacs can do searches for strings (these are groups of contiguous
characters or words) either forward through the text or backward
through it.  Searching for a string is a cursor motion command;
it moves the cursor to the next place where that string appears.

The XEmacs search command is different from the search commands
of most editors, in that it is "incremental".  This means that the
search happens while you type in the string to search for.

The command to initiate a search is C-s for forward search, and C-r
for reverse search.  BUT WAIT!  Don't try them now.

When you type C-s you'll notice that the string "I-search" appears as
a prompt in the echo area.  This tells you that XEmacs is in what is
called an incremental search waiting for you to type the thing that
you want to search for.  <Return> terminates a search.

>> Now type C-s to start a search.  SLOWLY, one letter at a time,
   type the word 'cursor', pausing after you type each
   character to notice what happens to the cursor.
   Now you have searched for "cursor", once.
>> Type C-s again, to search for the next occurrence of "cursor".
>> Now type <Backspace> four times and see how the cursor moves.
>> Type <Return> to terminate the search.

Did you see what happened?  XEmacs, in an incremental search, tries to
go to the occurrence of the string that you've typed out so far,
highlighting it for your convenience.  To go to the next occurrence of
'cursor' just type C-s again.  If no such occurrence exists XEmacs
beeps and tells you the search is currently "failing", C-g would also
terminate the search.

NOTE: On some older TTY connections, typing C-s will freeze the screen
and you will see no further output from XEmacs.  This indicates that an
operating system "feature" called "flow control" is intercepting the C-s
and not letting it get through to XEmacs.  To unfreeze the screen, type
C-q.  Then see the section "Spontaneous Entry to Incremental Search" in
the XEmacs manual for advice on dealing with this "feature".

If you are in the middle of an incremental search and type <Backspace>,
you'll notice that the last character in the search string is erased
and the search backs up to the last place of the search.  For
instance, suppose you have typed "c", to search for the first
occurrence of "c".  Now if you type "u", the cursor will move
to the first occurrence of "cu".  Now type <Backspace>.  This erases
the "u" from the search string, and the cursor moves back to
the first occurrence of "c".

If you are in the middle of a search and type a control or meta
character (with a few exceptions--characters that are special in
a search, such as C-s and C-r), the search is terminated.

The C-s starts a search that looks for any occurrence of the search
string AFTER the current cursor position.  If you want to search for
something earlier in the text, type C-r instead.  Everything that we
have said about C-s also applies to C-r, except that the direction of
the search is reversed.


* MULTIPLE "WINDOWS" (I.E. PANES)
---------------------------------

One of the nice features of XEmacs is that you can split the current
frame (i.e. window-system window) into more than one pane, or "window"
in XEmacs parlance.

>> Move the cursor to this line and type M-0 C-l (that's zero, not Oh,
   and CONTROL-L, not CONTROL-1).

>> Now type C-x 2 which splits the frame into two windows.
   Both windows display this tutorial.  The cursor stays in the top window.

>> Type M-<Next> to scroll the bottom window.
   (C-M-v on TTY's.  If you do not have a real META key, type ESC C-v.)

>> Type C-<Tab> to move the cursor to the bottom window. (Use C-x o -- "o"
   for "other" -- on TTY's.)

>> Use <Next> and <Prior> in the bottom window to scroll it.
   Keep reading these directions in the top window.

>> Type C-<Tab> again to move the cursor back to the top window.
   The cursor in the top window is just where it was before.

You can keep using C-<Tab> to switch between the windows.  Each
window has its own cursor position, but only one window actually
shows the cursor.  All the ordinary editing commands apply to the
window that the cursor is in.  We call this the "selected window".

If you have more than two windows, C-<Tab> cycles between them, and
C-Sh-<Tab> (i.e. CONTROL-SHIFT-TAB) in the opposite direction. (There is
no TTY equivalent for C-Sh-<Tab>.)

The commands M-<Prior> and M-<Next> are very useful when you are editing
text in one window and using the other window just for reference.  You
can keep the cursor always in the window where you are editing, and
scroll forward or back through the other window with these commands.

On TTY's, use C-M-v in place of M-<Next>, and there's no equivalent of
M-<Prior>.  C-M-v is an example of a CONTROL-META character.  If you
have a real META key, you can type C-M-v by holding down both CONTROL
and META while typing v.  It does not matter whether CONTROL or META
"comes first," because both of these keys act by modifying the
characters you type.  If you do not have a real META key, and you use
ESC instead, the order does matter: you must type ESC followed by
CONTROL-v, because CONTROL-ESC v will not work.  This is because ESC is
a character in its own right, not a modifier key.

>> Type C-x 1 (in the top window) to get rid of the bottom window.

(If you had typed C-x 1 in the bottom window, that would get rid
of the top one.  Think of this command as "Keep just one
window--the window I am already in.")

You do not have to display the same buffer in both windows.  If you
use C-x C-f to find a file in one window, the other window does not
change.  You can find a file in each window independently.

Here is another way to use two windows to display two different
things:

>> Type C-x 4 f followed by the name of one of your files.
   End with <Return>.  See the specified file appear in the bottom
   window.  The cursor goes there, too.

>> Type C-<Tab> to go back to the top window, and C-x 1 to delete
   the bottom window.


* MULTIPLE "FRAMES" (I.E. WINDOW-SYSTEM WINDOWS)
------------------------------------------------

On window systems, you can also create multiple "frames", or
window-system windows.  These exist independently of each other at the
top level, just like separate programs. (There is no support for the MS
Windows feature called MDI, or Multiple Document Interface, where
multiple overlapping child windows exist inside of a single top-level
window.)

The commands for frames are similar to those for windows, but begin with
"C-x 5".

>> Type C-x 5 2 to create a new frame.

>> Move the mouse into it, and click. (On X Windows, you may not need
   to click; this depends on the window manager.)

>> Scroll up or down.  Note that, just like for XEmacs windows, two frames
   can be showing the same buffer but in different positions.

>> Type C-x 2.  Note that each frame can have separate windows,
   independently of other frames.

>> Type C-x 5 o (or Alt-Tab under MS Windows) to go back to the first frame.
   (That's a small Oh, for "other".)

>> Type C-x 5 0 to kill the old frame. (That's a zero.)

>> Note that we're still here!  XEmacs will not exit until all frames
   are deleted, no matter what order they were created in.

>> Type C-x 1 to get back to one window.

You can also use C-x 5 f to open a file in a new frame, just like C-x 4
f opens a file in a new window in the same frame.


* RECURSIVE EDITING LEVELS
--------------------------

Sometimes you will get into what is called a "recursive editing
level".  This is indicated by square brackets in the mode line,
surrounding the parentheses around the major mode name.  For
example, you might see [(Fundamental)] instead of (Fundamental).

To get out of the recursive editing level, use the all-purpose escape
mechanism mentioned earlier: ESC ESC. (Remember, it's ESC ESC ESC on
TTY's.)  You can also use it for eliminating extra windows, canceling a
selection, and getting out of the minibuffer.

>> Type M-x to get into a minibuffer; then type ESC ESC to get out.

You cannot use C-g to get out of a recursive editing level.  This is
because C-g is used for canceling commands and arguments WITHIN the
recursive editing level.


* GETTING MORE HELP
-------------------

In this tutorial we have tried to supply just enough information to
get you started using XEmacs.  There is so much available in XEmacs that
it would be impossible to explain it all here.  However, you may want
to learn more about XEmacs since it has many other useful features.
XEmacs provides commands for reading documentation about XEmacs
commands.  These "help" commands all start with the character
CONTROL-h, which is called "the Help character".

To use the Help features, type the C-h character, and then a
character saying what kind of help you want.  If you are REALLY lost,
type C-h ? ? and XEmacs will tell you what kinds of help it can give.
If you have typed C-h and decide you do not want any help, just
type C-g to cancel it.

(Note for TTY users: Some sites change the meaning of the character C-h.
They really should not do this as a blanket measure for all users, so you
have grounds to complain to the system administrator.  Meanwhile, if C-h
does not display a message about help at the bottom of the frame, try
typing the F1 key or M-? instead.)

The most basic HELP feature is C-h c.  Type C-h, the character c, and
a command character or sequence; then XEmacs displays a very brief
description of the command.

>> Type C-h c <Up>.
  The message should be something like

	up runs the command previous-line

This tells you the "name of the function".  Function names are used
mainly for customizing and extending XEmacs.  But since function names
are chosen to indicate what the command does, they can serve also as
very brief documentation--sufficient to remind you of commands you
have already learned.

Multi-character commands such as C-x C-s and <ESC>v are also allowed
after C-h c.

To get more information about a command, use C-h k instead of C-h c.

>> Type C-h k <Up>.

This displays the documentation of the function, as well as its
name, in an XEmacs window.  When you are finished reading the
output, type q to get rid of the help text.

Here are some other useful C-h options:

   C-h f	Describe a function.  You type in the name of the
		function.

>> Try typing C-h f previous-line<Return>.
   This displays all the information XEmacs has about the
   function which implements the <Up> command.

A similar command C-h v displays the documentation of variables whose
values you can set to customize XEmacs behavior.  You need to type in
the name of the variable when XEmacs prompts for it.

   C-h a	Hyper Apropos.  Type in a keyword and XEmacs will list
		all the functions and variables whose names contain
		that keyword.  For commands that can be invoked with
		META-x, an asterisk will be displayed to the left.

>> Type C-h a newline<Return>.

This displays a list of all functions and variables with "newline" in
their names.  Press <Return> or click the middle mouse button to find
out more about a function or variable.  Type `q' to exit hyper-apropos.

   C-h i	Read On-line Manuals (a.k.a. Info).  This command puts
                you into a special buffer called `*info*' where you can
                read on-line manuals for the XEmacs packages installed
                on your system.  Type m xemacs <Return> to read the
                XEmacs manual.  If you have never before used Info, type
                ? and XEmacs will take you on a guided tour of Info mode
                facilities.  Once you are through with this tutorial,
                you should consult the XEmacs Info manual as your
                primary documentation.

* CONCLUSION
------------

Remember, to exit XEmacs permanently use the menu item "File->Exit XEmacs",
or type C-x C-c.  On TTY's, to temporarily exit to a shell, so that you can
come back in, use C-z.

This tutorial is meant to be understandable to all new users, so if you
found something unclear, don't sit and blame yourself - complain!


COPYRIGHTS, COPYING, ORIGINS
----------------------------

Copyright (c) 1985, 1996, 2012 Free Software Foundation.
Copyright (c) 2001 Ben Wing.
This tutorial is synched with FSF 21.0.106.

This tutorial descends from a long line of Emacs tutorials starting with
the one written by Stuart Cracraft for the original Emacs.  Ben Wing
updated the tutorial for X Windows.  Martin Buchholz and Hrvoje Niksic
added more corrections for XEmacs.  Ben Wing later synched up to FSF
21.0.105 and rehashed many sections to match the current XEmacs norms.

This version of the tutorial, like XEmacs, is copyrighted, and
comes with permission to distribute copies on certain conditions:

   Permission is granted to anyone to make or distribute verbatim copies
   of this document as received, in any medium, provided that the
   copyright notice and permission notice are preserved,
   and that the distributor grants the recipient permission
   for further redistribution as permitted by this notice.

   Permission is granted to distribute modified versions
   of this document, or of portions of it,
   under the above conditions, provided also that they
   carry prominent notices stating who last altered them.

The conditions for copying XEmacs itself are more complex, but in the
same spirit.  Please read the file COPYING and then do give copies of
XEmacs to your friends.  Help stamp out software obstructionism
("ownership") by using, writing, and sharing free software!