From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#21867: 25.0.50; lossage's log doesn't treat characters read by read-char as separate commands Date: Sat, 03 Aug 2019 14:13:49 +0200 Message-ID: <87wofujvk2.fsf@mouse.gnus.org> References: <87blx8iwwm.fsf@mouse.gnus.org> <83o918hhli.fsf@gnu.org> <87tvb0hgov.fsf@mouse.gnus.org> <83mugshg86.fsf@gnu.org> <877e7whfv9.fsf@mouse.gnus.org> <83lfwcheyy.fsf@gnu.org> <87k1bwg01u.fsf@mouse.gnus.org> <83ef24gjby.fsf@gnu.org> <8736ijak7u.fsf@mouse.gnus.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="134996"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: 21867@debbugs.gnu.org, zkanfer@gmail.com To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Aug 03 14:14:16 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1htsvQ-000Yzc-3R for geb-bug-gnu-emacs@m.gmane.org; Sat, 03 Aug 2019 14:14:16 +0200 Original-Received: from localhost ([::1]:39864 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1htsvP-0003hz-4i for geb-bug-gnu-emacs@m.gmane.org; Sat, 03 Aug 2019 08:14:15 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53722) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1htsvH-0003ho-7G for bug-gnu-emacs@gnu.org; Sat, 03 Aug 2019 08:14:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1htsvD-0000Un-BE for bug-gnu-emacs@gnu.org; Sat, 03 Aug 2019 08:14:07 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49598) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1htsvD-0000Ug-7i for bug-gnu-emacs@gnu.org; Sat, 03 Aug 2019 08:14:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1htsvD-0002PL-2O for bug-gnu-emacs@gnu.org; Sat, 03 Aug 2019 08:14:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 03 Aug 2019 12:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21867 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed patch Original-Received: via spool by 21867-submit@debbugs.gnu.org id=B21867.15648344389238 (code B ref 21867); Sat, 03 Aug 2019 12:14:02 +0000 Original-Received: (at 21867) by debbugs.gnu.org; 3 Aug 2019 12:13:58 +0000 Original-Received: from localhost ([127.0.0.1]:58419 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1htsv8-0002Ov-38 for submit@debbugs.gnu.org; Sat, 03 Aug 2019 08:13:58 -0400 Original-Received: from quimby.gnus.org ([80.91.231.51]:46308) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1htsv6-0002On-Rs for 21867@debbugs.gnu.org; Sat, 03 Aug 2019 08:13:57 -0400 Original-Received: from 77.18.62.220.tmi.telenormobil.no ([77.18.62.220] helo=sandy) by quimby.gnus.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1htsv0-0004CO-Og; Sat, 03 Aug 2019 14:13:53 +0200 In-Reply-To: (Stefan Monnier's message of "Fri, 02 Aug 2019 16:16:37 -0400") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:164440 Archived-At: Stefan Monnier writes: > So I think maybe a better way to look at it is to add marker > pseudo-events like `end-of-command` (e.g. after running > post-command-hook), so we can discover that `a` was processed as part of > the execution of the command bound to `C-x C-e` rather than as part of > the sequence of events that triggered view-lossage. Makes sense. With the following patch I get: 24 5 (nil . eval-last-sexp) 97 end-of-command in recent_keys. `view-lossage' could use this to output this as C-x C-e a ;; eval-last-sexp It does make the recent_keys list even more... uhm... eccentric, I guess. And during typical text entry, there'll be slightly more memory usage: 72 (nil . self-insert-command) end-of-command 101 (nil . self-insert-command) end-of-command If this approach makes sense, I can fix up view-lossage to interpret the new structure. diff --git a/src/keyboard.c b/src/keyboard.c index db5ca4e547..1a4a7d2711 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -307,6 +307,7 @@ #define GROW_RAW_KEYBUF \ static void echo_now (void); static ptrdiff_t echo_length (void); +static void record_char (Lisp_Object c); /* Incremented whenever a timer is run. */ unsigned timers_run; @@ -1424,6 +1425,8 @@ command_loop_1 (void) Fcons (Qnil, cmd)); if (++recent_keys_index >= NUM_RECENT_KEYS) recent_keys_index = 0; + /* Mark this as a complete command in recent_keys. */ + record_char (Qend_of_command); } Vthis_command = cmd; Vreal_this_command = cmd; @@ -1474,6 +1477,9 @@ command_loop_1 (void) safe_run_hooks (Qpost_command_hook); + /* Mark this as a complete command in recent_keys. */ + record_char (Qend_of_command); + /* If displaying a message, resize the echo area window to fit that message's size exactly. Do this only if the echo area window is the minibuffer window of the selected frame. See @@ -2091,7 +2097,6 @@ show_help_echo (Lisp_Object help, Lisp_Object window, Lisp_Object object, static Lisp_Object kbd_buffer_get_event (KBOARD **kbp, bool *used_mouse_menu, struct timespec *end_time); -static void record_char (Lisp_Object c); static Lisp_Object help_form_saved_window_configs; static void @@ -11069,6 +11074,8 @@ syms_of_keyboard (void) DEFSYM (Qundefined, "undefined"); + DEFSYM (Qend_of_command, "end-of-command"); + /* Hooks to run before and after each command. */ DEFSYM (Qpre_command_hook, "pre-command-hook"); DEFSYM (Qpost_command_hook, "post-command-hook"); -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no