Title: Theory / Unimportant / CS / Softw / Emacs / 14 Macros;
Tags: hasNotNewEffectReturnsMeaning FromInstruction computer_to_instruction fromCommand récupéré seen_description FromVariables

Instruction: kmacro-start-macro-or-insert-counter
Page: 121
Effect: Start defining a keyboard macro
Chapter: 14
Abbreviation: F3

Instruction: kmacro-end-or-call-macro
Page: 121
Effect: If a keyboard macro is being defined, end the definition; otherwise, execute the most recent keyboard macro
Chapter: 14
Abbreviation: F4

Page: 121
Effect: Re-execute last keyboard macro, then append keys to its definition.
Chapter: 14
Abbreviation: C-u F3

Page: 121
Effect: Append keys to the last keyboard macro without re-executing it.
Chapter: 14
Abbreviation: C-u C-u F3

Instruction: apply-macro-to-region-lines
Page: 121
Effect: Run the last keyboard macro on each line that begins in the region
Chapter: 14
Abbreviation: r
Where to use it: macro mode

Page: 122
Effect: Abort macro definition
Chapter: 14
Section: 1
Variables: During a macro definition
Abbreviation: C-g

Name: keyboard macro ring
Definition: The list of macros previously defined in this section
Page: 122
Chapter: 14
Section: 2

Instruction: kmacro-end-or-call-macro-repeat
Page: 123
Effect: Execute the keyboard macro at the head of the ring and remains in macro «mode»
Chapter: 14
Section: 2
Abbreviation: C-k
Where to use it: macro «mode»

Instruction: kmacro-cycle-ring-next
Page: 123
Effect: Rotate the keyboard macro ring to the next macro (defined earlier) and remains in macro «mode»
Chapter: 14
Section: 2
Abbreviation: C-n
Where to use it: macro «mode»

Instruction: kmacro-cycle-ring-previous
Page: 123
Effect: Rotate the keyboard macro ring to the previous macro (defined later) and remains in macro «mode»
Chapter: 14
Section: 2
Abbreviation: C-p
Where to use it: Macro «mode»

Page: 123
Effect: Entering macro «mode»
Chapter: 14
Section: 2
Abbreviation: C-x C-k

Instruction: Any key appart from the ones defined from this mode
Page: 123
Effect: leaving macro «mode» and execute this key
Chapter: 14
Section: 2
Where to use it: In macro «mode»

Variable: kmacro-ring-max
Meaning: Maximum number of macros stored
Page: 123
Section: 2
Chapter: 14

Variable: keyboard
Meaning: A number associating to each macro. By default 1 and incremented on each call of C-i.
Page: 123
Section: 3
Chapter: 14
Typ: macro counter

Instruction: kmacro-start-macro-or-insert-counter
Page: 123
Effect: insert the keyboard macro counter value in the buffer
Chapter: 14
Section: 3
Abbreviation: F3
Where to use it: In keyboard macro definition

Instruction: kmacro-insert-counter
Page: 123
Effect: Insert the keyboard macro counter value in the buffer and increment it. Initialize it to 1 if it is not defined
Chapter: 14
Section: 3
Abbreviation: C-i
Where to use it: Macro «mode»

Instruction: kmacro-set-counter
Page: 124
Effect: Set the keyboard macro counter
Chapter: 14
Section: 3
Abbreviation: C-c
Where to use it: Macro «mode»

Instruction: kmacro-add-counter
Page: 124
Effect: Add the prefix arg to the keyboard macro counter
Chapter: 14
Section: 3
Abbreviation: C-a
Where to use it: Macro «mode»

Instruction: kmacro-set-format
Page: 124
Effect: Specify the format for inserting the keyboard macro counter. Concerns the currently defined macro, if it exists, or the ones defined later otherwise.
Chapter: 14
Section: 3
Abbreviation: C-f
Where to use it: Macro «mode»

Instruction: kbd-macro-query
Page: 125
Effect: When this point is reached during macro execution, ask for confirmation
Chapter: 14
Section: 4
Abbreviation: C-x q
Where to use it: During macro definition

