From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: clemera@posteo.net Newsgroups: gmane.emacs.bugs Subject: bug#45177: 27.1; Access to invoking top level command in minibuffer Date: Sun, 13 Dec 2020 14:29:01 +0100 Message-ID: References: <87czzg8489.fsf@gnus.org> <05fa5ca7-f960-0d3b-4395-f8219456c030@posteo.de> <87mtyh6ga5.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31549"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 Cc: 45177@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 13 14:30:17 2020 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 1koRS4-00086l-TQ for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 13 Dec 2020 14:30:16 +0100 Original-Received: from localhost ([::1]:37766 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1koRS3-0006dQ-CJ for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 13 Dec 2020 08:30:15 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48030) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1koRRr-0006d8-Ae for bug-gnu-emacs@gnu.org; Sun, 13 Dec 2020 08:30:05 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36211) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1koRRq-0008MN-Ry for bug-gnu-emacs@gnu.org; Sun, 13 Dec 2020 08:30:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1koRRq-0000Ms-Mj for bug-gnu-emacs@gnu.org; Sun, 13 Dec 2020 08:30:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: clemera@posteo.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 13 Dec 2020 13:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45177 X-GNU-PR-Package: emacs Original-Received: via spool by 45177-submit@debbugs.gnu.org id=B45177.16078661511206 (code B ref 45177); Sun, 13 Dec 2020 13:30:02 +0000 Original-Received: (at 45177) by debbugs.gnu.org; 13 Dec 2020 13:29:11 +0000 Original-Received: from localhost ([127.0.0.1]:47757 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1koRR0-0000JO-UW for submit@debbugs.gnu.org; Sun, 13 Dec 2020 08:29:11 -0500 Original-Received: from mout02.posteo.de ([185.67.36.66]:56807) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1koRQy-0000It-TI for 45177@debbugs.gnu.org; Sun, 13 Dec 2020 08:29:09 -0500 Original-Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id BE4B12400FE for <45177@debbugs.gnu.org>; Sun, 13 Dec 2020 14:29:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1607866142; bh=52JaJ+hgR1KoTkCXZ7qIJoBQAebKnTLjmHo6YmrZWAQ=; h=Subject:To:Cc:From:Date:From; b=OGvhQUyniVitV3/9w4P6QWyzsswMIanznijqH12mW2sCA1jFekMT5y5MqMPEOs9bU m2oG42QopPVx0GDsL1hwSfVuJs92WoQY9gNsDAjixFHTzFYdtHQ8gaFZK1PgJfJ1KM h4rn5BpIOMoxVeZHo+//5sxN9ZxMZlHnVa/1DQ1IIjS3eBiCmm7udrqWbN5Wx19e8V VoALvqSW+aBzonNdC5C2SHigwSoeONbfvpNct83ecKpM17O+m+lH/IlKG/mT9NQXCE vAgS+mBYyjGgBbpNhDKlzKcJffYDEbJ+3AwDvpu+rmko8Hz/bEPX5uO0a78aJrxsDc F9sZd+5fySyMw== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Cv52k1nW4z6tmR; Sun, 13 Dec 2020 14:29:02 +0100 (CET) In-Reply-To: <87mtyh6ga5.fsf@gnus.org> Content-Language: en-US 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" Xref: news.gmane.io gmane.emacs.bugs:195958 Archived-At: > I'm not quite sure where to bind the variable... Does the following > work for you? > > diff --git a/src/callint.c b/src/callint.c > index f80436f3d9..a01338dfe1 100644 > --- a/src/callint.c > +++ b/src/callint.c > @@ -283,6 +283,8 @@ DEFUN ("call-interactively", Fcall_interactively, Scall_interactively, 1, 3, 0, > Lisp_Object save_real_this_command = Vreal_this_command; > Lisp_Object save_last_command = KVAR (current_kboard, Vlast_command); > > + specbind (Qrecursive_this_command, Vreal_this_command); > + > if (NILP (keys)) > keys = this_command_keys, key_count = this_command_key_count; > else > diff --git a/src/keyboard.c b/src/keyboard.c > index dbca5be91e..ce2b7f1ef4 100644 > --- a/src/keyboard.c > +++ b/src/keyboard.c > @@ -11830,6 +11830,11 @@ syms_of_keyboard (void) > doc: /* This is like `this-command', except that commands should never modify it. */); > Vreal_this_command = Qnil; > > + DEFSYM (Qrecursive_this_command, "recursive-this-command"); > + DEFVAR_LISP ("recursive-this-command", Vrecursive_this_command, > + doc: /* This is like `real-this-command', but bound recursively in `call-interactively. */); > + Vrecursive_this_command = Qnil; > + > DEFVAR_LISP ("this-command-keys-shift-translated", > Vthis_command_keys_shift_translated, > doc: /* Non-nil if the key sequence activating this command was shift-translated. > Thank you! I recompiled Emacs with this and tested with various nested sequential and recursive calls and this correctly reports the top level command the current minibuffer session was entered from, which is exactly what we are looking for :)