From unknown Sat Jun 21 03:20:56 2025 X-Loop: help-debbugs@gnu.org Subject: bug#71277: 30.0.50; last-prefix-arg lost when universal-argument used Resent-From: Sean Whitton Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 30 May 2024 11:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 71277 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 71277@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.171706967818813 (code B ref -1); Thu, 30 May 2024 11:48:02 +0000 Received: (at submit) by debbugs.gnu.org; 30 May 2024 11:47:58 +0000 Received: from localhost ([127.0.0.1]:59545 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sCeGB-0004tE-GX for submit@debbugs.gnu.org; Thu, 30 May 2024 07:47:58 -0400 Received: from lists.gnu.org ([209.51.188.17]:44428) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sCeG7-0004sz-DY for submit@debbugs.gnu.org; Thu, 30 May 2024 07:47:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sCeFv-0007ZF-Vt for bug-gnu-emacs@gnu.org; Thu, 30 May 2024 07:47:40 -0400 Received: from sendmail.purelymail.com ([34.202.193.197]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sCeFs-0007ND-Qs for bug-gnu-emacs@gnu.org; Thu, 30 May 2024 07:47:39 -0400 DKIM-Signature: a=rsa-sha256; b=VSZ4t5Dtxv7Eo6ILRvM0iSpceUIdS+yfMVxz69un8cd8P9q3BReiL7OKlb0VBug6/nZk0drHBnTnl+HVXZZdMkgHuDZbWTtr+NpNnPvl69Gsf4aP4gQp/Kf1q1b3O2OjRkMAac3LGySltSLMv59QwKTCC019JtGS+J8CZu4Q1qYoFSuDIEgUOzahjYP+X4xV+TYOiQnGOIQMQ/H62vXjvz7uxyUnu1B+QgUZbCka/TUb6aJR39+KHheT1H8X4nZyw69PoS5yYnDnhSd/9jrOchaDkrZPJuxxyPqmKZ47zSTroswUka1LjB5jb05aVjMZdEEYjI4jEl96AQmv9AoBNA==; s=purelymail2; d=spwhitton.name; v=1; bh=qcszerElfpaMwPk1+wleySGKWh2h6LoavYEk5yr0IhU=; h=Received:Received:From:To:Subject:Date; DKIM-Signature: a=rsa-sha256; b=WakeBFMynY5P2zuhloT+9FAUZI9xySosZB3O/rwjpb4Ax9sE2rulxiT4mZbskh/xu+tl3HTceb/jVNtWqbmFyrTXO657z3x0Sk91ixeAyOEdRdYxeJS+GNYZ8l4bWkc4sa3eEvIVonjAxhqFqmwMRYLvumS1rFvhMaKc1bSuelxnSSd1q9B+D8U3a0sEiV1oPUR4IMN02iDfQEq9KpNgAi0pinCcW9UMWm2Q1s6iK3RV1O+2+qITlLblp23zF0pQnWhLUD4pqsyjUq/313o+E2Xqs8Qeegl05tcJkOV6c+c+2dMnbDfH5wm6Imm7xRu40jCuzy+f+8MOkU26YwT6xw==; s=purelymail2; d=purelymail.com; v=1; bh=qcszerElfpaMwPk1+wleySGKWh2h6LoavYEk5yr0IhU=; h=Feedback-ID:Received:Received:From:To:Subject:Date; Feedback-ID: 20115:3760:null:purelymail X-Pm-Original-To: bug-gnu-emacs@gnu.org Received: by smtp.purelymail.com (Purelymail SMTP) with ESMTPSA id -1370277545 for (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Thu, 30 May 2024 11:47:30 +0000 (UTC) Received: by zephyr.silentflame.com (Postfix, from userid 1000) id 8EC8C9485FE; Thu, 30 May 2024 12:47:29 +0100 (BST) From: Sean Whitton Date: Thu, 30 May 2024 12:47:29 +0100 Message-ID: <87bk4nv7vy.fsf@zephyr.silentflame.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=34.202.193.197; envelope-from=spwhitton@spwhitton.name; helo=sendmail.purelymail.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) 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: -2.3 (--) Hello, Consider (defun counter () (interactive) (when (eq last-command this-command) (setq current-prefix-arg (+ (prefix-numeric-value current-prefix-arg) (prefix-numeric-value last-prefix-arg)))) (message "%s!" (prefix-numeric-value current-prefix-arg))) (global-set-key "\M-." #'counter) If you type M-. M-. M-. then you see "3!" as expected. Similarly if you type "C-u M-. M-. M-." then you see "6!". However, if you type "M-. M-. C-u M-." then you get "5!". Unlses something is wrong with my arithmetic, this is not correct. You should get "6!" after the third example too. The use of C-u clobbers last-prefix-arg, basically. I believe this will fix it: -- >8 -- Subject: [PATCH] universal-argument--preserve: Preserve last-prefix-arg * lisp/simple.el (universal-argument--preserve): Set current-prefix-arg to last-prefix-arg in order to preserve last-prefix-arg, too. --- lisp/simple.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/simple.el b/lisp/simple.el index 44197c3189a..76fb81c9df5 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -5414,7 +5414,8 @@ universal-argument--description (add-hook 'prefix-command-preserve-state-hook #'universal-argument--preserve) (defun universal-argument--preserve () - (setq prefix-arg current-prefix-arg)) + (setq prefix-arg current-prefix-arg) + (setq current-prefix-arg last-prefix-arg)) (defvar universal-argument-map (let ((map (make-sparse-keymap)) -- Sean Whitton From unknown Sat Jun 21 03:20:56 2025 X-Loop: help-debbugs@gnu.org Subject: bug#71277: 30.0.50; last-prefix-arg lost when universal-argument used Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 30 May 2024 12:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71277 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Sean Whitton , Stefan Monnier Cc: 71277@debbugs.gnu.org Received: via spool by 71277-submit@debbugs.gnu.org id=B71277.171707130523904 (code B ref 71277); Thu, 30 May 2024 12:16:02 +0000 Received: (at 71277) by debbugs.gnu.org; 30 May 2024 12:15:05 +0000 Received: from localhost ([127.0.0.1]:60715 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sCegS-0006DS-PL for submit@debbugs.gnu.org; Thu, 30 May 2024 08:15:05 -0400 Received: from eggs.gnu.org ([209.51.188.92]:57948) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sCegQ-0006CO-Jr for 71277@debbugs.gnu.org; Thu, 30 May 2024 08:15:03 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sCegA-0004Tt-4n; Thu, 30 May 2024 08:14:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=nE53eBsISKNHeu6ItMs8r/CkiI11m1pkeXoNzOI8Tu8=; b=H82SN3h0zjTX b2bT9244SgGvPfaEUFaCi+zvwOYuvK4/RM2xn4BAxT8wpxDKLvcYSmWRNxcAbibljnuv0JmYz1k5x Bl0snaRmVvDzzWIKoVI3Ouxt/Xi4H8qR3zN5yGC3xtZn5Y/H0Csu1GY4DJklMdnECea4YPhUgeLyq cqoXF6JKleN4GBoI/XkB6nTsFmgVRDg5Dbsz9jHQUQF22xMGzl8llTkZfSrzimP/gcz61iz9YFWHE XQTxpZIpCWPhl4YiEMJ9Kzn3QI/24Bd1citFNt85qaH/CFWkQXyLP7KV9uiB4Q2ZT8Vn1e2LXMlEM VdojmuQMB8hqGugaQeN+Cg==; Date: Thu, 30 May 2024 15:14:26 +0300 Message-Id: <86ikyvqyxp.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <87bk4nv7vy.fsf@zephyr.silentflame.com> (bug-gnu-emacs@gnu.org) References: <87bk4nv7vy.fsf@zephyr.silentflame.com> X-Spam-Score: -2.3 (--) 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: -3.3 (---) > Date: Thu, 30 May 2024 12:47:29 +0100 > From: Sean Whitton via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" > > (defun counter () > (interactive) > (when (eq last-command this-command) > (setq current-prefix-arg > (+ (prefix-numeric-value current-prefix-arg) > (prefix-numeric-value last-prefix-arg)))) > (message "%s!" (prefix-numeric-value current-prefix-arg))) > (global-set-key "\M-." #'counter) > > If you type M-. M-. M-. then you see "3!" as expected. > > Similarly if you type "C-u M-. M-. M-." then you see "6!". > > However, if you type "M-. M-. C-u M-." then you get "5!". > > Unlses something is wrong with my arithmetic, this is not correct. > You should get "6!" after the third example too. > The use of C-u clobbers last-prefix-arg, basically. > > I believe this will fix it: Thanks, I'm adding Stefan to this discussion. From unknown Sat Jun 21 03:20:56 2025 X-Loop: help-debbugs@gnu.org Subject: bug#71277: 30.0.50; last-prefix-arg lost when universal-argument used Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 30 May 2024 14:43:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71277 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 71277@debbugs.gnu.org, Sean Whitton Received: via spool by 71277-submit@debbugs.gnu.org id=B71277.17170801704490 (code B ref 71277); Thu, 30 May 2024 14:43:01 +0000 Received: (at 71277) by debbugs.gnu.org; 30 May 2024 14:42:50 +0000 Received: from localhost ([127.0.0.1]:40303 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sCgzR-0001AK-RR for submit@debbugs.gnu.org; Thu, 30 May 2024 10:42:50 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:16377) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sCgzQ-00019q-LK for 71277@debbugs.gnu.org; Thu, 30 May 2024 10:42:49 -0400 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id AF465442963; Thu, 30 May 2024 10:42:31 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1717080150; bh=onLznt2Wn87jeLtJkpJV7+yYf4CPgZSWzGq1rDvq/gU=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=SzBoHBY9siNTnfCJrUV0Y9kei6FvaKa54KFyi92pE3pbEaHBF8/QrM71GDyUVWOfx 0ypwdtfBbPAIWn+kJfmzpXZqR03gv+osaed1i1KROS4RxPVK2Szg+5tKF+57wAz+iX H8r7VTmuteWjinWeQpLbZGj9bYNHCzuvd5FVChsgReQH1NmpSVSvpuFbaF1Nu+Mf0t 1dZFTgjeRBkJWRFQvH9Fi6B5vsdRCWRQA+JBhdJNl+8xKTTeYS0REuxH4WofaLfoDC NBDKKQlEXdPY+inGdYcpfUgjDO6S8IchVb36+qxchWOLUWotZ3Vdcm8pFp9mPQxfWp nDrDbVV9eObWA== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 75E2E44295F; Thu, 30 May 2024 10:42:30 -0400 (EDT) Received: from pastel (unknown [24.140.236.196]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 49A4712047D; Thu, 30 May 2024 10:42:30 -0400 (EDT) From: Stefan Monnier In-Reply-To: <86ikyvqyxp.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 30 May 2024 15:14:26 +0300") Message-ID: References: <87bk4nv7vy.fsf@zephyr.silentflame.com> <86ikyvqyxp.fsf@gnu.org> Date: Thu, 30 May 2024 10:42:29 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.022 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain T_SCC_BODY_TEXT_LINE -0.01 - X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) 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: -3.3 (---) >> Unlses something is wrong with my arithmetic, this is not correct. >> You should get "6!" after the third example too. >> The use of C-u clobbers last-prefix-arg, basically. >> >> I believe this will fix it: > > Thanks, I'm adding Stefan to this discussion. Hmm... I didn't know about `last-prefix-arg`. [ I'm not sure I like the idea of such a variable, but well... it's there. ] The patch looks fine to me, thank you. Stefan From unknown Sat Jun 21 03:20:56 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Sean Whitton Subject: bug#71277: closed (Re: bug#71277: 30.0.50; last-prefix-arg lost when universal-argument used) Message-ID: References: <877cfbs4dw.fsf@zephyr.silentflame.com> <87bk4nv7vy.fsf@zephyr.silentflame.com> X-Gnu-PR-Message: they-closed 71277 X-Gnu-PR-Package: emacs Reply-To: 71277@debbugs.gnu.org Date: Thu, 30 May 2024 15:32:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1717083122-13282-1" This is a multi-part message in MIME format... ------------=_1717083122-13282-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #71277: 30.0.50; last-prefix-arg lost when universal-argument used which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 71277@debbugs.gnu.org. --=20 71277: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D71277 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1717083122-13282-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 71277-done) by debbugs.gnu.org; 30 May 2024 15:31:57 +0000 Received: from localhost ([127.0.0.1]:42885 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sChkv-0003Rp-Vj for submit@debbugs.gnu.org; Thu, 30 May 2024 11:31:57 -0400 Received: from sendmail.purelymail.com ([34.202.193.197]:52192) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sChkl-0003R2-5S for 71277-done@debbugs.gnu.org; Thu, 30 May 2024 11:31:51 -0400 DKIM-Signature: a=rsa-sha256; b=VXJyufiGiOZqzfTG2brNjMR6X70iPoE1Bd6zuTZ6DkPD/F55WSwWDW1BBIlkuQnelZ13zJX2SMbn5pId3ctUUIGU0IAfmYxhLwvylPjHsHXpj4B1jnlywXpI0iiQIXh28FmzrBScquJOlc4r1/xlOvCIHBFjl2k0ywfj+/ef52K3drY9jNaA2Wik8t9Wyf36iNn2KoMQwLuaDDzPpKLKiAmvwK7F76IB1E+Bf32Kuehb/5zRc6xqv1k8TyZg9uLski9eU8P8LIM3uJcArUMRwcxLg7fVkgoxBRk9YhCWPWaKYjdCfKAz4eP34QHAQZsJgJMB1WQUu8+JypRJHx4PZQ==; s=purelymail2; d=spwhitton.name; v=1; bh=Xky0Etk2li+tI2uhOMvjjcrZ+07rWBBtOA8YUcSsYpM=; h=Received:Received:From:To:Subject:Date; DKIM-Signature: a=rsa-sha256; b=ZmsKbuAn+UcFIL7nvT9sqQoiIt/41CX9Vww0uKFVB5rYBMSUTPFXAW8afhi4Xk7t3jBNVtEmoh0yRrpVbjwwcahKOGPwgFoXPWOj7eKjAtdjwLSt3scGfhmMnzulZMwH9AGF3IMxgtRxFTJeVba0ofkH/FjG4xwkO2UnM49GYlLnjz6WI0fPRjSDBJOvQM07VoluvwzBsv5eL32/MRQlIweajNQmJi4oUC8vOkfXwYJsNN/FWFH/lK7gBQf5nlDQdQfvr+CZeqdyHorKLrJweeZIbpZlnANJJmnLU98yswTjy9faMK8sTFDiu/jmekLLgj0nZ3bE4NUm6h+NT5pNDQ==; s=purelymail2; d=purelymail.com; v=1; bh=Xky0Etk2li+tI2uhOMvjjcrZ+07rWBBtOA8YUcSsYpM=; h=Feedback-ID:Received:Received:From:To:Subject:Date; Feedback-ID: 20115:3760:null:purelymail X-Pm-Original-To: 71277-done@debbugs.gnu.org Received: by smtp.purelymail.com (Purelymail SMTP) with ESMTPSA id 649571286; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Thu, 30 May 2024 15:31:24 +0000 (UTC) Received: by zephyr.silentflame.com (Postfix, from userid 1000) id EB9049485FE; Thu, 30 May 2024 16:31:23 +0100 (BST) From: Sean Whitton To: Stefan Monnier , 71277-done@debbugs.gnu.org Subject: Re: bug#71277: 30.0.50; last-prefix-arg lost when universal-argument used In-Reply-To: (Stefan Monnier's message of "Thu, 30 May 2024 10:42:29 -0400") References: <87bk4nv7vy.fsf@zephyr.silentflame.com> <86ikyvqyxp.fsf@gnu.org> Date: Thu, 30 May 2024 16:31:23 +0100 Message-ID: <877cfbs4dw.fsf@zephyr.silentflame.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 71277-done 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 (-) Hello, On Thu 30 May 2024 at 10:42am -04, Stefan Monnier wrote: >>> Unlses something is wrong with my arithmetic, this is not correct. >>> You should get "6!" after the third example too. >>> The use of C-u clobbers last-prefix-arg, basically. >>> >>> I believe this will fix it: >> >> Thanks, I'm adding Stefan to this discussion. > > Hmm... I didn't know about `last-prefix-arg`. > [ I'm not sure I like the idea of such a variable, but > well... it's there. ] > The patch looks fine to me, thank you. Installed, thanks for the review. -- Sean Whitton ------------=_1717083122-13282-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 30 May 2024 11:47:58 +0000 Received: from localhost ([127.0.0.1]:59545 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sCeGB-0004tE-GX for submit@debbugs.gnu.org; Thu, 30 May 2024 07:47:58 -0400 Received: from lists.gnu.org ([209.51.188.17]:44428) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sCeG7-0004sz-DY for submit@debbugs.gnu.org; Thu, 30 May 2024 07:47:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sCeFv-0007ZF-Vt for bug-gnu-emacs@gnu.org; Thu, 30 May 2024 07:47:40 -0400 Received: from sendmail.purelymail.com ([34.202.193.197]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sCeFs-0007ND-Qs for bug-gnu-emacs@gnu.org; Thu, 30 May 2024 07:47:39 -0400 DKIM-Signature: a=rsa-sha256; b=VSZ4t5Dtxv7Eo6ILRvM0iSpceUIdS+yfMVxz69un8cd8P9q3BReiL7OKlb0VBug6/nZk0drHBnTnl+HVXZZdMkgHuDZbWTtr+NpNnPvl69Gsf4aP4gQp/Kf1q1b3O2OjRkMAac3LGySltSLMv59QwKTCC019JtGS+J8CZu4Q1qYoFSuDIEgUOzahjYP+X4xV+TYOiQnGOIQMQ/H62vXjvz7uxyUnu1B+QgUZbCka/TUb6aJR39+KHheT1H8X4nZyw69PoS5yYnDnhSd/9jrOchaDkrZPJuxxyPqmKZ47zSTroswUka1LjB5jb05aVjMZdEEYjI4jEl96AQmv9AoBNA==; s=purelymail2; d=spwhitton.name; v=1; bh=qcszerElfpaMwPk1+wleySGKWh2h6LoavYEk5yr0IhU=; h=Received:Received:From:To:Subject:Date; DKIM-Signature: a=rsa-sha256; b=WakeBFMynY5P2zuhloT+9FAUZI9xySosZB3O/rwjpb4Ax9sE2rulxiT4mZbskh/xu+tl3HTceb/jVNtWqbmFyrTXO657z3x0Sk91ixeAyOEdRdYxeJS+GNYZ8l4bWkc4sa3eEvIVonjAxhqFqmwMRYLvumS1rFvhMaKc1bSuelxnSSd1q9B+D8U3a0sEiV1oPUR4IMN02iDfQEq9KpNgAi0pinCcW9UMWm2Q1s6iK3RV1O+2+qITlLblp23zF0pQnWhLUD4pqsyjUq/313o+E2Xqs8Qeegl05tcJkOV6c+c+2dMnbDfH5wm6Imm7xRu40jCuzy+f+8MOkU26YwT6xw==; s=purelymail2; d=purelymail.com; v=1; bh=qcszerElfpaMwPk1+wleySGKWh2h6LoavYEk5yr0IhU=; h=Feedback-ID:Received:Received:From:To:Subject:Date; Feedback-ID: 20115:3760:null:purelymail X-Pm-Original-To: bug-gnu-emacs@gnu.org Received: by smtp.purelymail.com (Purelymail SMTP) with ESMTPSA id -1370277545 for (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Thu, 30 May 2024 11:47:30 +0000 (UTC) Received: by zephyr.silentflame.com (Postfix, from userid 1000) id 8EC8C9485FE; Thu, 30 May 2024 12:47:29 +0100 (BST) From: Sean Whitton To: bug-gnu-emacs@gnu.org Subject: 30.0.50; last-prefix-arg lost when universal-argument used Date: Thu, 30 May 2024 12:47:29 +0100 Message-ID: <87bk4nv7vy.fsf@zephyr.silentflame.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=34.202.193.197; envelope-from=spwhitton@spwhitton.name; helo=sendmail.purelymail.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) 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: -2.3 (--) Hello, Consider (defun counter () (interactive) (when (eq last-command this-command) (setq current-prefix-arg (+ (prefix-numeric-value current-prefix-arg) (prefix-numeric-value last-prefix-arg)))) (message "%s!" (prefix-numeric-value current-prefix-arg))) (global-set-key "\M-." #'counter) If you type M-. M-. M-. then you see "3!" as expected. Similarly if you type "C-u M-. M-. M-." then you see "6!". However, if you type "M-. M-. C-u M-." then you get "5!". Unlses something is wrong with my arithmetic, this is not correct. You should get "6!" after the third example too. The use of C-u clobbers last-prefix-arg, basically. I believe this will fix it: -- >8 -- Subject: [PATCH] universal-argument--preserve: Preserve last-prefix-arg * lisp/simple.el (universal-argument--preserve): Set current-prefix-arg to last-prefix-arg in order to preserve last-prefix-arg, too. --- lisp/simple.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/simple.el b/lisp/simple.el index 44197c3189a..76fb81c9df5 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -5414,7 +5414,8 @@ universal-argument--description (add-hook 'prefix-command-preserve-state-hook #'universal-argument--preserve) (defun universal-argument--preserve () - (setq prefix-arg current-prefix-arg)) + (setq prefix-arg current-prefix-arg) + (setq current-prefix-arg last-prefix-arg)) (defvar universal-argument-map (let ((map (make-sparse-keymap)) -- Sean Whitton ------------=_1717083122-13282-1--