/[climacs]/climacs/Doc/climacs-user.texi
ViewVC logotype

Contents of /climacs/Doc/climacs-user.texi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations)
Mon Sep 12 23:35:55 2005 UTC (8 years, 7 months ago) by rstrandh
Branch: MAIN
Changes since 1.2: +41 -0 lines
File MIME type: application/x-texinfo
Keyboard macros
1 \input texinfo @c -*-texinfo-*-
2 @c %**start of header
3 @setfilename climacs-user
4 @settitle Climacs User Manual
5 @c %**end of header
6
7 @copying
8 The Climacs User manual
9
10 Copyright @copyright{} 2005 Robert Strandh.
11
12 @end copying
13
14 @titlepage
15 @title Climacs User Manual
16 @sp 2
17 @author Robert Strandh
18
19 @page
20 @vskip 0pt plus 1filll
21 @insertcopying
22
23 @end titlepage
24
25 @contents
26
27 @macro climacs{}
28 Climacs
29 @end macro
30
31 @macro cl{}
32 Common Lisp
33 @end macro
34
35 @node Top
36 @top
37
38 @menu
39 * Introduction::
40 * Conventions::
41 * Concepts::
42 * Basic editing commands::
43 * Different editing modes::
44 * Kill ring::
45 * Advanced editing commands::
46 * Key Index::
47 * Concept Index::
48 @end menu
49
50
51 @node Introduction
52 @chapter Introduction
53
54 @climacs{} is a text editor in the Emacs family. However, @climacs{}
55 differs from Emacs in various ways.
56
57 For one thing, @climacs{} is written in Common Lisp rather than Emacs
58 Lisp. Common Lisp is a much more complete language than Emacs Lisp
59 with essential features such as packages, classes, etc.
60
61 Moreover, @climacs{} uses the Common-Lisp Interface Manager (CLIM) as its
62 substrate for managing everything that has to do with user
63 interaction, including event handling, text rendering, and
64 multi-windowing (called panes in CLIM terminology).
65
66 Also, since @climacs{} uses CLIM, there is no need for @climacs{} itself to
67 serve as the basis for other applications such as news readers, mail
68 readers, directory editors, web browsers, etc. the way it is done with
69 Emacs. Instead, such applications are better written as stand-alone
70 CLIM applications that can then communicate with @climacs{} using CLIM
71 and Common Lisp as the common substrate.
72
73 The main purpose of @climacs{} is not to replace Emacs. Instead, it is
74 primarily intended as a text editor for Common Lisp developers.
75 Notice that this is not the same as a text editor for Common Lisp
76 @emph{development}, since Common Lisp developers might need other
77 features such as editing HTML or spell checking, etc., not directly
78 related to Common Lisp development.
79
80 @node Conventions
81 @chapter Conventions
82
83 Many @climacs{} commands are invoked by typing a sequence of
84 keystrokes. A complete sequence of keystrokes invokes a
85 @climacs{} @emph{command} which has a @emph{name}. Sometimes it is
86 useful to know that name, even though the command is usually invoked
87 by typing the key sequence. For that reason, in this manual we often
88 give the corresponding command name together with the key sequence to
89 invoke it.
90
91 @node Concepts
92 @chapter Concepts
93
94 In order to use @climacs{} effectively, you need to know some concepts
95 that are used by it, and referred to in this manual.
96
97 @menu
98 * Buffer::
99 * Window and pane::
100 * Mark and point::
101 * Key sequence::
102 @end menu
103
104 @node Buffer
105 @section Buffer
106
107 A @climacs{} @emph{buffer}
108 @cindex buffer
109 is an editable sequence of arbitrary @cl{} objects. If the buffer
110 contains text, most of those objects will be @emph{Unicode
111 characters}.
112 @cindex character
113 @cindex Unicode
114
115 @node Window and pane
116 @section Window and pane
117
118 A @climacs{} buffer may or may not be on display. If it is, it is on
119 display in a @emph{pane}
120 @cindex pane
121 or a @emph{window}.
122 @cindex window
123
124 @node Mark and point
125 @section Mark and point
126
127 Positions into a @climacs{} buffer are determined by @emph{marks}
128 @cindex mark
129 which can be either @emph{left sticky},
130 @cindex left sticky
131 meaning that if an object is inserted where such a mark is, it ends up
132 @emph{to the left} of the newly inserted object, or @emph{right
133 sticky},
134 @cindex right sticky
135 meaning that if an object is inserted where such a mark is, it ends up
136 @emph{to the right} of the newly inserted object.
137
138 A distinguished mark that is associated with each @climacs{} pane is
139 called the @emph{point}.
140 @cindex point
141 There is a point associated with each window. Each of several windows
142 that display the same buffer has its own point. In addition, a buffer
143 that is not on display has a point that is taken over by the first
144 window that displays the buffer. Points are right-sticky marks, even
145 when a language such as Arabic is edited, simply because by
146 convention, the @climacs{} buffer is considered as being organized
147 from left to right. It is question of @emph{rendering} as to whether
148 the objects in the buffer are actually displayed from left to right,
149 from right to left, or in any other appropriate order.
150
151 @node Key sequence
152 @section Key sequence
153
154 Typically, @climacs{} is operated by @emph{key sequences}
155 @cindex key sequence
156 issued by the user. A key sequence is a sequence of key strokes,
157 where a key stroke can be a simple character such as @kbd{f} or
158 @kbd{&}, or a key with one or more @emph{modifiers}
159 @cindex modifier
160 such as @key{Control}, @key{Shift}, @key{Meta}, etc.
161
162 Some key sequences result in the execution of a @climacs{}
163 @emph{command}.
164 @cindex command
165 Such a key sequence is called a @emph{complete key sequence}
166 @cindex complete key sequence or an @emph{order}.
167 @cindex order
168
169 @node Basic editing commands
170 @chapter Basic editing commands
171
172 The basic editing commands of @climacs{} are identical or at least
173 similar to the corresponding Emacs commands. This is deliberate. We
174 do not believe in introducing gratuitous differences where such
175 differences have little or no importance. A typical Emacs user
176 should therefore feel quite comfortable with the basic editing
177 commands of @climacs{}.
178
179 @menu
180 * Entering and exiting @climacs{}::
181 * Numeric arguments::
182 * Entering and deleting text::
183 * Moving around::
184 * Extended commands::
185 * Editing the contents of a file::
186 @end menu
187
188 @node Entering and exiting @climacs{}
189 @section Entering and exiting @climacs{}
190
191 The typical way of entering @climacs{} is to type a @cl{}
192 @emph{expression} at the prompt of a @cl{} @emph{listener} such as:
193
194 @lisp
195 CL-USER> (climacs:climacs)
196 @end lisp
197
198 You exit from @climacs{} by typing @kbd{C-x C-c} (@command{Quit}).
199 @kindex C-x C-c
200 If you have buffers
201 associated with files that have not been saved to their respective
202 files, @climacs{} will ask whether you would like those buffers
203 saved. In addition, if you answer no to any of those questions, you
204 will be asked to confirm that you want to quit @climacs{} anyway. The
205 reason for this pestering on the part of @climacs{} is that currently
206 when you quit @climacs{}, the buffer contents is lost.
207
208 @node Numeric arguments
209 @section Numeric arguments
210
211 Many @climacs{} commands allow the use of a @emph{numeric argument}.
212 @cindex numeric argument
213 A numeric argument is used as a prefix to a @climacs{} command, and
214 modifies the behavior of that command in some useful way which varies
215 from command to command.
216
217 Typically, a numeric argument prefix makes the command repeat its
218 action a number of times indicated by the numeric argument prefix.
219 For instance, the command @command{Delete Object}, usually associated
220 with the order @kbd{C-d}, normally deletes a single object from the
221 buffer. However, if given a numeric argument, it deletes that many
222 objects.
223
224 Other commands modify their behavior according to whether a numeric
225 argument has been given, but do not take into account the specific
226 numeric value indicated. For instance, the command @command{Delete
227 Horizontal Space}, when given no numeric argument, deletes whitespace
228 both before and after point. With a numeric argument, it deletes only
229 whitespace @emph{before} point.
230
231 Yet other commands may both modify what they do and repeat according
232 to the numeric value of the argument. For instance, the command
233 @command{Kill Line}, when given no numeric argument, kills to the end
234 of the line if point is not already at the end of the line, but does
235 not kill the newline character at the end of the line and kills the
236 newline character if point is at the end of a line. However, if given
237 a numeric argument, @command{Kill Line} kills that many lines.
238
239 There are two ways of giving a numeric argument to a @climacs{}
240 command. One way is to first type @kbd{C-u},
241 @kindex C-u
242 then a sequence of
243 decimal digits, and finally the order that invokes the command. For
244 instance, to delete the next 15 objects after point, you could type
245 @kbd{C-u 1 5 C-d}. The other way is to hold down the @key{Meta} key
246 (usually the one marked @key{Alt}) while typing the decimal digits, as
247 in @kbd{M-1 M-5 C-d}.
248
249 Some commands accept negative numeric arguments. In that case, start
250 the sequence with the minus sign as in @kbd{C-u - 1 5 C-d}, which in
251 this case will delete buffer objects @emph{before} the point rather
252 than after.
253
254 @node Entering and deleting text
255 @section Entering and deleting text
256
257 @menu
258 * Entering text::
259 * Deleting by objects::
260 * Deleting by words::
261 * Deleting by lines::
262 @end menu
263
264 @node Entering text
265 @subsection Entering text
266
267 In contrast to other text editors such as VI, @climacs{} does not have
268 a specific @emph{insert mode}. Instead, @climacs{} is always in
269 insert mode, in that characters that are typed on the keyboard
270 immediately get inserted at the @emph{point}.
271
272 @node Deleting by objects
273 @subsection Deleting by objects
274
275 To erase objects that have been inserted, you can use the
276 @key{Backspace} (@command{Backward Delete Object}
277 key, which deletes the object immediately to the left of the point.
278 To delete an object @emph{to the right} of the point, use the
279 @kbd{C-d}
280 @kindex C-d
281 (@command{Delete Object}) order. When used with a numeric
282 argument, these commands delete that many objects.
283
284 @node Deleting by words
285 @subsection Deleting by words
286
287 It is also possible to delete larger chunks of buffer contents. The
288 order @kbd{M-d}
289 @kindex M-d
290 (@command{Kill Word}) is used to delete the @emph{word}
291 @cindex word
292 @emph{following} point. If point is not at the beginning of a word,
293 then the part of the word that follows point is deleted. The order
294 @kbd{M-@key{Backspace}}
295 @kindex M-@key{Backspace}
296 (@command{Backward Kill Word}) is used to
297 delete the word @emph{preceding} point. If point is not at the end of
298 a word, then the part of the word that precedes point is deleted.
299 When used with a numeric argument, these commands delete that many
300 words. Since these command names contain the word @emph{kill}, they
301 use the kill-ring (@pxref{kill-ring}).
302
303 @node Deleting by lines
304 @subsection Deleting by lines
305
306 @climacs{} allows you to delete buffer objects one or more lines at a
307 time. The order @kbd{C-k}
308 @kindex C-k
309 (@command{Kill Line}) lets you do this. When point is @emph{not} at
310 the end of a line, then this command kills the buffer contents from
311 point up to, but not including the following newline object. When
312 instead point @emph{is} at the end of a line, only the following
313 newline object is removed.
314
315 When used with a numeric argument, this command is not simply repeated
316 that many times. Instead, the number of lines indicated by the
317 numerid argument are removed.
318
319 Because this command name contains the word @emph{kill} it saves the
320 deleted objects on the @emph{kill ring} (@pxref{kill-ring}).
321
322 @node Moving around
323 @section Moving around
324
325 @menu
326 * Moving by objects::
327 * Moving by words::
328 * Moving by lines::
329 @end menu
330
331 @node Moving by objects
332 @subsection Moving by objects
333
334 @climacs{} allows you to move around in the buffer in various ways.
335 The most frequent way of moving around is by one buffer position at a
336 time.
337
338 The order @kbd{C-f}
339 @kindex C-f
340 (@command{Forward Object}) allows you to
341 advance the position of point by one position. If given a numeric
342 argument, it advances by that many positions. The @command{Forward
343 Object} command is also associated with the @emph{right-arrow key}.
344
345 The order @kbd{C-b}
346 @kindex C-b
347 (@command{Backward Object}) allows you to move the
348 position of point backward by one position. If given a numeric
349 argument, it moves back by that many positions. The @command{Backward
350 Object} command is also associated with the @emph{left-arrow key}.
351
352 @node Moving by words
353 @subsection Moving by words
354
355 @climacs{} will allow you to move around by larger unites than
356 objects.
357
358 The order @kbd{M-f}
359 @kindex M-f
360 (@command{Forward Word}) lets you move forward over the @emph{word}
361 @cindex word
362 following point. With a numeric argument, this command moves point
363 forward that many words.
364
365 The order @kbd{M-b}
366 @kindex M-b
367 (@command{Backward Word}) lets you move backward over the @emph{word}
368 @cindex word
369 preceding point. With a numeric argument, this command moves point
370 backward that many words.
371
372 Notice the analogy between the commands for moving by objects
373 (@kbd{C-f}, @kbd{C-b}) and those for moving by words (@kbd{M-f},
374 @kbd{M-b}).
375
376 @node Moving by lines
377 @subsection Moving by lines
378
379 @climacs{} has commands to move by one or several @emph{lines} at a
380 time.
381
382 The order @kbd{C-p}
383 @kindex C-p
384 (@command{Previous Line}) allows you to
385 move point @emph{up} to the previous line. If given a numeric
386 argument, it moves up by that many lines. The command
387 @command{Previous Line} is also associated with the @emph{up-arrow
388 key}.
389
390 The order @kbd{C-n}
391 @kindex C-n
392 (@command{Next Line}) allows you to
393 move point @emph{down} to the next line. If given a numeric
394 argument, it moves down by that many lines. The command
395 @command{Next Line} is also associated with the @emph{down-arrow
396 key}.
397
398 When you move by lines, @climacs{} tries to be smart about what
399 @emph{column} point ends up in, in the following way: when a sequence
400 of commands that move by lines is given, the initial column of point
401 is remembered (this is called the @emph{goal column}). @climacs{}
402 then tries to position point in that column of the target line. If
403 the target line has fewer than that many columns, point is positioned
404 at the end of the target line. The goal column is discarded when the
405 sequence of commands is interrupted by some unrelated command.
406
407 @node Extended commands
408 @section Extended commands
409
410 In order to make editing as efficient as possible, many @climacs{}
411 commands can be invoked by key sequences. It is, however, possible to
412 invoke most @climacs{} commands by using the order @kbd{M-x} which
413 invokes the command @command{Extended Command} which lets you type the
414 @emph{name} of the command in the minibuffer at the prompt.
415 In general, you do not have to type the full name of the command,
416 because @climacs{} uses CLIM's completion mechanism so that you can
417 complete the name by typing some prefix and then use the @key{TAB} key
418 to complete.
419
420 Some @climacs{} commands @emph{must} be invoked through the use of
421 @command{Extended Command}. The reason for this is that key sequences
422 are a precious resource, and for rarely-used commands, it is better
423 not to waste a key sequence.
424
425 @node Editing the contents of a file
426 @section Editing the contents of a file
427
428 Transfering the contents of a text file into a @climacs{} buffer is
429 referred to as @emph{finding} the file.
430 @cindex finding a file
431
432 There are two ways of transfering the contents of a buffer to a file.
433 One is to @emph{save} the buffer, which means to transfer the contents
434 to the file that is already associated with the buffer. The other is
435 to @emph{write} the buffer, which means to transfer the contents to a
436 different file than that associated with the buffer, or to write the
437 contents of a buffer that has no associated file to some file.
438
439 @menu
440 * Finding a file:: Moving text from a file to a @climacs{} buffer
441 * Saving a buffer:: Moving text from a buffer to the associated file
442 * Writing a buffer:: Moving text from a buffer to a different file
443 @end menu
444
445 @node Finding a file
446 @subsection Finding a file
447
448 To find a file, use the order @kbd{C-x C-f}
449 @kindex C-x C-f
450 (@command{Find File}).
451
452 @climacs{} will prompt for the name of a file. For typing the file
453 name, you can use @emph{completion} (using the @key{TAB} key), or you
454 can use the right mouse button to get a list of all the files that
455 match the prefix you typed.
456
457 The result of finding a file is that a @emph{buffer} will be created
458 that has the name of the file, and the file will be associated with
459 that buffer when the contents is saved.
460
461 @node Saving a buffer
462 @subsection Saving a buffer
463
464 To save a buffer, use the order @kbd{C-x C-s}
465 @kindex C-x C-s
466 (@command{Save Buffer}).
467 The contents of the buffer will be transfered to the file associated
468 with the buffer if there is one. If the buffer has no file name
469 associated with it, then this command behaves just like @command{Write
470 Buffer} (@pxref{write-buffer}).
471
472 @node Writing a buffer
473 @subsection Writing a buffer
474 @anchor{write-buffer}
475
476 To write a buffer to a file, use the order @kbd{C-x C-w}
477 @kindex C-x C-w
478 (@command{Write Buffer}). @climacs{} will prompt for the name of a
479 file to save the buffer contents in. Completion (by using the
480 @key{TAB} key, or by using the right mouse button) can be used if the
481 name is that of an existing file.
482
483 @node Different editing modes
484 @chapter Different editing modes
485
486 @menu
487 * Overwrite mode::
488 @end menu
489
490 @node Overwrite mode
491 @section Overwrite mode
492
493 Normally, typing ordinary characters to @climacs{} results in these
494 characters being @emph{inserted} at point. Sometimes, however, it is
495 useful to treat a line of objects as being of @emph{fixed length}, and
496 have @climacs{} @emph{replace} objects as new ones are begin typed.
497
498 This is exactly the purpose of @climacs{} @emph{overwrite mode}. This
499 mode alters the insert commands so that the object after point is
500 first deleted.
501
502 You can toggle between the normal mode of operation and overwrite mode
503 by using the @key{Insert}
504 @kindex @key{Insert}
505 (@command{Toggle Overwrite Mode}) key.
506
507 @node Kill ring
508 @chapter Kill ring
509 @anchor{kill-ring}
510
511 Many @climacs{} commands that remove objects from a buffer save these
512 objects on a global @emph{kill ring}.
513 @cindex kill ring
514
515 @node Advanced editing commands
516 @chapter Advanced editing commands
517
518 @menu
519 * Keyboard macros::
520 * Searching and replacing::
521 @end menu
522
523 @node Keyboard macros
524 @section Keyboard macros
525
526 Sometimes, it is useful to be able to repeat a sequence of keystrokes
527 several times. @climacs{} allows you to do this through a features
528 called @emph{keyboard macros}.
529 @cindex keyboard macro
530 @climacs{} does this by @emph{recording} whatever the user types on
531 the keyboard, and then making it possibly to @emph{replaying} the
532 recorded sequence.
533
534 To start recording a sequence of keystrokes, use the order @kbd{C-x (}
535 @kindex C-x (
536 (@command{Start Kbd Macro}). You will see the word @samp{Def}
537 appearing on the mode line, indicating that a keyboard macro is being
538 defined. As long as recording is in effect, every keystroke will be
539 saved for later use.
540
541 To stop recording a sequence of keystrokes, use the order @kbd{C-x )}
542 @kindex C-x )
543 (@command{End Kbd Macro}). The word @samp{Def} will disappear from
544 the mode line, indicating that keystrokes are no longer being
545 recorded.
546
547 To replay a previously recorded sequence of keystrokes, use the order
548 @kbd{C-x e}
549 @kindex C-x e
550 (@command{Call Last Kbd Macro}). When used with a numeric argument,
551 this command will repeat the sequence of keystrokes that many times.
552
553 @node Searching and replacing
554 @section Searching and replacing
555
556 @node Key Index
557 @unnumbered Key Index
558
559 @printindex ky
560
561 @node Concept Index
562 @unnumbered Concept Index
563
564 @printindex cp
565
566 @bye

  ViewVC Help
Powered by ViewVC 1.1.5