From unknown Wed Aug 20 05:17:14 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#34901 <34901@debbugs.gnu.org> To: bug#34901 <34901@debbugs.gnu.org> Subject: Status: CUA cut/copy no longer work in keyboard macros (emacs25) Reply-To: bug#34901 <34901@debbugs.gnu.org> Date: Wed, 20 Aug 2025 12:17:14 +0000 retitle 34901 CUA cut/copy no longer work in keyboard macros (emacs25) reassign 34901 emacs submitter 34901 Ben Bridgwater severity 34901 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 18 01:35:32 2019 Received: (at submit) by debbugs.gnu.org; 18 Mar 2019 05:35:32 +0000 Received: from localhost ([127.0.0.1]:47972 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h5kvs-00081d-C5 for submit@debbugs.gnu.org; Mon, 18 Mar 2019 01:35:32 -0400 Received: from eggs.gnu.org ([209.51.188.92]:54855) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h5ghz-00018z-53 for submit@debbugs.gnu.org; Sun, 17 Mar 2019 21:04:55 -0400 Received: from lists.gnu.org ([209.51.188.17]:58533) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h5ght-0006mR-NV for submit@debbugs.gnu.org; Sun, 17 Mar 2019 21:04:49 -0400 Received: from eggs.gnu.org ([209.51.188.92]:40969) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h5ghs-0000f3-Bm for bug-gnu-emacs@gnu.org; Sun, 17 Mar 2019 21:04:49 -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,FREEMAIL_FROM, HTML_MESSAGE autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h5ghq-0006h7-2L for bug-gnu-emacs@gnu.org; Sun, 17 Mar 2019 21:04:47 -0400 Received: from mail-it1-x136.google.com ([2607:f8b0:4864:20::136]:50188) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h5ghn-0006de-G8 for bug-gnu-emacs@gnu.org; Sun, 17 Mar 2019 21:04:44 -0400 Received: by mail-it1-x136.google.com with SMTP id m137so2419713ita.0 for ; Sun, 17 Mar 2019 18:04:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=zzHT5ziesrU8z23YW8Gk5HB8Lpi5SxDQQZdAMd1Fdbw=; b=LvhZ1a91MDFQbUek/QTY6i/5xHRVJwoSbyGi7dYtKuV1AR61gEWxYX1VK1GaPLfAad 8c70X7pTBi0R3y0ww1G/cMNBV5TKKexUzg7aOz2SQr5khCkQ/1MrDYuMh5EDFywv6ZUQ r58bdRJtT95B/n02c5qisVbUV64XVFEFJreyY1NlNFj+Vg0x+o/eV8mQm0ZfKH6jVFGG 7xSXs8ThnEow+jCK7ZXiK1yWS3ouhga9/tbj7VJsQPxzbgA2/FGglBNFPJ8j5vzOmNlm ak1okzG2cjf+YHTwVtwEHqBmc9WvphYwJPqivRYqVLwFeNvrjnKaxFBebVnAfhNHakO5 Outg== 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=zzHT5ziesrU8z23YW8Gk5HB8Lpi5SxDQQZdAMd1Fdbw=; b=Pz2VUdFhPMLPOgbGlc3TGXybdu1Qq9CQOtgAPhpDbQaqXO5uqm8Z3a/9E5oRrvxToC qmt/wL9VVmoL2M1JWeJr3NPHrteZ/XFXDZuE3IliaWAI1KK9K/pTIeX4Og52EsS6IquG DC41LHXSZKUyYUYQ4Hzh7TOCYfqw23PEikVkEVz2d+M9ru+sYhJQcnLIpZ0E0crQN0X2 qcDLmMVz/XhZ4paQ29k70RRutPABMEYIK6HJ7m1GX7+uctmDJJGdtVeDA4Wtesf4igVR L2AybD6aHUHLzB4B9wxSnuCQcrFPjU8jd8oNpQEWhREJWRokoD52iQTWoHPzZLqbXf7y sVvA== X-Gm-Message-State: APjAAAUww70Gqrzx5V3etPB62srJr0bh9xtHKEtLEPBkHgezSuYp6vqX b+Uaj5f1YuKYwAQOhX4lH/90XwrhhNMhhal8G71BHRfZ X-Google-Smtp-Source: APXvYqyuc1Z2xvrhCxKkNFr1r8vhI/OItK4vXijSD5ZpAehUeA4eBORCS5qnJCKx4tzhzlsux/x41V0Q4Kd3e3nwWSQ= X-Received: by 2002:a24:b90d:: with SMTP id w13mr8667942ite.45.1552871078857; Sun, 17 Mar 2019 18:04:38 -0700 (PDT) MIME-Version: 1.0 From: Ben Bridgwater Date: Sun, 17 Mar 2019 21:04:28 -0400 Message-ID: Subject: CUA cut/copy no longer work in keyboard macros (emacs25) To: bug-gnu-emacs@gnu.org Content-Type: multipart/alternative; boundary="00000000000009943f058453f9a0" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::136 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Mon, 18 Mar 2019 01:35:30 -0400 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: -0.0 (/) --00000000000009943f058453f9a0 Content-Type: text/plain; charset="UTF-8" I just upgraded from emacs24 (Ubuntu 16.04) to emacs25 (Ubuntu 18.04), and have found that the CUA cut/copy (ctrl-x, ctrl-v) bindings no longer work in keyboard macros. Attempting to use them now results in an "keyboard macro terminated by a command ringing the bell" error on macro playback. The issue seems to be the CUA bindings since the underlying cut/copy functions (kill-region, kill-ring-save) still work correctly in macros when bound to other keys. The CUA paste function (ctrl-v) is unaffected by the bug and continues to work in macros. Ben --00000000000009943f058453f9a0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I just upgraded from emacs24 (Ubuntu 16.04) to emacs2= 5 (Ubuntu 18.04), and have found that the CUA cut/copy (ctrl-x, ctrl-v) bin= dings no longer work in keyboard macros. Attempting to use them now results= in an "keyboard macro terminated by a command ringing the bell" = error on macro playback.

