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#61176: post-command-hook is not run if minibuffer input is aborted Date: Sun, 05 Feb 2023 09:47:42 -0500 Message-ID: References: <87y1pk2h8t.fsf@bernoul.li> <87sffojfs0.fsf@bernoul.li> 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="7674"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 61176@debbugs.gnu.org To: Jonas Bernoulli Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Feb 05 15:48:15 2023 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 1pOgJT-0001iF-1U for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 05 Feb 2023 15:48:15 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pOgJJ-0005Ge-4O; Sun, 05 Feb 2023 09:48:05 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pOgJG-0005GT-Rj for bug-gnu-emacs@gnu.org; Sun, 05 Feb 2023 09:48:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pOgJG-0004rD-Jw for bug-gnu-emacs@gnu.org; Sun, 05 Feb 2023 09:48:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pOgJG-0001dc-4K for bug-gnu-emacs@gnu.org; Sun, 05 Feb 2023 09:48:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 05 Feb 2023 14:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61176 X-GNU-PR-Package: emacs Original-Received: via spool by 61176-submit@debbugs.gnu.org id=B61176.16756084786265 (code B ref 61176); Sun, 05 Feb 2023 14:48:02 +0000 Original-Received: (at 61176) by debbugs.gnu.org; 5 Feb 2023 14:47:58 +0000 Original-Received: from localhost ([127.0.0.1]:44460 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOgJB-0001cx-MJ for submit@debbugs.gnu.org; Sun, 05 Feb 2023 09:47:58 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:42783) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOgJ9-0001c4-EH for 61176@debbugs.gnu.org; Sun, 05 Feb 2023 09:47:56 -0500 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 8E30D1000C7; Sun, 5 Feb 2023 09:47:49 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id D113F100048; Sun, 5 Feb 2023 09:47:43 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1675608463; bh=Liy96rWQ6QVTXqLxuTnGnXmUDbNaCVpjJIMFOLQDHzA=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=QnZ5ugunue7L4pmK1UxEIaeSG/W7FIdoTFB4VaZi8wvop3MmPAtJrQ69glvMx87mY VTmo+raEj2cPtP92yA66ckW6vECc25aROLzv93ZvG/jzxPeLfs56ZKXg6CqSlNsXBy Zq8ZKFmX/YeoyO9S3eAFogjBarSgHlesWIjAI23BvPvrdfcJ7c5pJIN7xaKmhwg+Kl Xjk5t8kjblgh16OJDQJfnc2FfKfkjy7XtwtgZUDs1BXxShPoxNdKBdAFI8mgYuO3GI bSX7tZ/0NbupIgpUxfZjbv9Wbof1zCyWs15pf23VM/KO12myUM2ZEnMr9uv/RJnWHx 39Cx4noTVM4Ow== Original-Received: from pastel (unknown [104.247.245.112]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id A87A1121321; Sun, 5 Feb 2023 09:47:43 -0500 (EST) In-Reply-To: <87sffojfs0.fsf@bernoul.li> (Jonas Bernoulli's message of "Thu, 02 Feb 2023 15:36:15 +0100") 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:254859 Archived-At: > And if the user DOES abort, I would like the behavior to be changed like > so: > >>> ;; -setup ([f1] -command) >>> ;; -post ([] -command) >>> ;; -exit ([7] abort-minibuffers) >>> ;; Quit >>> ;; -post ([] abort-minibuffers) > *NEW* -post ([f1] -command) Hmm... fully agreed and I wonder why it's not run. [ The rest of the discussion is largely independent from this. ] > The suffix command may use the minibuffer inside interactive and/or in > its body. If that happens, then transient has to suspend the transient > keymap and pre- and post-command functions, while the minibuffer is in > use. FWIW, I have played with similar issues in the context of prefix commands and `set-transient-map` (yet, can't find the corresponding code, sorry) and I remember using `minibuffer-depth` to detect the use of a minibuffer (i.e. record the original `minibuffer-depth` and/or `recursion-depth` compare it to the current depth in `pre-command-hook`). I see `transient.el` also uses `minibuffer-depth`, so I guess I'm not telling you anything you didn't already know. I also remember considering adding hooks to `read-from-minibuffer` and `recursive-edit` so we can more proactively and reliably let-bind variables around them (e.g. we should let-bind `this-command` around them). Stefan