diff options
| author | Lars Ingebrigtsen | 2019-10-09 20:07:56 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2019-10-09 20:07:56 +0200 |
| commit | b16f19626c468647de570e43c9b18db5bd5e7638 (patch) | |
| tree | 13b49fc11c5bfa9d9385352f17a8ec473d22bcde /doc/misc | |
| parent | 50886f0992cf824f87a501cc8d8d8f62e7d2762a (diff) | |
| download | emacs-b16f19626c468647de570e43c9b18db5bd5e7638.tar.gz emacs-b16f19626c468647de570e43c9b18db5bd5e7638.zip | |
Move the "Skeleton Language" node to later in the manual
* doc/misc/autotype.texi (Skeleton Language): Move this low-level
node to after the more user-facing nodes (bug#20780).
Diffstat (limited to 'doc/misc')
| -rw-r--r-- | doc/misc/autotype.texi | 199 |
1 files changed, 99 insertions, 100 deletions
diff --git a/doc/misc/autotype.texi b/doc/misc/autotype.texi index a354383cc9f..89cba183a25 100644 --- a/doc/misc/autotype.texi +++ b/doc/misc/autotype.texi | |||
| @@ -86,7 +86,6 @@ completions and expansions of text at point. | |||
| 86 | * Using Skeletons:: How to insert a skeleton into your text. | 86 | * Using Skeletons:: How to insert a skeleton into your text. |
| 87 | * Wrapping Skeletons:: Putting existing text within a skeleton. | 87 | * Wrapping Skeletons:: Putting existing text within a skeleton. |
| 88 | * Skeletons as Abbrevs:: An alternative for issuing skeleton commands. | 88 | * Skeletons as Abbrevs:: An alternative for issuing skeleton commands. |
| 89 | * Skeleton Language:: Making skeleton commands insert what you want. | ||
| 90 | * Inserting Pairs:: Typing one character and getting another | 89 | * Inserting Pairs:: Typing one character and getting another |
| 91 | after point. | 90 | after point. |
| 92 | * Autoinserting:: Filling up empty files as soon as you visit them. | 91 | * Autoinserting:: Filling up empty files as soon as you visit them. |
| @@ -96,6 +95,7 @@ completions and expansions of text at point. | |||
| 96 | * QuickURL:: Inserting URLs based on text at point. | 95 | * QuickURL:: Inserting URLs based on text at point. |
| 97 | * Tempo:: Flexible template insertion. | 96 | * Tempo:: Flexible template insertion. |
| 98 | * Hippie Expand:: Expansion of text trying various methods. | 97 | * Hippie Expand:: Expansion of text trying various methods. |
| 98 | * Skeleton Language:: Making skeleton commands insert what you want. | ||
| 99 | 99 | ||
| 100 | * GNU Free Documentation License:: The license for this documentation. | 100 | * GNU Free Documentation License:: The license for this documentation. |
| 101 | * Concept Index:: | 101 | * Concept Index:: |
| @@ -209,105 +209,6 @@ have been omitted.) | |||
| 209 | 209 | ||
| 210 | 210 | ||
| 211 | 211 | ||
| 212 | @node Skeleton Language | ||
| 213 | @chapter Skeleton Language | ||
| 214 | @cindex skeleton language | ||
| 215 | |||
| 216 | @findex skeleton-insert | ||
| 217 | Skeletons are a shorthand extension to the Lisp language, where various | ||
| 218 | atoms directly perform either actions on the current buffer or rudimentary | ||
| 219 | flow control mechanisms. Skeletons are interpreted by the function | ||
| 220 | @code{skeleton-insert}. | ||
| 221 | |||
| 222 | A skeleton is a list starting with an interactor, which is usually a | ||
| 223 | prompt-string, or @code{nil} when not needed, but can also be a Lisp | ||
| 224 | expression for complex read functions or for returning some calculated value. | ||
| 225 | The rest of the list are any number of elements as described in the following | ||
| 226 | table: | ||
| 227 | |||
| 228 | @table @asis | ||
| 229 | @item @code{"@var{string}"}, @code{?@var{c}}, @code{?\@var{c}} | ||
| 230 | @vindex skeleton-transformation | ||
| 231 | Insert string or character. Literal strings and characters are passed through | ||
| 232 | @code{skeleton-transformation} when that is non-@code{nil}. | ||
| 233 | @item @code{?\n} | ||
| 234 | @c ??? something seems very wrong here. | ||
| 235 | Insert a newline and align under current line, but not if this is the | ||
| 236 | last element of a skeleton and the newline would be inserted at end of | ||
| 237 | line, or this is the first element and the newline would be inserted | ||
| 238 | at beginning of line. Use newline character @code{?\n} to prevent | ||
| 239 | alignment. Use @code{"\n"} as the first or last string element of a | ||
| 240 | skeleton to insert a newline unconditionally. | ||
| 241 | @item @code{_} | ||
| 242 | Interesting point. When wrapping skeletons around successive regions, they are | ||
| 243 | put at these places. Point is left at first @code{_} where nothing is | ||
| 244 | wrapped. | ||
| 245 | @item @code{-} | ||
| 246 | Interesting point with no inter-region interaction; overrides | ||
| 247 | interesting point set by @code{_}. | ||
| 248 | @item @code{>} | ||
| 249 | Indent line according to major mode. When following element is @code{_}, and | ||
| 250 | there is an interregion that will be wrapped here, indent that interregion. | ||
| 251 | @item @code{&} | ||
| 252 | Logical and. If preceding element moved point, i.e., usually inserted | ||
| 253 | something, do following element. | ||
| 254 | @item @code{|} | ||
| 255 | Logical xor. If preceding element didn't move point, i.e., usually inserted | ||
| 256 | nothing, do following element. | ||
| 257 | @item @code{@@} | ||
| 258 | Add position to @code{skeleton-positions}. | ||
| 259 | @item @code{-@var{number}} | ||
| 260 | Delete preceding number characters. Depends on value of | ||
| 261 | @code{skeleton-untabify}. | ||
| 262 | @item @code{()} or @code{nil} | ||
| 263 | Ignored. | ||
| 264 | @item @var{lisp-expression} | ||
| 265 | Evaluated, and the return value is again interpreted as a skeleton element. | ||
| 266 | @item @code{str} | ||
| 267 | A special variable that, when evaluated the first time, usually prompts | ||
| 268 | for input according to the skeleton's interactor. It is then set to the | ||
| 269 | return value resulting from the interactor. Each subskeleton has its local | ||
| 270 | copy of this variable. | ||
| 271 | @item @code{v1}, @code{v2} | ||
| 272 | Skeleton-local user variables. | ||
| 273 | @item @code{'@var{expression}} | ||
| 274 | Evaluate following Lisp expression for its side-effect, but prevent it from | ||
| 275 | being interpreted as a skeleton element. | ||
| 276 | @item @var{skeleton} | ||
| 277 | Subskeletons are inserted recursively, not once, but as often as the user | ||
| 278 | enters something at the subskeletons interactor. Thus there must be a | ||
| 279 | @code{str} in the subskeleton. They can also be used non-interactively, when | ||
| 280 | prompt is a lisp-expression that returns successive list-elements. | ||
| 281 | @item @code{resume:} | ||
| 282 | Ignored. Execution resumes here if the user quits during skeleton | ||
| 283 | interpretation. | ||
| 284 | @item @code{help} | ||
| 285 | Help form during interaction with the user or @code{nil}. | ||
| 286 | @item @code{input} | ||
| 287 | Initial input (a string or a cons with index) while reading the input. | ||
| 288 | @item @code{quit} | ||
| 289 | A constant which is non-@code{nil} when the @code{resume:} section was entered | ||
| 290 | because the user quit. | ||
| 291 | @end table | ||
| 292 | |||
| 293 | @findex skeleton-further-elements | ||
| 294 | Some modes also use other skeleton elements they themselves defined. For | ||
| 295 | example in shell script mode's skeletons you will find @code{<} which does a | ||
| 296 | rigid indentation backwards, or in CC mode's skeletons you find the | ||
| 297 | self-inserting elements @code{@{} and @code{@}}. These are defined by the | ||
| 298 | buffer-local variable @code{skeleton-further-elements} which is a list of | ||
| 299 | variables bound while interpreting a skeleton. | ||
| 300 | |||
| 301 | @findex define-skeleton | ||
| 302 | The macro @code{define-skeleton} defines a command for interpreting a | ||
| 303 | skeleton. The first argument is the command name, the second is a | ||
| 304 | documentation string, and the rest is an interactor and any number of skeleton | ||
| 305 | elements together forming a skeleton. This skeleton is assigned to a variable | ||
| 306 | of the same name as the command and can thus be overridden from your | ||
| 307 | @file{~/.emacs} file (@pxref{Init File,,, emacs, The GNU Emacs Manual}). | ||
| 308 | |||
| 309 | |||
| 310 | |||
| 311 | @node Inserting Pairs | 212 | @node Inserting Pairs |
| 312 | @chapter Inserting Matching Pairs of Characters | 213 | @chapter Inserting Matching Pairs of Characters |
| 313 | @cindex inserting pairs | 214 | @cindex inserting pairs |
| @@ -656,6 +557,104 @@ Typically you would bind @code{hippie-expand} to @kbd{M-/} with | |||
| 656 | @code{dabbrev-expand}, the standard binding of @kbd{M-/}, providing one | 557 | @code{dabbrev-expand}, the standard binding of @kbd{M-/}, providing one |
| 657 | of the expansion possibilities. | 558 | of the expansion possibilities. |
| 658 | 559 | ||
| 560 | @node Skeleton Language | ||
| 561 | @chapter Skeleton Language | ||
| 562 | @cindex skeleton language | ||
| 563 | |||
| 564 | @findex skeleton-insert | ||
| 565 | Skeletons are a shorthand extension to the Lisp language, where various | ||
| 566 | atoms directly perform either actions on the current buffer or rudimentary | ||
| 567 | flow control mechanisms. Skeletons are interpreted by the function | ||
| 568 | @code{skeleton-insert}. | ||
| 569 | |||
| 570 | A skeleton is a list starting with an interactor, which is usually a | ||
| 571 | prompt-string, or @code{nil} when not needed, but can also be a Lisp | ||
| 572 | expression for complex read functions or for returning some calculated value. | ||
| 573 | The rest of the list are any number of elements as described in the following | ||
| 574 | table: | ||
| 575 | |||
| 576 | @table @asis | ||
| 577 | @item @code{"@var{string}"}, @code{?@var{c}}, @code{?\@var{c}} | ||
| 578 | @vindex skeleton-transformation | ||
| 579 | Insert string or character. Literal strings and characters are passed through | ||
| 580 | @code{skeleton-transformation} when that is non-@code{nil}. | ||
| 581 | @item @code{?\n} | ||
| 582 | @c ??? something seems very wrong here. | ||
| 583 | Insert a newline and align under current line, but not if this is the | ||
| 584 | last element of a skeleton and the newline would be inserted at end of | ||
| 585 | line, or this is the first element and the newline would be inserted | ||
| 586 | at beginning of line. Use newline character @code{?\n} to prevent | ||
| 587 | alignment. Use @code{"\n"} as the first or last string element of a | ||
| 588 | skeleton to insert a newline unconditionally. | ||
| 589 | @item @code{_} | ||
| 590 | Interesting point. When wrapping skeletons around successive regions, they are | ||
| 591 | put at these places. Point is left at first @code{_} where nothing is | ||
| 592 | wrapped. | ||
| 593 | @item @code{-} | ||
| 594 | Interesting point with no inter-region interaction; overrides | ||
| 595 | interesting point set by @code{_}. | ||
| 596 | @item @code{>} | ||
| 597 | Indent line according to major mode. When following element is @code{_}, and | ||
| 598 | there is an interregion that will be wrapped here, indent that interregion. | ||
| 599 | @item @code{&} | ||
| 600 | Logical and. If preceding element moved point, i.e., usually inserted | ||
| 601 | something, do following element. | ||
| 602 | @item @code{|} | ||
| 603 | Logical xor. If preceding element didn't move point, i.e., usually inserted | ||
| 604 | nothing, do following element. | ||
| 605 | @item @code{@@} | ||
| 606 | Add position to @code{skeleton-positions}. | ||
| 607 | @item @code{-@var{number}} | ||
| 608 | Delete preceding number characters. Depends on value of | ||
| 609 | @code{skeleton-untabify}. | ||
| 610 | @item @code{()} or @code{nil} | ||
| 611 | Ignored. | ||
| 612 | @item @var{lisp-expression} | ||
| 613 | Evaluated, and the return value is again interpreted as a skeleton element. | ||
| 614 | @item @code{str} | ||
| 615 | A special variable that, when evaluated the first time, usually prompts | ||
| 616 | for input according to the skeleton's interactor. It is then set to the | ||
| 617 | return value resulting from the interactor. Each subskeleton has its local | ||
| 618 | copy of this variable. | ||
| 619 | @item @code{v1}, @code{v2} | ||
| 620 | Skeleton-local user variables. | ||
| 621 | @item @code{'@var{expression}} | ||
| 622 | Evaluate following Lisp expression for its side-effect, but prevent it from | ||
| 623 | being interpreted as a skeleton element. | ||
| 624 | @item @var{skeleton} | ||
| 625 | Subskeletons are inserted recursively, not once, but as often as the user | ||
| 626 | enters something at the subskeletons interactor. Thus there must be a | ||
| 627 | @code{str} in the subskeleton. They can also be used non-interactively, when | ||
| 628 | prompt is a lisp-expression that returns successive list-elements. | ||
| 629 | @item @code{resume:} | ||
| 630 | Ignored. Execution resumes here if the user quits during skeleton | ||
| 631 | interpretation. | ||
| 632 | @item @code{help} | ||
| 633 | Help form during interaction with the user or @code{nil}. | ||
| 634 | @item @code{input} | ||
| 635 | Initial input (a string or a cons with index) while reading the input. | ||
| 636 | @item @code{quit} | ||
| 637 | A constant which is non-@code{nil} when the @code{resume:} section was entered | ||
| 638 | because the user quit. | ||
| 639 | @end table | ||
| 640 | |||
| 641 | @findex skeleton-further-elements | ||
| 642 | Some modes also use other skeleton elements they themselves defined. For | ||
| 643 | example in shell script mode's skeletons you will find @code{<} which does a | ||
| 644 | rigid indentation backwards, or in CC mode's skeletons you find the | ||
| 645 | self-inserting elements @code{@{} and @code{@}}. These are defined by the | ||
| 646 | buffer-local variable @code{skeleton-further-elements} which is a list of | ||
| 647 | variables bound while interpreting a skeleton. | ||
| 648 | |||
| 649 | @findex define-skeleton | ||
| 650 | The macro @code{define-skeleton} defines a command for interpreting a | ||
| 651 | skeleton. The first argument is the command name, the second is a | ||
| 652 | documentation string, and the rest is an interactor and any number of skeleton | ||
| 653 | elements together forming a skeleton. This skeleton is assigned to a variable | ||
| 654 | of the same name as the command and can thus be overridden from your | ||
| 655 | @file{~/.emacs} file (@pxref{Init File,,, emacs, The GNU Emacs Manual}). | ||
| 656 | |||
| 657 | |||
| 659 | @node GNU Free Documentation License | 658 | @node GNU Free Documentation License |
| 660 | @appendix GNU Free Documentation License | 659 | @appendix GNU Free Documentation License |
| 661 | @include doclicense.texi | 660 | @include doclicense.texi |