unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: clemera@posteo.net
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 45177@debbugs.gnu.org
Subject: bug#45177: 27.1; Access to invoking top level command in minibuffer
Date: Sun, 13 Dec 2020 14:29:01 +0100	[thread overview]
Message-ID: <fc41a0ff-a885-fa64-896c-19ce7b6e2c53@posteo.de> (raw)
In-Reply-To: <87mtyh6ga5.fsf@gnus.org>



> 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 :)








  reply	other threads:[~2020-12-13 13:29 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-11 14:20 bug#45177: 27.1; Access to invoking top level command in minibuffer clemera
2020-12-11 17:35 ` Drew Adams
2020-12-12 13:28   ` Clemens
2020-12-12 13:39   ` clemera
2020-12-11 20:41 ` Lars Ingebrigtsen
2020-12-12 13:31   ` clemera
2020-12-13 12:29     ` Lars Ingebrigtsen
2020-12-13 13:29       ` clemera [this message]
2020-12-14 15:45         ` Lars Ingebrigtsen
2020-12-14 17:52           ` Clemens
2020-12-14 18:01           ` Clemens
2020-12-15  6:18             ` Lars Ingebrigtsen
2020-12-15 11:58               ` Clemens
     [not found]           ` <jwvk0l4ail0.fsf-monnier+emacs@gnu.org>
2021-08-02  4:04             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-08-04  5:49               ` Lars Ingebrigtsen
2020-12-13 13:39       ` clemera
2020-12-13 14:16       ` clemera
2021-01-12  8:46         ` Clemens
2020-12-12 20:14   ` Juri Linkov
2020-12-12 21:25     ` clemera
2020-12-13  8:47       ` Juri Linkov
2020-12-13 11:40         ` clemera
2020-12-13 11:45         ` clemera
     [not found] ` <jwvpmuwaj0o.fsf-monnier+emacs@gnu.org>
2021-08-02  4:03   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-08-04  5:51     ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fc41a0ff-a885-fa64-896c-19ce7b6e2c53@posteo.de \
    --to=clemera@posteo.net \
    --cc=45177@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).