From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Christoph Arenz Newsgroups: gmane.emacs.devel Subject: Severe regressions in context of keyboard macros Date: Thu, 19 Sep 2019 10:17:17 +0200 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="------------86B53DF4D4067DAB3B4DFAFE" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="243461"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Sep 19 14:08:53 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iAvEz-0011E1-B3 for ged-emacs-devel@m.gmane.org; Thu, 19 Sep 2019 14:08:53 +0200 Original-Received: from localhost ([::1]:43108 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAvEy-0004lF-0N for ged-emacs-devel@m.gmane.org; Thu, 19 Sep 2019 08:08:52 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33897) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iArhw-0007hD-Bb for emacs-devel@gnu.org; Thu, 19 Sep 2019 04:22:33 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iArhu-0003IQ-Ko for emacs-devel@gnu.org; Thu, 19 Sep 2019 04:22:32 -0400 Original-Received: from mout.web.de ([212.227.15.4]:50925) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iArhu-0003Hr-6j for emacs-devel@gnu.org; Thu, 19 Sep 2019 04:22:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1568881344; bh=ZkHAwNeNokRx+EoW4hg50OMXvWE5vT89Oz92WngIHBQ=; h=X-UI-Sender-Class:To:From:Subject:Date; b=c9dA8yfcR+kwN3OiNZszT7pWxtV5Hm2U0GBOwJEdFATsr4l5/KUTNEooiim+Fs8aJ 9BevsnSPrrpJr+G9As0I0qGS1Z1nNyFrQIUbUYfAMWQlc7ACPT5AiC76Si1sTE5Ycz b3VI6CENGUtvnsQwIGah+OE1MnSxQBMdw0qGx/u4= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Original-Received: from oc3710058320.ibm.com ([94.16.136.56]) by smtp.web.de (mrweb003 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MK233-1iBgyT0BBl-001UW4 for ; Thu, 19 Sep 2019 10:17:20 +0200 Content-Language: en-US X-Provags-ID: V03:K1:p2GoAs4CkBPLSoaS/wGlDbg9ZaGllxWoGxk0fHYihTb4qwIPcL2 ig2SdARskbdBK1uLegi44s1+OSs+PAjFgFHWP7amAa/qcPE1Bp+DWrzyCWU7ZbIKS6nVjb0 5aGDi2TrQWuM7PrStCYGRoWkQBAMjXz/rEzFi5sMopsk9oMkgxs6XgqUKIQodEJP3nzW5EG +TRbI8rP5xkBhwKvQizpQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:xxLKEa/mvlg=:M+UPCc09h1WNgTpd4uvmYu NlXK5Y6ndSlLpMeMjEwKjUdDtzKkzOnd85DAla2jEh7GD4vDKVbkZdnZ8+wQcWTY5CUhaqxnx aphb+pGTop3lhIo6JaPINwVuTZ8cOPhpxrQEU8delPXyJCHN4PEIbeWXJReAh6kaYNb/ZRltV GogNb87eU2DIbhv71hoCd9fvDM49mvkoSc48ZQ7D+weYT7hASPSu6CENLbwrPUpHXdCK0/ywF XaomUmxfT4i4Xtl62fQxDc7AtAApJ40mVkjcU6KVRIxMMc9A5L65TC+c5+iO6wbf7EbEl2L2o GPZ0njq1puazycSq1oYVAyCOec6XohQRzvS6pvDwihKXCsRRnGuyh8NCwDzF0r6bxq64p0/f6 KjkM2nsQ5Rq12SAMG2sW5YL6oCxfwj1WuHZtwJmG9NcK9rsDxyaUtmwOQ92Mxr5p3rDq3d4Tc BKwI2Nw8lBGtA2ov1VQJf5K7csucpry5uEJD/h1Ly4gWyHagjYKTERcJELiJZ5Op8kZyl32fA 2MW4CtBY7LvaM529u796ncbsSeYcw36WLJ/YE7Wd/ojyjw5ePs8rzocDCO5c6awv2J1bcSVwc 1ydMVbITtEoZvFnkKn1kTIHfNzULDzzhsGlpuLMqtlvJRbziABNGMgAOpm5UIVKgrR2HA54MQ lPzaPCJraX5Wqqblja9NkaDOeGos5qMxnFXubdW/M/hTsm4UJ3dtzIwon2+AghIcpuWMpkVFi J9J16g8BPq1vIIpCApTHY7I6M0h7PEwdfNfNuaaV+xNj+BlQ9xVG6SIWU89auK1/ms1qWNxH X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.15.4 X-Mailman-Approved-At: Thu, 19 Sep 2019 08:06:14 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:240164 Archived-At: This is a multi-part message in MIME format. --------------86B53DF4D4067DAB3B4DFAFE Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable I think I have found two regressions that were introduced some time ago by commit 30a6b1f81412044a, affecting keyboard macros. One is severely affecting calc to the point of leading to completely wrong results -- if not stopped by an error first. The other is affecting how dribble writes out recorded keys. Calc: I stumbled across the following bug using calc -- see also https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D37057: 90 S I S This calculates the sine and inverse sine of 90 -- with a result of 90. It also records "IS" as a keyboard macro. Now, let's use the macro to complete the same calculation: 90 S This worked until emacs-24.5 but is broken since emacs-25.1 where "ISS" is recorded as a keyboard macro -- now leading to a result of 1. It seems all macros that involve calc's prefix keys (e.g. "I" or "H") have the following key recorded twice in last-kbd-macro. E.g. "IHP" is recorded as "IHHPP", pushing GAMMA and PI on the stack instead of one constant, namely PHI. Hopefully, the calculation breaks due to an error -- otherwise, you get nonsense results which might be hard to debug, if noticed at all. Dribble: According to the documentation in open-dribble-file, this starts 'writing all keyboard characters to a dribble file'. However, the keys being recorded changed with commit 30a6b1f81412044a when a keyboard macro is involved. Prior, the key "" was recorded when a macro was replayed. With the patch, the recording contains "" and additionally all characters that were replayed by the macro. This gets ugly quickly, e.g. when was used in the macro to insert a counter. I am not suggesting that reverting commit 30a6b1f81412044a is the final and right solution, but it does resolve the two issues in calc and dribble in emacs-26.3. I stumbled across the mail thread https://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00193.html where there were some doubts whether the quick fix could break something else. Keyboard.c seems highly complex and magic to me. I first thought that sit-for in subr.el might have something to do with it as it has fixme comments mentioning unread-command-events. Just a wild guess... --------------86B53DF4D4067DAB3B4DFAFE Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit I think I have found two regressions that were introduced some time ago by commit 30a6b1f81412044a, affecting keyboard macros. One is severely affecting calc to the point of leading to completely wrong results -- if not stopped by an error first. The other is affecting how dribble writes out recorded keys.

Calc:
I stumbled across the following bug using calc -- see also https://debbugs.gnu.org/cgi/bugreport.cgi?bug=37057:
90 <RET> S <f3> I S <f4>
This calculates the sine and inverse sine of 90 -- with a result of 90.
It also records "IS" as a keyboard macro.
Now, let's use the macro to complete the same calculation:
90 <RET> S <f4>
This worked until emacs-24.5 but is broken since emacs-25.1 where "ISS" is recorded as a keyboard macro -- now leading to a result of 1.

It seems all macros that involve calc's prefix keys (e.g. "I" or "H") have the following key recorded twice in last-kbd-macro. E.g. "IHP" is recorded as "IHHPP", pushing GAMMA and PI on the stack instead of one constant, namely PHI.

Hopefully, the calculation breaks due to an error -- otherwise, you get nonsense results which might be hard to debug, if noticed at all.


Dribble:
According to the documentation in open-dribble-file, this starts 'writing all keyboard characters to a dribble file'.
However, the keys being recorded changed with commit 30a6b1f81412044a when a keyboard macro is involved.

Prior, the key "<f4>" was recorded when a macro was replayed. With the patch, the recording contains "<f4>" and additionally all characters that were replayed by the macro. This gets ugly quickly, e.g. when <f3> was used in the macro to insert a counter.


I am not suggesting that reverting commit 30a6b1f81412044a is the final and right solution, but it does resolve the two issues in calc and dribble in emacs-26.3. I stumbled across the mail thread https://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00193.html where there were some doubts whether the quick fix could break something else.

Keyboard.c seems highly complex and magic to me. I first thought that sit-for in subr.el might have something to do with it as it has fixme comments mentioning unread-command-events. Just a wild guess...


--------------86B53DF4D4067DAB3B4DFAFE--