From unknown Wed Jun 18 23:06:59 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#56425 <56425@debbugs.gnu.org> To: bug#56425 <56425@debbugs.gnu.org> Subject: Status: 28.1; post-command-hook is triggered on y-or-n-p Reply-To: bug#56425 <56425@debbugs.gnu.org> Date: Thu, 19 Jun 2025 06:06:59 +0000 retitle 56425 28.1; post-command-hook is triggered on y-or-n-p reassign 56425 emacs submitter 56425 Bhavin Gandhi severity 56425 normal tag 56425 notabug thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Jul 06 13:56:21 2022 Received: (at submit) by debbugs.gnu.org; 6 Jul 2022 17:56:21 +0000 Received: from localhost ([127.0.0.1]:55065 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o99G8-0007w3-Sw for submit@debbugs.gnu.org; Wed, 06 Jul 2022 13:56:21 -0400 Received: from lists.gnu.org ([209.51.188.17]:45600) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o99G6-0007vv-M0 for submit@debbugs.gnu.org; Wed, 06 Jul 2022 13:56:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34950) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o99G6-0002Mq-Dm for bug-gnu-emacs@gnu.org; Wed, 06 Jul 2022 13:56:18 -0400 Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]:43780) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o99G4-0008S2-B9 for bug-gnu-emacs@gnu.org; Wed, 06 Jul 2022 13:56:18 -0400 Received: by mail-ej1-x62d.google.com with SMTP id n4so9116634ejz.10 for ; Wed, 06 Jul 2022 10:56:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=mFiKHxbIIvHNA34x3SHgtT2NyHEd7bB3HqqA6q+HKVA=; b=OoxXPTQ6gFTS/JkQhd07ZQxUSZYzRIHjNaooaxj6MYUqeA3s4nvtipB1pdKcAo4Zim PRpZjQ3jmCCEPcUAhJeoMa3jFUlGa+DryOW6tUji4o4+Q7P6UOVRylKENk5BEqAcCiX4 e7/JFNe296pi9MsMHViInLW9onDYrBL6UiaWTB6AIv0U5F4UJQSMlx1y/N53LzhgPxIX OlOdxHj61mAe+yP5EpNRRDF83FUuZKb16vMILWgcKMjSVN30EzL+dEpoOlORpZsn9YXs ugOHfNF/rRqx9osXGjlFVwQb2+p9sZA1SLK426UiK7kPGITHfp0BJaVsTSpCq8fbt5H0 mF5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=mFiKHxbIIvHNA34x3SHgtT2NyHEd7bB3HqqA6q+HKVA=; b=My7eeanRfsI6CuWAo5SWnTXJIYJOV9TmLKcS+PIc9bFe8Kg7VGutxCgRapUZv8ilIw W72uTg3er0+Grndb+wLcu2A09LpozpjIEx0ls9Pqw1vVelDffvhO09IjUErJmVWLlKEz 3trtrtbemac+7ts6Bev1cl6cPJMKF+a0f5XaQov3ht+fcThVLZxAV7jcvwL4tRZquq5S xBaLRXlnnadf6JQTqmB9yg1ebE+M12TrBCmVo58W8MKfdjx010PVtKUhC5N6b/FpXXw5 BlAjM4aGVvRyQl6YiScD6ZlbOWfMDVlTJD4r2Tvel93vO7pt5Lcwg2LRMDtIYMHjygrI qNmg== X-Gm-Message-State: AJIora9QORluRtPgDZtjnHh7DefT9lk6dzBplOw63pUA7bhcndZjl4Ry M17VlXRmE4NnsSB1bXv/g6Ibbl4K4YEyHJe/1GSQcfvW7LXFuw== X-Google-Smtp-Source: AGRyM1s5WIZbH7mAKwNF2fTuJhgfPWnJSVguoZ4yLGE88+HcSQryaKyrJu/+lIxKmEiIHlc3pMOwx40+C1LwqVxQ7/4= X-Received: by 2002:a17:907:2cf4:b0:72a:47b1:32ee with SMTP id hz20-20020a1709072cf400b0072a47b132eemr37893285ejc.293.1657130173600; Wed, 06 Jul 2022 10:56:13 -0700 (PDT) MIME-Version: 1.0 From: Bhavin Gandhi Date: Wed, 6 Jul 2022 23:25:34 +0530 Message-ID: Subject: 28.1; post-command-hook is triggered on y-or-n-p To: bug-gnu-emacs@gnu.org Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=2a00:1450:4864:20::62d; envelope-from=bhavin7392@gmail.com; helo=mail-ej1-x62d.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.1 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.1 (--) Run emacs -Q and evaluate following code: (defvar my-hook-counter) (defun my-test-command () (interactive) (message "my-test-command: setting post-command-hook") (setq my-hook-counter 3) (add-hook 'post-command-hook 'my-own-hook) (y-or-n-p "Some question: ") (message "my-test-command: message after setting the hook") ) (defun my-own-hook () (print (format "hook: this: %s, real: %s, last: %s" this-command real-this-command last-command)) (message "my-own-hook: hopefully executing at the end") (setq my-hook-counter (- my-hook-counter 1)) (if (eq my-hook-counter 0) (remove-hook 'post-command-hook 'my-own-hook)) ) 1. M-x my-test-command 2. Emacs is now waiting for the input in the minibuffer. And also the post-command-hook executes here. minibuffer] Some question: (y or n) [my-own-hook: hopefully executing at the end] 3. Answer y in the minibuffer. minibuffer] my-test-command: message after setting the hook In the *Messages* buffer the sequence is: --8<---------------cut here---------------start------------->8--- my-test-command: setting post-command-hook "hook: this: my-test-command, real: my-test-command, last: keyboard-quit" my-own-hook: hopefully executing at the end ^^^^^ unexpected execution of post-command-hook for my-test-command Some question: (y or n) y my-test-command: message after setting the hook "hook: this: my-test-command, real: y-or-n-p-insert-y, last: my-test-command" my-own-hook: hopefully executing at the end --8<---------------cut here---------------end--------------->8--- When I run M-x my-test-command, the post-command-hook is executed while Emacs is waiting for the user input (y-or-n-p) in the minibuffer. And we get this in *Messages* buffer: "hook: this: my-test-command, real: my-test-command, last: keyboard-quit" My initial thought was that the y-or-n-p call is causing it. Looking at the code of y-or-n-p with my limited Elisp knowledge, it doesn't seems to be an interactive function, and there aren't any calls to interactive functions till it prints the message "Some question: " in minibuffer. And, from the print statement this-command is my-test-command and not y-or-n-p. Also, my-test-command has not finished executing yet, it is waiting for user input, so how does it trigger the post-command-hook? I'm not able to understand what causes it to trigger the post-command-hook, is it an expected behavior? I'm I missing something here? Is read-from-minibuffer triggering the post-command-hook? In GNU Emacs 28.1 (build 1, x86_64-redhat-linux-gnu, GTK+ Version 3.24.31, cairo version 1.17.6) of 2022-05-12 built on 798eb2d274a4426aa2879373741c952d Windowing system distributor 'The X.Org Foundation', version 11.0.12201002 System Description: Fedora Linux 36 (Workstation Edition) Configured using: 'configure --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --program-prefix= --disable-dependency-tracking --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64 --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/var/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-dbus --with-gif --with-jpeg --with-png --with-rsvg --with-tiff --with-xft --with-xpm --with-x-toolkit=gtk3 --with-gpm=no --with-xwidgets --with-modules --with-harfbuzz --with-cairo --with-json --with-native-compilation build_alias=x86_64-redhat-linux-gnu host_alias=x86_64-redhat-linux-gnu CC=gcc 'CFLAGS=-DMAIL_USE_LOCKF -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection' LDFLAGS=-Wl,-z,relro PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM XWIDGETS GTK3 ZLIB Important settings: value of $LANG: en_US.UTF-8 value of $XMODIFIERS: @im=ibus locale-coding-system: utf-8-unix Major mode: Messages Minor modes in effect: tooltip-mode: t global-eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t buffer-read-only: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr ispell dabbrev emacsbug message rmc puny dired dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068 epg-config gnus-util rmail rmail-loaddefs auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs password-cache json map text-property-search time-date subr-x seq byte-opt gv bytecomp byte-compile cconv mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils iso-transl tooltip eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice button loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote threads xwidget-internal dbusbind inotify dynamic-setting system-font-setting font-render-setting cairo move-toolbar gtk x-toolkit x multi-tty make-network-process native-compile emacs) Memory information: ((conses 16 73671 7615) (symbols 48 6866 0) (strings 32 20919 2083) (string-bytes 1 717484) (vectors 16 14470) (vector-slots 8 304968 20189) (floats 8 34 64) (intervals 56 371 0) (buffers 992 12)) -- Bhavin Gandhi (bhavin192) | https://geeksocket.in From debbugs-submit-bounces@debbugs.gnu.org Wed Jul 06 14:21:30 2022 Received: (at 56425) by debbugs.gnu.org; 6 Jul 2022 18:21:30 +0000 Received: from localhost ([127.0.0.1]:55140 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o99eU-0000GK-Be for submit@debbugs.gnu.org; Wed, 06 Jul 2022 14:21:30 -0400 Received: from relay11.mail.gandi.net ([217.70.178.231]:45969) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o99eR-0000G4-SW for 56425@debbugs.gnu.org; Wed, 06 Jul 2022 14:21:29 -0400 Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id 7E233100004; Wed, 6 Jul 2022 18:21:18 +0000 (UTC) From: Juri Linkov To: Bhavin Gandhi Subject: Re: bug#56425: 28.1; post-command-hook is triggered on y-or-n-p In-Reply-To: (Bhavin Gandhi's message of "Wed, 6 Jul 2022 23:25:34 +0530") Organization: LINKOV.NET References: Date: Wed, 06 Jul 2022 21:19:00 +0300 Message-ID: <86wncqrtnv.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 56425 Cc: 56425@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) > Is read-from-minibuffer triggering the post-command-hook? This is the most interesting question. When you replace the y-or-n-p call in your code with read-from-minibuffer, do you see the same result? If not, then maybe these lines y-or-n-p affect the behavior somehow, but I'm sure: ;; Protect this-command when called from pre-command-hook (bug#45029) (this-command this-command) If all fails, then as the last resort you always have an option to fall back to the modal behavior of y-or-n-p by wrapping the call with y-or-n-p-use-read-key: (let ((y-or-n-p-use-read-key t)) (y-or-n-p "Some question: ")) From debbugs-submit-bounces@debbugs.gnu.org Wed Jul 06 15:03:58 2022 Received: (at 56425) by debbugs.gnu.org; 6 Jul 2022 19:03:58 +0000 Received: from localhost ([127.0.0.1]:55189 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o9AJa-0001Qs-Kd for submit@debbugs.gnu.org; Wed, 06 Jul 2022 15:03:58 -0400 Received: from eggs.gnu.org ([209.51.188.92]:36588) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o9AJY-0001Qc-6f for 56425@debbugs.gnu.org; Wed, 06 Jul 2022 15:03:57 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:53730) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o9AJS-0004ZS-Sx; Wed, 06 Jul 2022 15:03:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=cgfXDJ/78UBQ82pzwdyQ4K5jmcwpv88toqZQGDfQ67I=; b=V33AAPqjlrgE Ys93KuJfwA6p8sisEt01CS+eU8Lwvwtgdqyae2IKtGoJZUI7uNHjGTU70qGki0BlkYvAUGMpSCzKt 88FGxbxkgIcKVKsxIlfqdyvRIxwlaHZyr5BE23qzMFTo+OIqjJNzduuTQ9lxWktIOR5tPQ7gb4bsv n5DuhgG2pTXJvWI8S0kbJ0fkVJF3VNwl3RgpDa78owiFgWT5WaR3sWYLTHJ9bbycUaLjnVIzLdCqP WIWzhA2OEeZnLYc/+GqP+6gFsJ2lQQCsDcxFB0/p4Ag0j+U4ACkc8+m+3yS1Ww1azhQ6qgVbSQktf JODhMtYi4YjY7dPchMD43A==; Received: from [87.69.77.57] (port=4252 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o9AJS-0001gk-BN; Wed, 06 Jul 2022 15:03:50 -0400 Date: Wed, 06 Jul 2022 22:03:45 +0300 Message-Id: <83tu7u5ai6.fsf@gnu.org> From: Eli Zaretskii To: Bhavin Gandhi In-Reply-To: (message from Bhavin Gandhi on Wed, 6 Jul 2022 23:25:34 +0530) Subject: Re: bug#56425: 28.1; post-command-hook is triggered on y-or-n-p References: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 56425 Cc: 56425@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Bhavin Gandhi > Date: Wed, 6 Jul 2022 23:25:34 +0530 > > Also, my-test-command has not finished executing yet, it is waiting for > user input, so how does it trigger the post-command-hook? I'm not able > to understand what causes it to trigger the post-command-hook, is it an > expected behavior? Yes. > I'm I missing something here? Is read-from-minibuffer > triggering the post-command-hook? Yes. Why are you surprised? y-or-n-p invokes read-from-minibuffer, which invokes recursive-edit, which starts a recursive command loop. And the command loop calls post-command-hook on each iteration. From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 07 17:45:15 2022 Received: (at control) by debbugs.gnu.org; 7 Jul 2022 21:45:15 +0000 Received: from localhost ([127.0.0.1]:58212 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o9ZJD-00006O-4Y for submit@debbugs.gnu.org; Thu, 07 Jul 2022 17:45:15 -0400 Received: from mail-pj1-f48.google.com ([209.85.216.48]:44685) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o9ZJC-00005v-6l for control@debbugs.gnu.org; Thu, 07 Jul 2022 17:45:14 -0400 Received: by mail-pj1-f48.google.com with SMTP id o3-20020a17090a744300b001ef8f7f3dddso88722pjk.3 for ; Thu, 07 Jul 2022 14:45:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:mime-version:date:message-id:subject:to; bh=T3fb19UTr5EURYDaQzI8DHRffz7qDNL/+1a7wdlpUv0=; b=V5VU/m6HGVamaIxlsRIGB7R8dPu2f2DDJGYSAXmrk4DmsNeQN8QxABcPs9fKzKyOx9 +T5QATNu6M4u5GXctpK3Ebya+S8GKmSNeiFWDFtmQOeaMMhFT0j6gs4NDVBtwA71bMXQ 8jq1ruAwcJp643OqGTdrPnKjHdqyH5Q4A1IvlqMMHpSYiyQ2Xs/Y7Ud18hVbJkIxH/sh IiSUnVXz6j+iNC7vdKuY6Xwxn0ObIIBs0JcpYzerDkIGH1KJQsbhD0+iRlq7mx82saYQ exQXTuZih5leqcoRJR9lihHYznRFqwn9U8NvKST3Heq++CJekuTWIFcdhumBEA9JhBt8 AQWw== X-Gm-Message-State: AJIora8ajO+PxVn3zLRzICjddN2GNt8zw47X73gfUFZi9S+YI45mqvEt 2L5wfr+r3/DEJohfNuPo44/X/nqshZYbu86VcUobT7xp X-Google-Smtp-Source: AGRyM1vLF/7ZQJRIRehPWKp6V0U1FftfYI2F4oDLW/nI0G0c0vUaaazrATipuKlFADTS09zlYj2jV2Fq4rT4YxOYG0s= X-Received: by 2002:a17:903:2444:b0:16b:917e:3b04 with SMTP id l4-20020a170903244400b0016b917e3b04mr71799pls.145.1657230308603; Thu, 07 Jul 2022 14:45:08 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Thu, 7 Jul 2022 14:45:08 -0700 From: Stefan Kangas MIME-Version: 1.0 Date: Thu, 7 Jul 2022 14:45:08 -0700 Message-ID: Subject: control message for bug #56425 To: control@debbugs.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) # not a bug, probably tags 56425 + notabug quit From debbugs-submit-bounces@debbugs.gnu.org Mon Jul 11 06:54:37 2022 Received: (at 56425) by debbugs.gnu.org; 11 Jul 2022 10:54:37 +0000 Received: from localhost ([127.0.0.1]:38494 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oAr3l-0003B1-Im for submit@debbugs.gnu.org; Mon, 11 Jul 2022 06:54:37 -0400 Received: from quimby.gnus.org ([95.216.78.240]:49776) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oAr3j-0003Ak-RQ for 56425@debbugs.gnu.org; Mon, 11 Jul 2022 06:54:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:Date:References: In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=ef9pYw50yOBPIDv0XzmRDmINY0mx+e96s9GQU7728HI=; b=nIch2TjQ4j3Bh++jwKDh+tnn7t LctrnwaYhmo7SpJIlfzgEhd1G0QYKIuVATU6EhEVI8A8sPSJM78CVDDhb1X2u7VKdmPLxp54NQ2E7 y2s3NYU8Rmeai/P8q2jH+iABeil74rg6UarX8x0z07FsaH2tP+egGKlMDU3n2BbvUg1o=; Received: from [84.212.220.105] (helo=joga) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oAr3a-0001y8-Si; Mon, 11 Jul 2022 12:54:29 +0200 From: Lars Ingebrigtsen To: Eli Zaretskii Subject: Re: bug#56425: 28.1; post-command-hook is triggered on y-or-n-p In-Reply-To: <83tu7u5ai6.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 06 Jul 2022 22:03:45 +0300") References: <83tu7u5ai6.fsf@gnu.org> X-Now-Playing: Soft Cell's _Cruelty Without Beauty: Remixes_: "Together Alone (2020 Extended Mix)" Date: Mon, 11 Jul 2022 12:54:26 +0200 Message-ID: <87v8s3yl5p.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Eli Zaretskii writes: > Why are you surprised? y-or-n-p invokes read-from-minibuffer, which > invokes recursive-edit, which starts a recursive command loop. And > the command loop calls post-command-hook on each iteration. Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 56425 Cc: Bhavin Gandhi , 56425@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Eli Zaretskii writes: > Why are you surprised? y-or-n-p invokes read-from-minibuffer, which > invokes recursive-edit, which starts a recursive command loop. And > the command loop calls post-command-hook on each iteration. When writing post-command-hook code, you have to be check whether you're in the context you want to be (for instance, in the minubuffer or not). I think it's always been this way, but these day we use the read-from-minibuffer a lot more than we used to -- so y-or-n-p didn't use to have this issue, but it does now. But I think things are working as designed here, basically, so I'm closing this bug report. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Mon Jul 11 06:54:43 2022 Received: (at control) by debbugs.gnu.org; 11 Jul 2022 10:54:43 +0000 Received: from localhost ([127.0.0.1]:38497 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oAr3q-0003BN-S9 for submit@debbugs.gnu.org; Mon, 11 Jul 2022 06:54:43 -0400 Received: from quimby.gnus.org ([95.216.78.240]:49792) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oAr3p-0003Av-OG for control@debbugs.gnu.org; Mon, 11 Jul 2022 06:54:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=jUu+lT2SexwE2CLYW4e9ijnUn5UPBW7zf72IP0qeA5E=; b=jGrUGZo3+VgtiqnxVzjijYZci8 MqKsS0ANa+sLhtjsnOhHk5ras1Qo05MYwTXabPjLy/2QilB1t05wm2/12nGf+8kHfPijwCR5qsARz 1SG11PWwToUA8CoIXFKYO2jleacIaeOaSspT2oC+Z5sh5uAboGP/aGMYGh+/HvRjLT84=; Received: from [84.212.220.105] (helo=joga) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oAr3h-0001yI-Lc for control@debbugs.gnu.org; Mon, 11 Jul 2022 12:54:35 +0200 Date: Mon, 11 Jul 2022 12:54:31 +0200 Message-Id: <87tu7nyl5k.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #56425 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: close 56425 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) close 56425 quit From debbugs-submit-bounces@debbugs.gnu.org Mon Jul 11 07:39:54 2022 Received: (at 56425) by debbugs.gnu.org; 11 Jul 2022 11:39:54 +0000 Received: from localhost ([127.0.0.1]:38644 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oArla-0000Qp-7y for submit@debbugs.gnu.org; Mon, 11 Jul 2022 07:39:54 -0400 Received: from eggs.gnu.org ([209.51.188.92]:49354) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oArlY-0000Qe-Nu for 56425@debbugs.gnu.org; Mon, 11 Jul 2022 07:39:53 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:52048) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oArlT-0005eR-Fm; Mon, 11 Jul 2022 07:39:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=fvuh3kBwQm3cbTwVrn/yTtkDsi2+ldDYGGw4yx9smFM=; b=pvJvV0qJ+JbY QoAr0dYDYRJCaGcsDHC66oM1aNKRGEhF8Szu9YpQHOfFkDHdkobRnrFql67gu27/IlxS+ne6hR31K Lmj6JAlRp2JO+FswRn9wHuY/AzYsb9uPPKjAgpiJd6j/su93rpRTyZ/8bAAJrKsCPlSsCkl1LiZ2c Dhjn4yL0HUhXIQ8Dwfcs1IaW0VqERhskXAST7kMYrUChsjJOtalFXmoZorpP7AFwa8SHXjzjcbax/ Ncizl61rzXr9y1k4wafgjxJwLm2UvgrM72tqA/Mxjk4olqVAvrTNrOPTUbRNIro6yGZG1yn7kvuHr r/QWA7BeVp0wV7FfbdQdWg==; Received: from [87.69.77.57] (port=4044 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oArlP-0003sp-J8; Mon, 11 Jul 2022 07:39:47 -0400 Date: Mon, 11 Jul 2022 14:39:31 +0300 Message-Id: <83r12rzxn0.fsf@gnu.org> From: Eli Zaretskii To: Lars Ingebrigtsen In-Reply-To: <87v8s3yl5p.fsf@gnus.org> (message from Lars Ingebrigtsen on Mon, 11 Jul 2022 12:54:26 +0200) Subject: Re: bug#56425: 28.1; post-command-hook is triggered on y-or-n-p References: <83tu7u5ai6.fsf@gnu.org> <87v8s3yl5p.fsf@gnus.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 56425 Cc: bhavin7392@gmail.com, 56425@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Lars Ingebrigtsen > Cc: Bhavin Gandhi , 56425@debbugs.gnu.org > Date: Mon, 11 Jul 2022 12:54:26 +0200 > > Eli Zaretskii writes: > > > Why are you surprised? y-or-n-p invokes read-from-minibuffer, which > > invokes recursive-edit, which starts a recursive command loop. And > > the command loop calls post-command-hook on each iteration. > > When writing post-command-hook code, you have to be check whether you're > in the context you want to be (for instance, in the minubuffer or not). > I think it's always been this way, but these day we use the > read-from-minibuffer a lot more than we used to -- so y-or-n-p didn't > use to have this issue, but it does now. Yes. Code that wants to distinguish these cases from "normal" post-command-hook invocations should examine the value of minibuffer-depth, I think. From unknown Wed Jun 18 23:06:59 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 09 Aug 2022 11:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator