comparison man/autotype.texi @ 36506:a75c13e39706

Fix Texinfo usage.
author Richard M. Stallman <rms@gnu.org>
date Sun, 04 Mar 2001 07:04:48 +0000
parents a16d8ed56e9c
children 32f10000ac35
comparison
equal deleted inserted replaced
36505:a7400c1ee57f 36506:a75c13e39706
142 of the inserted text. 142 of the inserted text.
143 143
144 Skeletons may ask for input several times. They even have a looping 144 Skeletons may ask for input several times. They even have a looping
145 mechanism in which you will be asked for input as long as you are willing to 145 mechanism in which you will be asked for input as long as you are willing to
146 furnish it. An example would be multiple ``else if'' conditions. You can 146 furnish it. An example would be multiple ``else if'' conditions. You can
147 recognize this situation by a prompt ending in ``RET, C-g or C-h''. This 147 recognize this situation by a prompt ending in @key{RET}, @kbd{C-g}
148 or @kbd{C-h}. This
148 means that entering an empty string will simply assume that you are finished. 149 means that entering an empty string will simply assume that you are finished.
149 Typing quit on the other hand terminates the loop but also the rest of the 150 Typing quit on the other hand terminates the loop but also the rest of the
150 skeleton, e.g. an ``else'' clause is skipped. Only a syntactically necessary 151 skeleton, e.g. an ``else'' clause is skipped. Only a syntactically necessary
151 termination still gets inserted. 152 termination still gets inserted.
152 153
240 prompt-string, or @code{nil} when not needed, but can also be a Lisp 241 prompt-string, or @code{nil} when not needed, but can also be a Lisp
241 expression for complex read functions or for returning some calculated value. 242 expression for complex read functions or for returning some calculated value.
242 The rest of the list are any number of elements as described in the following 243 The rest of the list are any number of elements as described in the following
243 table: 244 table:
244 245
245 @table @code 246 @table @asis
246 @item "string", ?c, ?\c 247 @item @code{"@var{string}"}, @code{?@var{c}}, @code{?\@var{c}}
247 @vindex skeleton-transformation 248 @vindex skeleton-transformation
248 Insert string or character. Literal strings and characters are passed through 249 Insert string or character. Literal strings and characters are passed through
249 @code{skeleton-transformation} when that is non-@code{nil}. 250 @code{skeleton-transformation} when that is non-@code{nil}.
250 @item \n 251 @item @code{?\n}
252 @c ??? something seems very wrong here.
251 Insert a newline and align under current line. Use newline character 253 Insert a newline and align under current line. Use newline character
252 @code{?\n} to prevent alignment. 254 @code{?\n} to prevent alignment.
253 @item _ 255 @item @code{_}
254 Interesting point. When wrapping skeletons around successive regions, they are 256 Interesting point. When wrapping skeletons around successive regions, they are
255 put at these places. Point is left at first @code{_} where nothing is wrapped. 257 put at these places. Point is left at first @code{_} where nothing is wrapped.
256 @item > 258 @item @code{>}
257 Indent line according to major mode. When following element is @code{_}, and 259 Indent line according to major mode. When following element is @code{_}, and
258 there is a interregion that will be wrapped here, indent that interregion. 260 there is a interregion that will be wrapped here, indent that interregion.
259 @item & 261 @item @code{&}
260 Logical and. Iff preceding element moved point, i.e. usually inserted 262 Logical and. Iff preceding element moved point, i.e. usually inserted
261 something, do following element. 263 something, do following element.
262 @item | 264 @item @code{|}
263 Logical xor. Iff preceding element didn't move point, i.e. usually inserted 265 Logical xor. Iff preceding element didn't move point, i.e. usually inserted
264 nothing, do following element. 266 nothing, do following element.
265 @item -number 267 @item @code{-@var{number}}
266 Delete preceding number characters. Depends on value of 268 Delete preceding number characters. Depends on value of
267 @code{skeleton-untabify}. 269 @code{skeleton-untabify}.
268 @item (), nil 270 @item @code{()} or @code{nil}
269 Ignored. 271 Ignored.
270 @item lisp expression 272 @item @var{lisp-expression}
271 Evaluated, and the return value is again interpreted as a skeleton element. 273 Evaluated, and the return value is again interpreted as a skeleton element.
272 @item str 274 @item @code{str}
273 A special variable that, when evaluated the first time, usually prompts 275 A special variable that, when evaluated the first time, usually prompts
274 for input according to the skeleton's interactor. It is then set to the 276 for input according to the skeleton's interactor. It is then set to the
275 return value resulting from the interactor. Each subskeleton has its local 277 return value resulting from the interactor. Each subskeleton has its local
276 copy of this variable. 278 copy of this variable.
277 @item v1, v2 279 @item @code{v1}, @code{v2}
278 Skeleton-local user variables. 280 Skeleton-local user variables.
279 @item ' 281 @item @code{'@var{expression}}
280 Evaluate following lisp expression for its side-effect, but prevent it from 282 Evaluate following lisp expression for its side-effect, but prevent it from
281 being interpreted as a skeleton element. 283 being interpreted as a skeleton element.
282 @item skeleton 284 @item @var{skeleton}
283 Subskeletons are inserted recursively, not once, but as often as the user 285 Subskeletons are inserted recursively, not once, but as often as the user
284 enters something at the subskeletons interactor. Thus there must be a 286 enters something at the subskeletons interactor. Thus there must be a
285 @code{str} in the subskeleton. They can also be used non-interactively, when 287 @code{str} in the subskeleton. They can also be used non-interactively, when
286 prompt is a lisp-expression that returns successive list-elements. 288 prompt is a lisp-expression that returns successive list-elements.
287 @item resume: 289 @item @code{resume:}
288 Ignored. Execution resumes here when the user quit during skeleton 290 Ignored. Execution resumes here if the user quits during skeleton
289 interpretation. 291 interpretation.
290 @item quit 292 @item @code{quit}
291 A constant which is non-@code{nil} when the @code{resume:} section was entered 293 A constant which is non-@code{nil} when the @code{resume:} section was entered
292 because the user quit. 294 because the user quit.
293 @end table 295 @end table
294 296
295 @findex skeleton-further-elements 297 @findex skeleton-further-elements
296 Some modes also use other skeleton elements they themselves defined. For 298 Some modes also use other skeleton elements they themselves defined. For
297 example in shell script mode's skeletons you will find @code{<} which does a 299 example in shell script mode's skeletons you will find @code{<} which does a
298 rigid indentation backwards, or in cc-mode's skeletons you find the 300 rigid indentation backwards, or in CC mode's skeletons you find the
299 self-inserting elements @code{@{} and @code{@}}. These are defined by the 301 self-inserting elements @code{@{} and @code{@}}. These are defined by the
300 buffer-local variable @code{skeleton-further-elements} which is a list of 302 buffer-local variable @code{skeleton-further-elements} which is a list of
301 variables bound while interpreting a skeleton. 303 variables bound while interpreting a skeleton.
302 304
303 @findex define-skeleton 305 @findex define-skeleton
323 typing some of the stranger programming language symbols makes you bend your 325 typing some of the stranger programming language symbols makes you bend your
324 fingers backwards, this can be quite relieving too. 326 fingers backwards, this can be quite relieving too.
325 327
326 @findex skeleton-pair-insert-maybe 328 @findex skeleton-pair-insert-maybe
327 @vindex skeleton-pair 329 @vindex skeleton-pair
328 This is done by binding the first key (@pxref{(emacs)Rebinding}) of the 330 This is done by binding the first key (@pxref{(emacs)Rebinding}) of
329 pair to @code{skeleton-pair-insert-maybe} instead of @code{self-insert-command}. 331 the pair to @code{skeleton-pair-insert-maybe} instead of
330 The ``maybe'' comes from the fact that this at first surprising behaviour is 332 @code{self-insert-command}. The ``maybe'' comes from the fact that
331 initially turned off. To enable it, you must set @code{skeleton-pair} to some 333 this at-first surprising behaviour is initially turned off. To enable
332 non-@code{nil} value. And even then, a positive argument 334 it, you must set @code{skeleton-pair} to some non-@code{nil} value.
333 (@pxref{(emacs)Arguments}) will make this key behave like a self 335 And even then, a positive argument (@pxref{(emacs)Arguments}) will
334 inserting key (@pxref{(emacs)Inserting Text}). 336 make this key behave like a self-inserting key
337 (@pxref{(emacs)Inserting Text}).
335 338
336 @vindex skeleton-pair-on-word 339 @vindex skeleton-pair-on-word
337 While this breaks with the stated intention of always balancing pairs, it 340 While this breaks with the stated intention of always balancing pairs, it
338 turns out that one often doesn't want pairing to occur, when the following 341 turns out that one often doesn't want pairing to occur, when the following
339 character is part of a word. If you want pairing to occur even then, set 342 character is part of a word. If you want pairing to occur even then, set
340 @code{skeleton-pair-on-word} to some non-@code{nil} value. 343 @code{skeleton-pair-on-word} to some non-@code{nil} value.
341 344
342 @vindex skeleton-pair-alist 345 @vindex skeleton-pair-alist
343 Pairing is possible for all visible characters. By default the parenthesis 346 Pairing is possible for all visible characters. By default the
344 `(', the square bracket `[', the brace `@{', the pointed bracket `<' and the 347 parenthesis @samp{(}, the square bracket @samp{[}, the brace
345 backquote ``' will all pair to the symmetrical character. All other 348 @samp{@{}, the pointed bracket @samp{<} and the backquote @samp{`} all
346 characters will pair themselves. This behaviour can be modified by the 349 pair with the symmetrical character. All other characters pair
347 variable @code{skeleton-pair-alist}. This is in fact an alist of skeletons 350 themselves. This behaviour can be modified by the variable
348 (@pxref{Skeleton Language}), with the first part of each sublist matching the 351 @code{skeleton-pair-alist}. This is in fact an alist of skeletons
349 typed character. This is the position of the interactor, but since pairs 352 (@pxref{Skeleton Language}), with the first part of each sublist
350 don't need the @code{str} element, this is ignored. 353 matching the typed character. This is the position of the interactor,
351 354 but since pairs don't need the @code{str} element, this is ignored.
352 Some modes have bound the command @code{skeleton-pair-insert-maybe} to 355
353 relevant keys. These modes also configure the pairs as appropriate. 356 Some modes have bound the command @code{skeleton-pair-insert-maybe}
354 For example, when typing english prose, you'd expect the backquote (`) 357 to relevant keys. These modes also configure the pairs as
355 to pair to the quote (') while in Shell script mode it must pair to 358 appropriate. For example, when typing english prose, you'd expect the
356 itself. They can also inhibit pairing in certain contexts. For example 359 backquote (@samp{`}) to pair with the quote (@samp{'}), while in Shell
357 an escaped character will stand for itself. 360 script mode it must pair to itself. They can also inhibit pairing in
361 certain contexts. For example an escaped character stands for itself.
358 362
359 363
360 364
361 @node Autoinserting 365 @node Autoinserting
362 @chapter Autoinserting Text in Empty Files 366 @chapter Autoinserting Text in Empty Files
370 'find-file-hooks 'auto-insert)} into your @file{~/.emacs} file 374 'find-file-hooks 'auto-insert)} into your @file{~/.emacs} file
371 (@pxref{(emacs)Init File}). 375 (@pxref{(emacs)Init File}).
372 376
373 @vindex auto-insert-alist 377 @vindex auto-insert-alist
374 What gets inserted, if anything, is determined by the variable 378 What gets inserted, if anything, is determined by the variable
375 @code{auto-insert-alist}. The @code{car}s of this list are each either a mode 379 @code{auto-insert-alist}. The @sc{car}s of this list are each either
376 name, making an element applicable when a buffer is in that mode. Or they 380 a mode name, making an element applicable when a buffer is in that
377 can be a string, which is a regexp matched against the buffer's file name. 381 mode. Or they can be a string, which is a regexp matched against the
378 In that way different kinds of files that have the same mode in Emacs can be 382 buffer's file name. In that way different kinds of files that have
379 distinguished. The @code{car}s may also be @code{cons}-cells consisting of 383 the same mode in Emacs can be distinguished. The @sc{car}s may also
380 mode name or regexp as above and an additional descriptive string. 384 be cons cells consisting of mode name or regexp as above and an
381 385 additional descriptive string.
382 When a matching element is found, the @code{cdr} says what to do. It may 386
387 When a matching element is found, the @sc{cdr} says what to do. It may
383 be a string, which is a file name, whose contents are to be inserted, if 388 be a string, which is a file name, whose contents are to be inserted, if
384 that file is found in the directory @code{auto-insert-directory} or under a 389 that file is found in the directory @code{auto-insert-directory} or under a
385 absolute file name. Or it can be a skeleton (@pxref{Skeleton Language}) to 390 absolute file name. Or it can be a skeleton (@pxref{Skeleton Language}) to
386 be inserted. 391 be inserted.
387 392
388 It can also be a function, which allows doing various things. The function 393 It can also be a function, which allows doing various things. The function
389 can simply insert some text, indeed, it can be skeleton command (@pxref{Using 394 can simply insert some text, indeed, it can be skeleton command (@pxref{Using
390 Skeletons}). It can be a lambda function which will for example conditionally 395 Skeletons}). It can be a lambda function which will for example conditionally
391 call another function. Or it can even reset the mode for the buffer. If you 396 call another function. Or it can even reset the mode for the buffer. If you
392 want to perform several such actions in order, you use a vector, i.e. several 397 want to perform several such actions in order, you use a vector, i.e. several
393 of the above elements between square brackets ([...]). 398 of the above elements between square brackets (@samp{[@r{@dots{}}]}).
394 399
395 By default C and C++ headers insert a definition of a symbol derived from 400 By default C and C++ headers insert a definition of a symbol derived from
396 the filename to prevent multiple inclusions. C and C++ sources insert an 401 the filename to prevent multiple inclusions. C and C++ sources insert an
397 include of the header. Makefiles insert the file makefile.inc if it exists. 402 include of the header. Makefiles insert the file makefile.inc if it exists.
398 403
399 TeX and bibTeX mode files insert the file tex-insert.tex if it exists, while 404 TeX and bibTeX mode files insert the file tex-insert.tex if it exists, while
400 LaTeX mode files insert a typical @code{\documentclass} frame. Html 405 LaTeX mode files insert a typical @code{\documentclass} frame. Html
401 files insert a skeleton with the usual frame. 406 files insert a skeleton with the usual frame.
402 407
403 Ada mode files call the Ada header skeleton command. Emacs lisp source 408 Ada mode files call the Ada header skeleton command. Emacs lisp
404 files insert the usual header, with a copyright of your environment variable 409 source files insert the usual header, with a copyright of your
405 @code{$ORGANIZATION} or else the FSF, and prompt for valid keywords describing 410 environment variable @env{$ORGANIZATION} or else the FSF, and prompt
406 the contents. Files in a @code{bin/} directory for which Emacs could 411 for valid keywords describing the contents. Files in a @file{bin}
407 determine no specialised mode (@pxref{(emacs)Choosing Modes}) are set to Shell script 412 directory for which Emacs could determine no specialised mode
408 mode. 413 (@pxref{(emacs)Choosing Modes}) are set to Shell script mode.
409 414
410 @findex define-auto-insert 415 @findex define-auto-insert
411 In Lisp (@pxref{(emacs)Init File}) you can use the function @code{define-auto-insert} 416 In Lisp (@pxref{(emacs)Init File}) you can use the function
412 to add to or modify @code{auto-insert-alist}. See its documentation with 417 @code{define-auto-insert} to add to or modify
413 @kbd{C-h f auto-insert-alist}. 418 @code{auto-insert-alist}. See its documentation with @kbd{C-h f
419 auto-insert-alist}.
414 420
415 @vindex auto-insert 421 @vindex auto-insert
416 The variable @code{auto-insert} says what to do when @code{auto-insert} is 422 The variable @code{auto-insert} says what to do when @code{auto-insert} is
417 called non-interactively, e.g. when a newly found file is empty (see above): 423 called non-interactively, e.g. when a newly found file is empty (see above):
418 @table @code 424 @table @asis
419 @item nil 425 @item @code{nil}
420 Do nothing. 426 Do nothing.
421 @item t 427 @item @code{t}
422 Insert something if possible, i.e. there is a matching entry in 428 Insert something if possible, i.e. there is a matching entry in
423 @code{auto-insert-alist}. 429 @code{auto-insert-alist}.
424 @item other 430 @item other
425 Insert something if possible, but mark as unmodified. 431 Insert something if possible, but mark as unmodified.
426 @end table 432 @end table
427 433
428 @vindex auto-insert-query 434 @vindex auto-insert-query
429 The variable @code{auto-insert-query} controls whether to ask about 435 The variable @code{auto-insert-query} controls whether to ask about
430 inserting something. When this is @code{nil} inserting is only done with 436 inserting something. When this is @code{nil}, inserting is only done with
431 @kbd{M-x auto-insert}. When this is @code{'function} you are queried 437 @kbd{M-x auto-insert}. When this is @code{function}, you are queried
432 whenever @code{auto-insert} is called as a function, such as when Emacs 438 whenever @code{auto-insert} is called as a function, such as when Emacs
433 visits an empty file and you have set the above-mentioned hook. Otherwise 439 visits an empty file and you have set the above-mentioned hook. Otherwise
434 you are alway queried. 440 you are alway queried.
435 441
436 @vindex auto-insert-prompt 442 @vindex auto-insert-prompt
437 When querying, the variable @code{auto-insert-prompt}'s value is used as a 443 When querying, the variable @code{auto-insert-prompt}'s value is used as a
438 prompt for a y-or-n-type question. If this includes a @code{%s} construct, 444 prompt for a y-or-n-type question. If this includes a @samp{%s} construct,
439 that is replaced by what caused the insertion rule to be chosen. This is 445 that is replaced by what caused the insertion rule to be chosen. This is
440 either a descriptive text, the mode-name of the buffer or the regular 446 either a descriptive text, the mode-name of the buffer or the regular
441 expression that matched the filename. 447 expression that matched the filename.
442 448
443 449
447 @cindex copyrights 453 @cindex copyrights
448 454
449 @findex copyright 455 @findex copyright
450 @kbd{M-x copyright} is a skeleton inserting command, that adds a copyright 456 @kbd{M-x copyright} is a skeleton inserting command, that adds a copyright
451 notice at the point. The ``by'' part is taken from your environment variable 457 notice at the point. The ``by'' part is taken from your environment variable
452 @code{$ORGANIZATION} or if that isn't set you are prompted for it. If the 458 @env{$ORGANIZATION} or if that isn't set you are prompted for it. If the
453 buffer has a comment syntax (@pxref{(emacs)Comments}), this is inserted as a comment. 459 buffer has a comment syntax (@pxref{(emacs)Comments}), this is inserted as a comment.
454 460
455 @findex copyright-update 461 @findex copyright-update
456 @vindex copyright-limit 462 @vindex copyright-limit
457 @vindex copyright-current-year 463 @vindex copyright-current-year
471 file (@pxref{(emacs)Init File}). 477 file (@pxref{(emacs)Init File}).
472 478
473 @vindex copyright-query 479 @vindex copyright-query
474 The variable @code{copyright-query} controls whether to update the 480 The variable @code{copyright-query} controls whether to update the
475 copyright or whether to ask about it. When this is @code{nil} updating is 481 copyright or whether to ask about it. When this is @code{nil} updating is
476 only done with @kbd{M-x copyright-update}. When this is @code{'function} 482 only done with @kbd{M-x copyright-update}. When this is @code{function}
477 you are queried whenever @code{copyright-update} is called as a function, 483 you are queried whenever @code{copyright-update} is called as a function,
478 such as in the @code{write-file-hooks} feature mentioned above. Otherwise 484 such as in the @code{write-file-hooks} feature mentioned above. Otherwise
479 you are always queried. 485 you are always queried.
480 486
481 487
484 @chapter Making Interpreter Scripts Executable 490 @chapter Making Interpreter Scripts Executable
485 @cindex executables 491 @cindex executables
486 492
487 @vindex executable-prefix 493 @vindex executable-prefix
488 @vindex executable-chmod 494 @vindex executable-chmod
489 Various Un*x interpreter modes such as Shell script mode or AWK mode 495 Various interpreter modes such as Shell script mode or AWK mode will
490 will automatically insert or update the buffer's magic number, a special 496 automatically insert or update the buffer's magic number, a special
491 comment on the first line that makes the @code{exec()} systemcall know how 497 comment on the first line that makes the @code{exec} systemcall know
492 to execute the script. To this end the script is automatically made 498 how to execute the script. To this end the script is automatically
493 executable upon saving, with @code{executable-chmod} as argument to the 499 made executable upon saving, with @code{executable-chmod} as argument
494 system @code{chmod} command. The magic number is prefixed by the value of 500 to the system @code{chmod} command. The magic number is prefixed by
495 @code{executable-prefix}. 501 the value of @code{executable-prefix}.
496 502
497 @vindex executable-magicless-file-regexp 503 @vindex executable-magicless-file-regexp
498 Any file whose name matches @code{executable-magicless-file-regexp} is not 504 Any file whose name matches @code{executable-magicless-file-regexp} is not
499 furnished with a magic number, nor is it made executable. This is mainly 505 furnished with a magic number, nor is it made executable. This is mainly
500 intended for resource files, which are only meant to be read in. 506 intended for resource files, which are only meant to be read in.
501 507
502 @vindex executable-insert 508 @vindex executable-insert
503 The variable @code{executable-insert} says what to do when 509 The variable @code{executable-insert} says what to do when
504 @code{executable-set-magic} is called non-interactively, e.g. when file has no 510 @code{executable-set-magic} is called non-interactively, e.g. when file has no
505 or the wrong magic number: 511 or the wrong magic number:
506 @table @code 512 @table @asis
507 @item nil 513 @item @code{nil}
508 Do nothing. 514 Do nothing.
509 @item t 515 @item @code{t}
510 Insert or update magic number. 516 Insert or update magic number.
511 @item other 517 @item other
512 Insert or update magic number, but mark as unmodified. 518 Insert or update magic number, but mark as unmodified.
513 @end table 519 @end table
514 520
515 @findex executable-set-magic 521 @findex executable-set-magic
516 @vindex executable-query 522 @vindex executable-query
517 The variable @code{executable-query} controls whether to ask about 523 The variable @code{executable-query} controls whether to ask about
518 inserting or updating the magic number. When this is @code{nil} updating 524 inserting or updating the magic number. When this is @code{nil} updating
519 is only done with @kbd{M-x executable-set-magic}. When this is 525 is only done with @kbd{M-x executable-set-magic}. When this is
520 @code{'function} you are queried whenever @code{executable-set-magic} is 526 @code{function} you are queried whenever @code{executable-set-magic} is
521 called as a function, such as when Emacs puts a buffer in Shell script 527 called as a function, such as when Emacs puts a buffer in Shell script
522 mode. Otherwise you are alway queried. 528 mode. Otherwise you are alway queried.
523 529
524 @findex executable-self-display 530 @findex executable-self-display
525 @kbd{M-x executable-self-display} adds a magic number to the buffer, which 531 @kbd{M-x executable-self-display} adds a magic number to the buffer, which
526 will turn it into a self displaying text file, when called as a Un*x command. 532 will turn it into a self displaying text file, when called as a Un*x command.
527 The ``interpreter'' used is @code{executable-self-display} with argument 533 The ``interpreter'' used is @code{executable-self-display} with argument
528 @code{+2}. 534 @samp{+2}.
529 535
530 @node Timestamps 536 @node Timestamps
531 @chapter Maintaining Timestamps in Modified Files 537 @chapter Maintaining Timestamps in Modified Files
532 @cindex timestamps 538 @cindex timestamps
533 539