From unknown Mon Jun 23 04:10:13 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#31243 <31243@debbugs.gnu.org> To: bug#31243 <31243@debbugs.gnu.org> Subject: Status: 26.1; kmacro-insert-counter increments incorrectly Reply-To: bug#31243 <31243@debbugs.gnu.org> Date: Mon, 23 Jun 2025 11:10:13 +0000 retitle 31243 26.1; kmacro-insert-counter increments incorrectly reassign 31243 emacs submitter 31243 Allen Li severity 31243 minor thanks From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 22 22:33:36 2018 Received: (at submit) by debbugs.gnu.org; 23 Apr 2018 02:33:36 +0000 Received: from localhost ([127.0.0.1]:36319 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fARIN-0006lo-Lr for submit@debbugs.gnu.org; Sun, 22 Apr 2018 22:33:35 -0400 Received: from eggs.gnu.org ([208.118.235.92]:56512) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fARIL-0006lZ-N0 for submit@debbugs.gnu.org; Sun, 22 Apr 2018 22:33:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fARIF-0005JH-IB for submit@debbugs.gnu.org; Sun, 22 Apr 2018 22:33:28 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:60481) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fARIF-0005JD-FC for submit@debbugs.gnu.org; Sun, 22 Apr 2018 22:33:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47457) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fARIE-00088N-5w for bug-gnu-emacs@gnu.org; Sun, 22 Apr 2018 22:33:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fARIB-0005Hk-2C for bug-gnu-emacs@gnu.org; Sun, 22 Apr 2018 22:33:26 -0400 Received: from mail-io0-x22b.google.com ([2607:f8b0:4001:c06::22b]:45158) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fARIA-0005HU-QL for bug-gnu-emacs@gnu.org; Sun, 22 Apr 2018 22:33:22 -0400 Received: by mail-io0-x22b.google.com with SMTP id r22-v6so7626022ioc.12 for ; Sun, 22 Apr 2018 19:33:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=felesatra-moe.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to; bh=vOxVf2KbuwQbongjFPZYnCTgmMWti2e475MmOIGXx/M=; b=mWErZZAxZsix1FLFU/FZRkmcpv3fmhVhtxmbYT785OxEeVt39mG3So9IK/Bvh5u5Xs x9Q22FTDnRTxHe5ySmhK4ds9VN7xJlSdNe2Xwg5RTiFKtY9Wl36/3TSHnKcRDuIy9tKR l/GftuJPqSYRELEWL7zGexqmjd+NcdTc4P2l+YA0bIzT42K9DMc4aIQdIpM9zZNRlx9Y jhaDQ63gfZfT8jGU7+j9nTVcZ6nM2onNxYyGgcyLQEUH22UmxKAzxyjggNhSaLjYQjCc B8PSOFUGMNo/kSG4bwTKZmAUYqOauM+TYJLKm92eQqbjZCNUNd59SYpZPmxTQKpEzKxz VU1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=vOxVf2KbuwQbongjFPZYnCTgmMWti2e475MmOIGXx/M=; b=tXGFFD12Yq2KGZ+bsahCxEJPWjCcPBrFDOWYouRUl2d/HJizQAXkyUavwD5ALn1VLt rHbCaAYaDIaX/ZA9e1b9rHa5GBGnUsvBXCRxkaiBOtfguWYOHGqgGlrfjxpC9MvuemPu ZeRmJJo67s4ErWPFACkY9NKiYcVCKnUflDcnZRFzaHPdtBNk6fy+PMQrB+C/9sF8t6zy k19u5pI0YFFfGuwV8BmBIsXdFO3GWow39QIQNDXHw4EBcyEHZwsmHeLPNwE2D6ZAoiId qOAbHQRLZvx4YXU//wWW3+uaGDHFwURzObsLDPfKggPvdN358KR4rOiWyuJprk1f4biY xfVw== X-Gm-Message-State: ALQs6tBr61XMXmPrPpK2Y0Jozc3J2LRYKRDfX/rN37kQBgMCxOJqeJ4g N8wwWDRc0pKfiGRxBMgllZVp8r5h9NQz/Xi/30dxaq8Uvlc= X-Google-Smtp-Source: AB8JxZqQJ3f1mleuEYfVJFRirtTG8GecIIsm5K52Jq+OW8DgCM0HeEcjTf82m3upjK2H5caKCJEoULwXJlNvyDi2ajo= X-Received: by 2002:a6b:9b15:: with SMTP id d21-v6mr21111200ioe.243.1524450801072; Sun, 22 Apr 2018 19:33:21 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.104.14 with HTTP; Sun, 22 Apr 2018 19:33:00 -0700 (PDT) X-Originating-IP: [107.182.230.239] From: Allen Li Date: Sun, 22 Apr 2018 19:33:00 -0700 Message-ID: Subject: 26.1; kmacro-insert-counter increments incorrectly To: bug-gnu-emacs@gnu.org Content-Type: text/plain; charset="UTF-8" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) 1. emacs -Q 2. Record a macro like so (starting with and ending with ): C-u ;; kmacro-start-macro-or-insert-counter SPC ;; self-insert-command ;; kmacro-start-macro-or-insert-counter RET ;; newline 3. Press multiple times. Expected: 0 0 1 1 2 2 3 3 4 4 5 5 6 6 Got: 0 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 In GNU Emacs 26.1 (build 3, x86_64-pc-linux-gnu, X toolkit, Xaw scroll bars) of 2018-04-20 built on cielnosurge Repository revision: 5de608f3edb54b4f8d9774e159d0fa99484d3ac8 Windowing system distributor 'The X.Org Foundation', version 11.0.11906000 Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Defining kbd macro... New macro counter value: 1 (1) Keyboard macro defined Configured using: 'configure --with-x-toolkit=lucid --with-xft --with-modules PKG_CONFIG_PATH=/usr/lib/imagemagick6/pkgconfig' Configured features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS LUCID X11 MODULES THREADS LIBSYSTEMD LCMS2 Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message rmc puny seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib dired dired-loaddefs format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg epg-config gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils kmacro elec-pair time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 95511 7642) (symbols 48 20449 1) (miscs 40 47 143) (strings 32 29187 1472) (string-bytes 1 757235) (vectors 16 14106) (vector-slots 8 493018 7522) (floats 8 52 158) (intervals 56 248 0) (buffers 992 11)) From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 22 22:41:11 2018 Received: (at 31243) by debbugs.gnu.org; 23 Apr 2018 02:41:11 +0000 Received: from localhost ([127.0.0.1]:36335 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fARPj-0006z7-3D for submit@debbugs.gnu.org; Sun, 22 Apr 2018 22:41:11 -0400 Received: from mail-io0-f173.google.com ([209.85.223.173]:39540) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fARPh-0006yu-J5 for 31243@debbugs.gnu.org; Sun, 22 Apr 2018 22:41:10 -0400 Received: by mail-io0-f173.google.com with SMTP id r9-v6so654586iod.6 for <31243@debbugs.gnu.org>; Sun, 22 Apr 2018 19:41:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=felesatra-moe.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to; bh=+FyFj0C9vshxrSoRcaxmXqWvyp0o/yzrM8yf8AsfBJA=; b=XDZhgeenCu1LIzZDwtdxiA0SH8awQ1/rhnNXS/nwooTc8lx3aL4vlYVRCVfa2DVBaw 1V5Z7yZ405+NSpIo6v/5tslJ3l9WdWKLGEQIJAIrGgYiZ6YrrvQPGEbaMuCuh++lx5XI FIEfFPRNWeFrhwM2yBAXm0pm+iRqzygGD4r9AgeNT4mMlYIn5FzNnLaRVR49cfeBEQRi +dedSbZVONBWXsEneqruGmn22nJwtec2k/4V5LRQyLhmxS0hEywmPwFKftaYJXtBmECp tAq3zBmwwVHRc27Id3bZpApBusXdcKZ8/9I82XMiEpyMRLbzoTaSeeoMfkfKhm1lvhj/ sHLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=+FyFj0C9vshxrSoRcaxmXqWvyp0o/yzrM8yf8AsfBJA=; b=V2FNg0Z702XYer7iaBUcriqVEt9xN4Sr9fEUsL6elf/pLjpNAoKNhmWy83ejvQeluy mQ+a0mlKbJ5chCwHI3blsDssxifHSFP9uMzFrh5Dsg8FMsBHUQsV25SfEEyhZUw24wEU yD8p9iJmn0lgsR5KoBV43ZwPur5n+ipKKhE0RJ803dVRvJzko9W0xpzkw2Kd6mAQPBUX Md4026TcLwOYAIFjM9bNwAC8PTmmgf1Pl7EifhICsMwoE1fbFIn5rOil7JoeiSGJ+BLU mLFJ86itlfGQ3saWgz0XtUiCbki6HK9lTFerZOTMIwpADSixTVVeICXibZ7QJWlZeIjE epYg== X-Gm-Message-State: ALQs6tDU3hbvy+0WAsihhKCT2grVBvfI3ka78H0yU1/ifvcd5ZLj5M5l 8njbP4ZoppAVA0FGNHQGsL6C5qmzRT2r2ztcymlE3CRN X-Google-Smtp-Source: AB8JxZr3Hcxp0WNWhrlZ1hUfVsQFgNu7pvnsCab66l7OIyioT6ytThlv4QtVYfzo6H3a0WMae3YfEKJrDx++bN7vrmM= X-Received: by 2002:a6b:9b15:: with SMTP id d21-v6mr21126159ioe.243.1524451263444; Sun, 22 Apr 2018 19:41:03 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.104.14 with HTTP; Sun, 22 Apr 2018 19:40:42 -0700 (PDT) X-Originating-IP: [107.182.230.239] From: Allen Li Date: Sun, 22 Apr 2018 19:40:42 -0700 Message-ID: Subject: [PATCH] Fix kmacro-insert-counter inserting the wrong counter To: 31243@debbugs.gnu.org Content-Type: multipart/mixed; boundary="00000000000009349b056a7af885" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 31243 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --00000000000009349b056a7af885 Content-Type: text/plain; charset="UTF-8" The fix is trivial so I fixed it. --00000000000009349b056a7af885 Content-Type: text/x-patch; charset="US-ASCII"; name="0001-Fix-kmacro-insert-counter-inserting-the-wrong-counte.patch" Content-Disposition: attachment; filename="0001-Fix-kmacro-insert-counter-inserting-the-wrong-counte.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_jgbmvtm80 RnJvbSAxMjU5ZjhiMzI1NjJlMzZkMjY0Y2E1MzBmOTdhYzYzZDhkNDE0MDlmIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBBbGxlbiBMaSA8ZGFya2ZlbGluZUBmZWxlc2F0cmEubW9lPgpE YXRlOiBTdW4sIDIyIEFwciAyMDE4IDE5OjM2OjU1IC0wNzAwClN1YmplY3Q6IFtQQVRDSF0gRml4 IGttYWNyby1pbnNlcnQtY291bnRlciBpbnNlcnRpbmcgdGhlIHdyb25nIGNvdW50ZXIKCiogbGlz cC9rbWFjcm8uZWwgKGttYWNyby1pbnNlcnQtY291bnRlcik6IEZpeCBjb3VudGVyIHVzZWQuCi0t LQogbGlzcC9rbWFjcm8uZWwgfCAyICstCiAxIGZpbGUgY2hhbmdlZCwgMSBpbnNlcnRpb24oKyks IDEgZGVsZXRpb24oLSkKCmRpZmYgLS1naXQgYS9saXNwL2ttYWNyby5lbCBiL2xpc3Ava21hY3Jv LmVsCmluZGV4IDg4NTVmYTVjMzEuLjM3NWE1ZTdmN2QgMTAwNjQ0Ci0tLSBhL2xpc3Ava21hY3Jv LmVsCisrKyBiL2xpc3Ava21hY3JvLmVsCkBAIC0yNjIsNyArMjYyLDcgQEAga21hY3JvLWluc2Vy dC1jb3VudGVyCiAgICAgICAoc2V0cSBrbWFjcm8tY291bnRlciBrbWFjcm8taW5pdGlhbC1jb3Vu dGVyLXZhbHVlCiAJICAgIGttYWNyby1pbml0aWFsLWNvdW50ZXItdmFsdWUgbmlsKSkKICAgKGlm IChhbmQgYXJnIChsaXN0cCBhcmcpKQotICAgICAgKGluc2VydCAoZm9ybWF0IGttYWNyby1jb3Vu dGVyLWZvcm1hdCBrbWFjcm8tbGFzdC1jb3VudGVyKSkKKyAgICAgIChpbnNlcnQgKGZvcm1hdCBr bWFjcm8tY291bnRlci1mb3JtYXQga21hY3JvLWNvdW50ZXIpKQogICAgIChpbnNlcnQgKGZvcm1h dCBrbWFjcm8tY291bnRlci1mb3JtYXQga21hY3JvLWNvdW50ZXIpKQogICAgIChrbWFjcm8tYWRk LWNvdW50ZXIgKHByZWZpeC1udW1lcmljLXZhbHVlIGFyZykpKSkKIAotLSAKMi4xNy4wCgo= --00000000000009349b056a7af885-- From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 23 00:56:51 2018 Received: (at 31243) by debbugs.gnu.org; 23 Apr 2018 04:56:51 +0000 Received: from localhost ([127.0.0.1]:36374 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fATX1-0001jw-9c for submit@debbugs.gnu.org; Mon, 23 Apr 2018 00:56:51 -0400 Received: from smtp-4.orcon.net.nz ([60.234.4.59]:34342) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fATWz-0001jn-9s for 31243@debbugs.gnu.org; Mon, 23 Apr 2018 00:56:49 -0400 Received: from [10.253.37.70] (port=47528 helo=webmail.orcon.net.nz) by smtp-4.orcon.net.nz with esmtpa (Exim 4.86_2) (envelope-from ) id 1fATWw-0002ID-Lm; Mon, 23 Apr 2018 16:56:46 +1200 Received: from wlgwil-nat-office.catalyst.net.nz ([202.78.240.7]) via [10.253.37.253] by webmail.orcon.net.nz with HTTP (HTTP/1.1 POST); Mon, 23 Apr 2018 16:56:46 +1200 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 23 Apr 2018 16:56:46 +1200 From: Phil Sainty To: Allen Li Subject: Re: bug#31243: 26.1; kmacro-insert-counter increments incorrectly In-Reply-To: References: Message-ID: X-Sender: psainty@orcon.net.nz User-Agent: Orcon Webmail X-GeoIP: -- X-Spam_score: -2.9 X-Spam_score_int: -28 X-Spam_bar: -- X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 31243 Cc: 31243@debbugs.gnu.org, bug-gnu-emacs X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Not a bug? I believe your expectations are incorrect. > C-u ;; kmacro-start-macro-or-insert-counter This insert the *previous* macro counter. Which is sort of "undefined" for the first iteration, but zero in practice. => 0 > ;; kmacro-start-macro-or-insert-counter Insert the current macro counter (which is also zero, because inserting the previous counter does not touch the current counter). => 0 Then the counter is incremented -- so the current counter is set to 1, and the previous counter is set to 0. Hence when you trigger the next iteration, you insert 0 and 1; etc... From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 23 03:58:28 2018 Received: (at 31243) by debbugs.gnu.org; 23 Apr 2018 07:58:28 +0000 Received: from localhost ([127.0.0.1]:36452 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fAWMm-00069f-4O for submit@debbugs.gnu.org; Mon, 23 Apr 2018 03:58:28 -0400 Received: from mail-it0-f43.google.com ([209.85.214.43]:54168) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fAWMl-00069R-4p for 31243@debbugs.gnu.org; Mon, 23 Apr 2018 03:58:27 -0400 Received: by mail-it0-f43.google.com with SMTP id m134-v6so9781510itb.3 for <31243@debbugs.gnu.org>; Mon, 23 Apr 2018 00:58:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=felesatra-moe.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=p1s0dN8E+WCtK3nID5w0iHG1aV4pyUFwB/O4UxxYwHc=; b=MlDSx2vbYM+RGBi3LfT+vaiLjWxLXRU38KHlMZp5cfuD1KCsQqMRKI+FLottnYugD1 gOAh9GM0Pg6b24fNrjzWYR4mApznpLYmvptojcdwEhtEX+o7Se9ouSWKkwrFj3Yx6KIn hdYtT2yJoZ2TyzXbulQYLxXS953j+/ID21Yaw6DGwV8ccWmLK469aIwPhG+opUX4EQjW fExI05BGMzUtd+sFdr1bB2WYLUu1XHFO8q7b54mltIL+r+RxYFxI4Q24EuuclUffh3+0 Oyt33yczVVwFWlUfAwZjYM2qwOLj3lw4YmfhW7XtzrAiWd/2Q+F9x1emtus7no+yvtuJ Gjag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=p1s0dN8E+WCtK3nID5w0iHG1aV4pyUFwB/O4UxxYwHc=; b=Ik5FzQvug0K2F4IZp7/rJkebvuDSqHRT4hxJUfCADX7hH4MOKUUlDUgpXiOPfOerJA eIWL+wOyWMkHTY7HE00fdUe5eCV13MQIxSXq6K5J7DDRjRSC+BkeRqWx/clYNJ826Cey Lj7cdLXlqLUL7Dcm3qBZJ+UcCBLlkrBs10Y8q88jfEKCdOcSHxY3YVEbiLR7VBvMtO+m XjKOK4hvVUfIxqhH6JyoRNYgARgBYR40PXc11TgyGCRsb/qRba6Q9gToXSalimURNQ2n qCsiNTNZ7sor3YkmVpBuUTOpoFQS/qcX6hy33bqNrxgtuH0+1zcnb12qgnGJ8NE+j33H veuQ== X-Gm-Message-State: ALQs6tDUybwRyVjfNPJMVl30C00+dTjqvYJtP0O7oijfjcmpl5ZIikEQ Ld0uBDy5UtK7eEqJn+NDtkJ8JbbA4WJNnuA4QTAVcg== X-Google-Smtp-Source: AB8JxZqLrfvotEm+ElM7JGSlH2Aou/sOfACd4NjVNH0X0o+KltHCoVyggCYaAbLTk4JYbDI4nSDcbNmTnhbXLHcy6f4= X-Received: by 2002:a24:21ca:: with SMTP id e193-v6mr10598910ita.108.1524470301375; Mon, 23 Apr 2018 00:58:21 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.104.14 with HTTP; Mon, 23 Apr 2018 00:58:00 -0700 (PDT) X-Originating-IP: [107.182.230.239] In-Reply-To: References: From: Allen Li Date: Mon, 23 Apr 2018 00:58:00 -0700 Message-ID: Subject: Re: bug#31243: 26.1; kmacro-insert-counter increments incorrectly To: Phil Sainty Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 31243 Cc: 31243@debbugs.gnu.org, bug-gnu-emacs X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Sun, Apr 22, 2018 at 9:56 PM, Phil Sainty wrote: > Not a bug? I believe your expectations are incorrect. > >> C-u ;; kmacro-start-macro-or-insert-counter > > > This insert the *previous* macro counter. Which is sort of "undefined" f= or > the first iteration, but zero in practice. Ah, I see. I guess what I'm looking for is C-u 0 (or alternatively C-u the second time rather than the first time). I don't think the documentaton is very clear, because the meaning of "previous" is ambiguous: With C-u, inserts previous =E2=80=98kmacro-counter=E2=80=99 (but do not mod= ify counter). I interpreted this to mean "Insert the counter that was used last time" (which is redundant since there's only one counter), rather than "Insert the value of the counter before the last time the counter was changed". The fact that the previous value of the counter is saved is mentioned nowhere except implicitly implied by this single word in the documentation. I think the The Keyboard Macro Counter page should have a standalone paragraph explaining this, such as: Whenever the value of `kmacro-counter' is modified (by `kmacro-insert-counter', `kmacro-set-counter' or `kmacro-add-counter'), the previous value of the counter is saved in `kmacro-last-counter'. This value can be inserted by C-u or C-u C-x C-k C-i. And a similar addendum in the docstrings. > > =3D> 0 > >> ;; kmacro-start-macro-or-insert-counter > > > Insert the current macro counter (which is also zero, because inserting t= he > previous counter does not touch the current counter). > > =3D> 0 > > Then the counter is incremented -- so the current counter is set to 1, an= d > the previous counter is set to 0. > > Hence when you trigger the next iteration, you insert 0 and 1; etc... > > From debbugs-submit-bounces@debbugs.gnu.org Fri May 11 05:16:30 2018 Received: (at 31243-done) by debbugs.gnu.org; 11 May 2018 09:16:30 +0000 Received: from localhost ([127.0.0.1]:57114 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fH4AA-0005lM-3c for submit@debbugs.gnu.org; Fri, 11 May 2018 05:16:30 -0400 Received: from eggs.gnu.org ([208.118.235.92]:60992) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fH4A7-0005l8-4i for 31243-done@debbugs.gnu.org; Fri, 11 May 2018 05:16:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fH49x-0005Xn-Vb for 31243-done@debbugs.gnu.org; Fri, 11 May 2018 05:16:21 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:50461) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fH49x-0005Xj-TS; Fri, 11 May 2018 05:16:17 -0400 Received: from [176.228.60.248] (port=2045 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fH49x-0000G6-B0; Fri, 11 May 2018 05:16:17 -0400 Date: Fri, 11 May 2018 12:16:14 +0300 Message-Id: <83wowao8m9.fsf@gnu.org> From: Eli Zaretskii To: Allen Li In-reply-to: (message from Allen Li on Mon, 23 Apr 2018 00:58:00 -0700) Subject: Re: bug#31243: 26.1; kmacro-insert-counter increments incorrectly References: MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 31243-done Cc: psainty@orcon.net.nz, 31243-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) > From: Allen Li > Date: Mon, 23 Apr 2018 00:58:00 -0700 > Cc: 31243@debbugs.gnu.org, > bug-gnu-emacs > > On Sun, Apr 22, 2018 at 9:56 PM, Phil Sainty wrote: > > Not a bug? I believe your expectations are incorrect. > > > >> C-u ;; kmacro-start-macro-or-insert-counter > > > > > > This insert the *previous* macro counter. Which is sort of "undefined" for > > the first iteration, but zero in practice. > > Ah, I see. I guess what I'm looking for is C-u 0 (or > alternatively C-u the second time rather than the first time). > > I don't think the documentaton is very clear, because the meaning of > "previous" is ambiguous: > > With C-u, inserts previous ‘kmacro-counter’ (but do not modify counter). Indeed, the doc string could use an improvement, and in particular, using "previous" was misleading. I've now clarified the doc strings, and made a point of using "current value" in all places, instead ofg sometimes using "previous". One comment about what's been said by Phil: > >> C-u ;; kmacro-start-macro-or-insert-counter > > > > > > This insert the *previous* macro counter. Which is sort of "undefined" for > > the first iteration, but zero in practice. Actually, the value of the counter is documented to be initialized to zero before defining the macro, so it's non "undefined" at this stage. Thanks, I'm closing the bug report. From unknown Mon Jun 23 04:10:13 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 08 Jun 2018 11:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator