[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 3e99077 3/3: Merge from origin/emacs-26
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] master 3e99077 3/3: Merge from origin/emacs-26 |
Date: |
Fri, 1 Feb 2019 11:42:53 -0500 (EST) |
branch: master
commit 3e99077ab39fac1ab1f3794b211f2c0c480c6e6e
Merge: b80e330 6c6b540
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>
Merge from origin/emacs-26
6c6b540711 Correct the docs of inserting kmacro counter
32555daf4c * doc/misc/calc.texi (Algebraic Tutorial): Fix a typo. (B...
---
doc/emacs/kmacro.texi | 19 +++++++++++++------
doc/misc/calc.texi | 2 +-
lisp/kmacro.el | 12 ++++++++----
3 files changed, 22 insertions(+), 11 deletions(-)
diff --git a/doc/emacs/kmacro.texi b/doc/emacs/kmacro.texi
index a7d849a..65387ae 100644
--- a/doc/emacs/kmacro.texi
+++ b/doc/emacs/kmacro.texi
@@ -241,10 +241,17 @@ determined by the customizable variable
@code{kmacro-ring-max}.
@section The Keyboard Macro Counter
Each keyboard macro has an associated counter, which is initialized
-to 0 when you start defining the macro. This counter allows you to
-insert a number into the buffer that depends on the number of times
-the macro has been called. The counter is incremented each time its
-value is inserted into the buffer.
+to 0 when you start defining the macro. This @dfn{current counter}
+allows you to insert a number into the buffer that depends on the
+number of times the macro has been called. The counter is normally
+incremented each time its value is inserted into the buffer.
+
+In addition to the current counter, keyboard macros also maintain the
address@hidden counter}, which records the value the current counter
+had last time it was incremented or set. Note that incrementing the
+current counter by zero, e.g., with @address@hidden 0 C-x C-k C-i}}, also
+records the value of the current counter as the previous counter
+value.
@table @kbd
@item @key{F3}
@@ -270,8 +277,8 @@ value of the keyboard macro's counter into the buffer, and
increments
the counter by 1. (If you are not defining a macro, @key{F3} begins a
macro definition instead. @xref{Basic Keyboard Macro}.) You can use
a numeric prefix argument to specify a different increment. If you
-just specify a @kbd{C-u} prefix, that is the same as an increment of
-zero: it inserts the current counter value without changing it.
+just specify a @kbd{C-u} prefix, that inserts the previous counter
+value, and doesn't change the current value.
As an example, let us show how the keyboard macro counter can be
used to build a numbered list. Consider the following key sequence:
diff --git a/doc/misc/calc.texi b/doc/misc/calc.texi
index 1981988..5c5ef59 100644
--- a/doc/misc/calc.texi
+++ b/doc/misc/calc.texi
@@ -2026,7 +2026,7 @@ You can also ``unstore'' a variable when you are through
with it:
@smallexample
@group
-2: 2 + 5 => 5
+2: 2 + 3 => 5
1: 2 a + 2 b => 2 a + 2 b
.
diff --git a/lisp/kmacro.el b/lisp/kmacro.el
index 701437f..fc34e16 100644
--- a/lisp/kmacro.el
+++ b/lisp/kmacro.el
@@ -256,7 +256,10 @@ Can be set directly via `kmacro-set-format', which see.")
(defun kmacro-insert-counter (arg)
"Insert current value of `kmacro-counter', then increment it by ARG.
Interactively, ARG defaults to 1. With \\[universal-argument], insert
-current value of `kmacro-counter', but do not increment it."
+the previous value of `kmacro-counter', and do not increment the
+current value.
+The previous value of the counter is the one it had before
+the last increment."
(interactive "P")
(if kmacro-initial-counter-value
(setq kmacro-counter kmacro-initial-counter-value
@@ -685,9 +688,10 @@ the current value of `kmacro-counter').
When used during defining/executing a macro, inserts the current value
of `kmacro-counter' and increments the counter value by ARG (or by 1 if no
-prefix argument). With just \\[universal-argument], inserts the current value
-of `kmacro-counter', but does not modify the counter; this is the
-same as incrementing the counter by zero.
+prefix argument). With just \\[universal-argument], inserts the previous
+value of `kmacro-counter', and does not modify the counter; this is
+different from incrementing the counter by zero. (The previous value
+of the counter is the one it had before the last increment.)
The macro counter can be set directly via \\[kmacro-set-counter] and
\\[kmacro-add-counter].
The format of the inserted value of the counter can be controlled