From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#45177: 27.1; Access to invoking top level command in minibuffer Date: Mon, 02 Aug 2021 00:03:32 -0400 Message-ID: References: Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29959"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 45177@debbugs.gnu.org To: clemera@posteo.net Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Aug 02 06:04:51 2021 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 1mAPC7-0007Zc-9Q for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 02 Aug 2021 06:04:51 +0200 Original-Received: from localhost ([::1]:50860 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mAPC5-0005vy-Qy for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 02 Aug 2021 00:04:49 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34756) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mAPBK-00059v-QR for bug-gnu-emacs@gnu.org; Mon, 02 Aug 2021 00:04:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:54052) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mAPBK-0007eA-IY for bug-gnu-emacs@gnu.org; Mon, 02 Aug 2021 00:04:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mAPBK-0001EN-Fq for bug-gnu-emacs@gnu.org; Mon, 02 Aug 2021 00:04:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 02 Aug 2021 04:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45177 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: fixed Original-Received: via spool by 45177-submit@debbugs.gnu.org id=B45177.16278770254703 (code B ref 45177); Mon, 02 Aug 2021 04:04:02 +0000 Original-Received: (at 45177) by debbugs.gnu.org; 2 Aug 2021 04:03:45 +0000 Original-Received: from localhost ([127.0.0.1]:37365 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mAPB2-0001Dn-Rh for submit@debbugs.gnu.org; Mon, 02 Aug 2021 00:03:45 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:53604) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mAPAz-0001DV-0X for 45177@debbugs.gnu.org; Mon, 02 Aug 2021 00:03:43 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id A47D1100216; Mon, 2 Aug 2021 00:03:34 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 1473E100201; Mon, 2 Aug 2021 00:03:33 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1627877013; bh=T7+ky01QMYp0Y9JPxOAvbEClzLamU4FZ9QICXshCBYk=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=GgaIablhnvExVeDgIqCG4eO+dTKgRqLQPXVerl0GMnVufx58Uhyprn+g+/uFVHKsM 52hA5m4swnGCtoFlRrEtgUI1vDOilTOzyoboF7Bog/8ttjR0jIAGfZRBd9EKeaEtWo p1/gEsX4wfZ/J6mc5oacsk/nuY97nuvvm8ShtPetpNrhkMEoXU3nQas9UP/gjoAYoJ pJhIzMMqal2hr5I+frk/N4NCt1Dzmu5wigyDWOB+SoEtZTgEpFkYwSWZO02KjrhRrW VVUwC73FCOwG/mJwouLhdRQIutzqTTLDecNCSI+djq46Zwqf/F4aZnH935k3f4vh1r tBDXImZr1liPw== Original-Received: from alfajor (unknown [216.154.29.138]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id CF3AE1204B4; Mon, 2 Aug 2021 00:03:32 -0400 (EDT) In-Reply-To: (Stefan Monnier's message of "Sun, 01 Aug 2021 18:42:05 -0400") 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:211058 Archived-At: [ Resending because of that damn archiving misfeature. ] clemera@posteo.net [2020-12-11 15:20:34] wrote: > For command based settings it would be nice to be able to have > access to the top level command from which the current minibuffer > session was invoked from. This should also work with multiple minibuffer > invokations during a command. Using `minibuffer-setup-hook' to save > `real-this-command' does not work, for example with: > > ```elisp > (defun example-command () > (interactive) > (read-string "Example: ") > (message "%s" real-this-command)) > ``` > > `real-this-command' will be `exit-minibuffer' after the `read-string' so any > minibuffer invokation within that command afterwards will no longer know > about `example-command'. If you invoke `example-command` from an alias, you won't get "the right" answer either anyway. > The described issue is problem for completion frameworks. The popular > Ivy(https://github.com/abo-abo/swiper/) package from GNU ELPA does use the > `:caller` argument passed to `ivy-read` to circumvent this. With > Selectrum(https://github.com/raxod502/selectrum/) we are trying to find > a built-in way to handle this. I think this is an XY problem. Changing the behavior based on the caller's name is a very bad idea. It's a bit like `called-interactively-p`, except it's worse because you're looking for even more ill-defined data than just a boolean. The standard UI has introduced the `category` metadata for that kind of problems. I don't claim it's a perfect solution, but whichever "right" solution we come up with it should not be based on the name of the caller but instead it should be based on data provided by the caller. Stefan