From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Sean Whitton via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#71277: 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> Reply-To: Sean Whitton Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32543"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) To: 71277@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu May 30 13:48:22 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sCeGa-0008FM-Ue for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 30 May 2024 13:48:21 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sCeGA-0007eL-VR; Thu, 30 May 2024 07:47:55 -0400 Original-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 1sCeG9-0007dz-4H for bug-gnu-emacs@gnu.org; Thu, 30 May 2024 07:47:53 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sCeG8-0007ZF-RR for bug-gnu-emacs@gnu.org; Thu, 30 May 2024 07:47:52 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sCeGI-0004th-Fw for bug-gnu-emacs@gnu.org; Thu, 30 May 2024 07:48:02 -0400 X-Loop: help-debbugs@gnu.org 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-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.171706967818813 (code B ref -1); Thu, 30 May 2024 11:48:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 30 May 2024 11:47:58 +0000 Original-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 Original-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 Original-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 Original-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 Original-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) Original-Received: by zephyr.silentflame.com (Postfix, from userid 1000) id 8EC8C9485FE; Thu, 30 May 2024 12:47:29 +0100 (BST) 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:286217 Archived-At: 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