# execute-string(2)

[Home] [Commands] [Variables] [Macro-Dev] [Glossary]

## NAME

execute-string - Execute a string as a command

## SYNOPSIS

n execute-string "string"

## DESCRIPTION

execute-string executes the given string n times as if it is being typed. This is the writable format of a keyboard macro, it can be placed in any emf file. Any characters may form the string (unprintables as `\xXX`) and key-strokes that are bound to a command will execute that command. This command is used by macros to store user defined keyboard macros.

## EXAMPLE

The following example uses keyboard strokes with execute-string in a macro to format nroff(1) text located between `.` commands:

    define-macro nroff-para
        beginning-of-line
        !if &not &sequal @wc "."
            1 buffer-mode "magic"
            execute-string "\CXS^\\.\CM\CB\CM\CX\CH\CN\CM"
            -1 fill-paragraph
            execute-string "\CD\CX\CH\CN\CD\CXH\CB"
        !endif
        forward-line
    !emacro

execute-string has the advantage that execution is very fast as the amount of parsing and decoding to be performed is limited. The disadvantage is that you cannot quickly discern which operations are being performed !!

## NOTES

Try to avoid using named key, such as "`up`" and "`return`", as the keyboard macro equivalent is not readable and is likely to change in future releases.

For this reason the following special abbreviations may be used

\E

The "escape" key.

\N

The "return" key.

\T

The "tab" key.

\b

The backspace character (0x08).

\d

The delete character (0x7f).

\e

The escape character (0x1b).

\f

The form-feed character (0x0c).

\n

The carriage-return character (0x0a).

\r

The line-feed character (0x0d).

## SEE ALSO

buffer-abbrev-file(2), global-abbrev-file(2), insert-macro(2), name-kbd-macro(2), start-kbd-macro(2).

(c) Copyright JASSPA 2009
Last Modified: 2009/08/29
Generated On: 2009/10/12

</HMTL>