Instruction: kmacro-name-last-macro
Page: 125
Effect: Give a command name to the most recently defined keyboard macro
Chapter: 14
Section: 5
Abbreviation: n
Where to use it: macro «mode»

Instruction: kmacro-bind-to-key x
Page: 125
Effect: Bind the most recently defined keyboard macro to a key sequence
Chapter: 14
Section: 5
Variables: x either a digit or an upper case leter
or an arbitrary key sequence
Abbreviation: b x
Where to use it: macro «mode»

Instruction: insert-kbd-macro
Page: 125
Effect: Insert in the buffer a keyboard macro’s definition, as Lisp code.
Chapter: 14
Section: 5

Page: 126
Effect: Calls the macro whose keyboard macro is x
Chapter: 14
Section: 5
Variables: x being a digit or an upper case letter
Abbreviation: x
Where to use it: macro «mode»

Instruction: kmacro-edit-macro
Page: 126
Effect: Edit the last defined keyboard macro
Chapter: 14
Section: 6
Abbreviation: C-e
Where to use it: macro «mode»

Instruction: edit-kbd-macro
Page: 126
Effect: Edit a previously defined macro name
Chapter: 14
Section: 6
Abbreviation: e name RET
Where to use it: macro «mode»

Instruction: kmacro-edit-lossage
Page: 126
Effect: Edit the last 300 keystrokes as a keyboard macro
Chapter: 14
Section: 6
Abbreviation: l
Where to use it: macro «mode»

Instruction: -step-edit-macro
Page: 127
Effect: Enter a mode to edit the last macro
Chapter: 14
Section: 7
Abbreviation: SPC
Where to use it: macro «mode»

Page: 127
Effect: ignored
Chapter: 14
Section: 7
Abbreviation: It was
Name: Edit mode

Instruction: kmacro-set-format
Effect: !Set macro counter FORMAT.
Context: macro mode
Abbreviation: C-f

Instruction: kmacro-end-or-call-macro-repeat
Effect: As `kmacro-end-or-call-macro' but allows repeat without repeating prefix.
Abbreviation: C-k
Where to use it: macro mode

Instruction: kmacro-call-ring-2nd-repeat
Effect: Execute second keyboard macro in macro ring.
This is like `kmacro-call-ring-2nd', but allows repeating macro commands
without repeating the prefix.
Context: emacs macro mode
Abbreviation: C-l

Instruction: kmacro-edit-macro
Effect: !As edit last keyboard macro, but without kmacro-repeat property.
Context: emacs macro mode
Abbreviation: RET

Instruction: kmacro-cycle-ring-next
Effect: Move to next keyboard macro in keyboard macro ring.
Displays the selected macro in the echo area.
The ARG parameter is unused.
Context: emacs macro mode
Abbreviation: C-n

Instruction: kmacro-swap-ring
Effect: Swap first two elements on keyboard macro ring.
Abbreviation: C-t
Where to use it: Macro mode

Instruction: kmacro-view-macro-repeat
Effect: Display the last keyboard macro.
If repeated, it shows previous elements in the macro ring.
To execute the displayed macro ring item without changing the macro ring, just enter C-k. This is like `kmacro-view-macro', but allows repeating macro commands without repeating the prefix.
Context: emacs macro mode
Abbreviation: C-v

Instruction: kmacro-step-edit-macro
Effect: Step edit and execute last keyboard macro.
To customize possible responses, change the "bindings" in `kmacro-step-edit-map'.
Context: macro «mode»
Abbreviation: SPC