The issue seems to be the= CUA bindings since the underlying cut/copy functions (kill-region, kill-ri= ng-save) still work correctly in macros when bound to other keys.

The CUA paste function (ctrl-v) is unaffected by the bug an= d continues to work in macros.

Ben

<= /div>
--00000000000009943f058453f9a0-- From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 18 12:50:57 2019 Received: (at 34901) by debbugs.gnu.org; 18 Mar 2019 16:50:57 +0000 Received: from localhost ([127.0.0.1]:49089 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h5vTU-0008AO-UM for submit@debbugs.gnu.org; Mon, 18 Mar 2019 12:50:57 -0400 Received: from eggs.gnu.org ([209.51.188.92]:34468) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h5vTT-0008AC-Ej for 34901@debbugs.gnu.org; Mon, 18 Mar 2019 12:50:55 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:41444) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h5vTM-0003w4-Vu; Mon, 18 Mar 2019 12:50:49 -0400 Received: from [176.228.60.248] (port=3424 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1h5vTM-0007d0-CK; Mon, 18 Mar 2019 12:50:48 -0400 Date: Mon, 18 Mar 2019 18:50:39 +0200 Message-Id: <831s34w2hs.fsf@gnu.org> From: Eli Zaretskii To: Ben Bridgwater , Stefan Monnier In-reply-to: (message from Ben Bridgwater on Sun, 17 Mar 2019 21:04:28 -0400) Subject: Re: bug#34901: CUA cut/copy no longer work in keyboard macros (emacs25) References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 34901 Cc: 34901@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: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > From: Ben Bridgwater > Date: Sun, 17 Mar 2019 21:04:28 -0400 > > I just upgraded from emacs24 (Ubuntu 16.04) to emacs25 (Ubuntu 18.04), and have found that the CUA > cut/copy (ctrl-x, ctrl-v) bindings no longer work in keyboard macros. I believe you meant C-x and C-c, not C-v. > The issue seems to be the CUA bindings since the underlying cut/copy functions (kill-region, kill-ring-save) > still work correctly in macros when bound to other keys. Yes. Turns out CUA is another package that relied on undocumented kludges to avoid recording the same key twice, when keys are pushed back onto unread-command-events. Aargh! Stefan, what do you think about the patch below? Other that that, I don't see what we could do with this stuff. --- lisp/emulation/cua-base.el~0 2019-01-09 11:13:23.000000000 +0200 +++ lisp/emulation/cua-base.el 2019-03-18 15:14:34.349105600 +0200 @@ -710,7 +710,8 @@ ;; C-x binding after the first C-x C-x was rewritten to just C-x). (prefix-command-preserve-state) ;; Push the key back on the event queue - (setq unread-command-events (cons key unread-command-events)))) + (setq unread-command-events (cons (cons 'no-record key) + unread-command-events)))) (defun cua--prefix-override-handler () "Start timer waiting for prefix key to be followed by another key. --- src/keyboard.c~0 2019-03-03 06:47:29.000000000 +0200 +++ src/keyboard.c 2019-03-18 15:21:16.543163600 +0200 @@ -2360,7 +2360,14 @@ read_char (int commandflag, Lisp_Object if (CONSP (c) && EQ (XCAR (c), Qt)) c = XCDR (c); else - reread = true; + { + if (CONSP (c) && EQ (XCAR (c), Qno_record)) + { + c = XCDR (c); + recorded = true; + } + reread = true; + } /* Undo what read_char_x_menu_prompt did when it unread additional keys returned by Fx_popup_menu. */ @@ -2741,7 +2748,14 @@ read_char (int commandflag, Lisp_Object if (CONSP (c) && EQ (XCAR (c), Qt)) c = XCDR (c); else - reread = true; + { + if (CONSP (c) && EQ (XCAR (c), Qno_record)) + { + c = XCDR (c); + recorded = true; + } + reread = true; + } } /* Read something from current KBOARD's side queue, if possible. */ @@ -2803,6 +2817,11 @@ read_char (int commandflag, Lisp_Object if (CONSP (c) && EQ (XCAR (c), Qt)) c = XCDR (c); + else if (CONSP (c) && EQ (XCAR (c), Qno_record)) + { + c = XCDR (c); + recorded = true; + } } non_reread: @@ -11192,6 +11211,7 @@ syms_of_keyboard (void) Fput (var, Qevent_symbol_elements, list1 (var)); } } + DEFSYM (Qno_record, "no-record"); button_down_location = make_nil_vector (5); staticpro (&button_down_location); From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 18 13:06:55 2019 Received: (at 34901) by debbugs.gnu.org; 18 Mar 2019 17:06:55 +0000 Received: from localhost ([127.0.0.1]:49116 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h5viw-00009k-Q1 for submit@debbugs.gnu.org; Mon, 18 Mar 2019 13:06:54 -0400 Received: from mail01.iro.umontreal.ca ([132.204.25.201]:60240) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h5viu-00009X-Hr for 34901@debbugs.gnu.org; Mon, 18 Mar 2019 13:06:52 -0400 Received: from mail01.iro.umontreal.ca (mail01.iro.umontreal.ca [127.0.0.1]) by mail01.iro.umontreal.ca (Postfix) with ESMTP id 58AAE808B106 for <34901@debbugs.gnu.org>; Mon, 18 Mar 2019 13:06:47 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; h=content-type:content-type:mime-version:user-agent:in-reply-to :date:date:references:message-id:subject:subject:to:from:from; s=dkim; t=1552928806; x=1553792807; bh=tzwoAhXN3kHWnfshTvSn09Mz 3mJf+4PZXmhwKQ9K/nk=; b=l8rYvJW2xkJVrnEPlYILoo/24I9+2hISnrrCVxsD pemLCeVJdVeIqzyE9pn4l3PvP+DQN9N69OfG2NJnAhG1ZRTP4DLNFgD7sTWp6nqK tcXlChtmvANuJh0AZzK050kN8LByJNyYZ7xZCui1wda7XyKbtjuI62JOsDT5Psy0 mH9oTMsO0Yo+aGpLw4h2PXmJhfi3JI8r3nBWpSGx5sLUaOQTyMX1jXQ3P61z8SoM tiJz9Ua0VTII3gYvW8AwEmisl8HayUmIwx+DTedD1k1VH49hWzxeUMUL1yTLu23Q gMgdMpkL8xdICqnweB8UyLqMU67aqYBsaXnmKUelwZkT9A== X-Virus-Scanned: amavisd-new at iro.umontreal.ca Received: from mail01.iro.umontreal.ca ([127.0.0.1]) by mail01.iro.umontreal.ca (mail01.iro.umontreal.ca [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ExQ7dlUI2EX2 for <34901@debbugs.gnu.org>; Mon, 18 Mar 2019 13:06:46 -0400 (EDT) Received: from pastel (unknown [45.72.131.229]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 3D17F808B0E8; Mon, 18 Mar 2019 13:06:46 -0400 (EDT) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#34901: CUA cut/copy no longer work in keyboard macros (emacs25) Message-ID: References: <831s34w2hs.fsf@gnu.org> Date: Mon, 18 Mar 2019 13:06:45 -0400 In-Reply-To: <831s34w2hs.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 18 Mar 2019 18:50:39 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 34901 Cc: 34901@debbugs.gnu.org, Ben Bridgwater 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 (---) > Yes. Turns out CUA is another package that relied on undocumented > kludges to avoid recording the same key twice, when keys are pushed > back onto unread-command-events. Aargh! > > Stefan, what do you think about the patch below? Other that that, I > don't see what we could do with this stuff. I wouldn't say it looks "good", but I can't think of a better approach, thanks. Stefan From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 20 05:25:11 2019 Received: (at 34901-done) by debbugs.gnu.org; 20 Mar 2019 09:25:11 +0000 Received: from localhost ([127.0.0.1]:51208 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h6XTD-0000gS-GL for submit@debbugs.gnu.org; Wed, 20 Mar 2019 05:25:11 -0400 Received: from eggs.gnu.org ([209.51.188.92]:36547) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h6XTB-0000g9-Ly for 34901-done@debbugs.gnu.org; Wed, 20 Mar 2019 05:25:10 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:52202) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6XT2-0006PM-Bj; Wed, 20 Mar 2019 05:25:00 -0400 Received: from [176.228.60.248] (port=4117 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1h6XT1-0005E5-Sk; Wed, 20 Mar 2019 05:25:00 -0400 Date: Wed, 20 Mar 2019 11:24:55 +0200 Message-Id: <83y359sxso.fsf@gnu.org> From: Eli Zaretskii To: Stefan Monnier In-reply-to: (message from Stefan Monnier on Mon, 18 Mar 2019 13:06:45 -0400) Subject: Re: bug#34901: CUA cut/copy no longer work in keyboard macros (emacs25) References: <831s34w2hs.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 34901-done Cc: 34901-done@debbugs.gnu.org, bbridgwater@gmail.com 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 (-) > From: Stefan Monnier > Cc: Ben Bridgwater , 34901@debbugs.gnu.org > Date: Mon, 18 Mar 2019 13:06:45 -0400 > > > Yes. Turns out CUA is another package that relied on undocumented > > kludges to avoid recording the same key twice, when keys are pushed > > back onto unread-command-events. Aargh! > > > > Stefan, what do you think about the patch below? Other that that, I > > don't see what we could do with this stuff. > > I wouldn't say it looks "good", but I can't think of a better > approach, thanks. OK, pushed to the master branch. Unfortunately, it's too late for getting this into Emacs 26.2, so for now the solution will have to wait for Emacs 27. Too bad no one paid attention to this since Emacs 25.1 was released. Thanks. From unknown Wed Aug 20 05:17:14 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 17 Apr 2019 11:24:04 +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