Instruction: kmacro-bind-to-key
Effect: When not defining or executing a macro, offer to bind last macro to a key. The key sequences [C-x C-k 0] through [C-x C-k 9] and [C-x C-k A] through [C-x C-k Z] are reserved for user bindings, and to bind to one of these sequences, just enter the digit or letter, rather than the whole sequence.
You can bind to any valid key sequence, but if you try to bind to a key with an existing command binding, you will be asked for confirmation whether to replace that binding. Note that the binding is made in the `global-map' keymap, so the macro binding may be shaded by a local key binding. The ARG parameter is unused.
Context: emacs macro mode
Abbreviation: b

Instruction: edit-kbd-macro
Effect: Edit a keyboard macro.
At the prompt, type any key sequence which is bound to a keyboard macro.
Or, type `C-x e' or RET to edit the last keyboard macro, `C-h l' to edit the last 300 keystrokes as a keyboard macro, or `M-x' to edit a macro by its command name.
With a prefix argument, format the macro in a more concise way.
Context: emacs macro mode
Abbreviation: e

Instruction: kmacro-edit-lossage
Effect: !Edit most recent 300 keystrokes as a keyboard macro.
Context: emacs macro mode
Abbreviation: l

Instruction: kmacro-name-last-macro
Effect: Assign a name to the last keyboard macro defined.
Argument SYMBOL is the name to define.
The symbol's function definition becomes the keyboard macro string.
Such a "function" cannot be called from Lisp, but it is a valid editor command.
Context: emacs macro mode
Abbreviation: n

Instruction: kbd-macro-query
Effect: Query user during kbd macro execution.
With prefix argument, enters recursive edit, reading keyboard
commands even within a kbd macro. You can give different commands
each time the macro executes.
Without prefix argument, asks whether to continue running the macro.
Your options are:
Y
Context: C-x C-k q
Abbreviation: Stop the macro entirely right now.
C-l
Typ: Enter recursive edit; ask again when you exit from that.
Name: Finish this iteration normally and continue with the next.
N
Library: Redisplay the screen, then ask again.
C-r
Example: Skip the rest of this iteration, and start the next.
RET

Instruction: apply-macro-to-region-lines
Effect: Apply last keyboard macro to all lines in the region.
Context: emacs macro mode
Abbreviation: r
Extra: For each line that begins in the region, move to the beginning of
the line, and run the last keyboard macro.
When called from lisp, this function takes two arguments TOP and
BOTTOM, describing the current region. TOP must be before BOTTOM.
The optional third argument MACRO specifies a keyboard macro to
execute.
This is useful for quoting or unquoting included text, adding and
removing comments, or producing tables where the entries are regular.
For example, in Usenet articles, sections of text quoted from another
author are indented, or have each line start with `>'. To quote a
section of text, define a keyboard macro which inserts `>', put point
and mark at opposite ends of the quoted section, and use
`C-x C-k r' to mark the entire section.
Suppose you wanted to build a keyword table in C where each entry
looked like this:
{ "foo", foo_data, foo_function },
{ "bar", bar_data, bar_function },
{ "baz", baz_data, baz_function },
You could enter the names in this format:
foo
bar
baz
and write a macro to massage a word into a table entry:
\C-x (
\M-d { "\C-y", \C-y_data, \C-y_function },
\C-x )
and then select the region of un-tablified names and use
`C-x C-k r' to build the table from the names.

Instruction: kmacro-start-macro
Effect: Record subsequent keyboard input, defining a keyboard macro.
The commands are recorded even as they are executed.
Use C-x ) to finish recording and make the macro available.
Use C-x e to execute the macro.
Non-nil arg (prefix arg) means append to last macro defined.
With C-u prefix, append to last keyboard macro
defined. Depending on `kmacro-execute-before-append', this may begin
by re-executing the last macro as if you typed it again.
Otherwise, it sets `kmacro-counter' to ARG or 0 if missing before
defining the macro.
Use C-x C-k TAB to insert (and increment) the macro counter.
The counter value can be set or modified via C-x C-k C-c and C-x C-k C-a.
The format of the counter can be modified via C-x C-k C-f.
Use C-x C-k n to give it a permanent name.
Use C-x C-k b to bind it to a key sequence.
Context: emacs macro mode
Abbreviation: s
Where to use it: Macro mode

Instruction: kmacro-to-register
Effect: Store the last keyboard macro in register R.
Interactively, reads the register using `register-read-with-preview'.
Context: emacs macro mode
Abbreviation: x

Instruction: kmacro-edit-macro-repeat
Effect: Edit last keyboard macro.
Abbreviation: C-e
Where to use it: macro mode

Instruction: kmacro-insert-counter
Effect: Insert macro counter, then increment it by ARG.
Interactively, ARG defaults to 1. With C-u, insert
previous `kmacro-counter', and do not modify counter.
Abbreviation: TAB
Where to use it: macro mode