From unknown Fri Jun 13 11:33:40 2025 X-Loop: help-debbugs@gnu.org Subject: bug#54438: 27.2; inconsistent-behavior-global-vs-local-hook Resent-From: dalanicolai Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 17 Mar 2022 18:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 54438 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 54438@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16475399634028 (code B ref -1); Thu, 17 Mar 2022 18:00:02 +0000 Received: (at submit) by debbugs.gnu.org; 17 Mar 2022 17:59:23 +0000 Received: from localhost ([127.0.0.1]:55137 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nUuPC-00012t-4t for submit@debbugs.gnu.org; Thu, 17 Mar 2022 13:59:23 -0400 Received: from lists.gnu.org ([209.51.188.17]:44184) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nUuPA-00012m-Io for submit@debbugs.gnu.org; Thu, 17 Mar 2022 13:59:21 -0400 Received: from eggs.gnu.org ([209.51.188.92]:52866) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nUuPA-0001ev-B0 for bug-gnu-emacs@gnu.org; Thu, 17 Mar 2022 13:59:20 -0400 Received: from [2607:f8b0:4864:20::92b] (port=36547 helo=mail-ua1-x92b.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nUuP7-00026P-PS for bug-gnu-emacs@gnu.org; Thu, 17 Mar 2022 13:59:19 -0400 Received: by mail-ua1-x92b.google.com with SMTP id z10so2369248uaa.3 for ; Thu, 17 Mar 2022 10:59:16 -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=MB8QBJqXYtvi2k078qV5TKc77V8MRHTVl3rAwqQEn58=; b=imK4zTiDB7R9BDJtOnkf4FQ0cU5N6/7wbAMuTQbKQqn7pQL55MOYz3ISfyAB0t67E/ L8p0Lv0hdYfxEgOGpLRypxL4/NLbnB6mWPdSlGWJAa2VXKrLW/+7BsoXpD4fvO673Dsf /mnfiMzQDem6EN+4Hf8ZqetusQ9fk/tiVPxn2uP9DH0gRjCumNhJ1Ll3ryH1+MVlhOrW 9FsA+kAjA2At1A3LwRs/AgPZSTGPyL2Nwt9W8dduxLPMpx28X7U3XIRj9p9CQPfRtMZd YpQAN2bbuDcTKdvx0uItX/ALzIqmMWirmgD8R/6x0LJf+z8JMDLGsa5OBnde7BLVIss8 p5Sg== 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=MB8QBJqXYtvi2k078qV5TKc77V8MRHTVl3rAwqQEn58=; b=5Eagv2eUICnIqj38o3nWzvrRrqeC2NL0QseH3fc9EGR0xV485ezFVYXaT4FNzFlL65 kfYoX8H08ly4MjMhigKfheAFd5nlDK3+A4zUCQGMh9jq+rfcLTvQE5PSJKLKtImYkx/y hiylBjIU0sj4DYggALkzvtFYDg4lLMlWsJ1gMIZdccIyMld+hVSTYT2EPYr2iT2a0G43 HvXpSO4NXcEvqKm2F8x7ETaSpokGBwL0mNqr15KOAW62SwiU9REg+JnL6I4y8qpjBZjs RfmYZlA7gvW7h4pbJ2eZp0iNct5QFV9nt0kA4qmfpCfJJtqg3zfx0JxPbc02Z4yWK/c/ D1nw== X-Gm-Message-State: AOAM5315rXlWHHlzmQj9sM8J+XpIOCLR1r66nxK+REjP9yI6XnDcmkb5 op1e+mTmT2UyMx4rbKuJ9ek2QaR3TqORsR20jDQV2f9Gb/LJUg== X-Google-Smtp-Source: ABdhPJznaNky8gmEjphclUZ9EnF+UhW+4oEGd8x33mio8XGVQDSy4FyHE/z8ppbu/dTr82dG0Wf/v6xpfg1sTgknbwo= X-Received: by 2002:a0d:e201:0:b0:2e5:9918:7f5 with SMTP id l1-20020a0de201000000b002e5991807f5mr7098479ywe.8.1647539589382; Thu, 17 Mar 2022 10:53:09 -0700 (PDT) MIME-Version: 1.0 From: dalanicolai Date: Thu, 17 Mar 2022 18:52:58 +0100 Message-ID: Content-Type: multipart/alternative; boundary="000000000000fa8a7105da6db346" X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::92b (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::92b; envelope-from=dalanicolai@gmail.com; helo=mail-ua1-x92b.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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_FROM=0.001, HTML_MESSAGE=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.2 (/) 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.3 (--) --000000000000fa8a7105da6db346 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I am trying to pop to some (input) buffer when opening some (main) buffer (for a gitter chat client, which is handy for Spacemacs interactive support). Anyway, I am trying to use a local hook-function which 'pops up' the input buffer. As I am using pop-to-buffer, the input buffer should get selected. However, it does not get selected when using a local hook, while it does work as expected when using the global hook. I have used the following test code: (defun pop-up () (pop-to-buffer "pop-up")) (defun test () (interactive) (with-current-buffer (get-buffer-create "test") (add-hook 'window-configuration-change-hook #'pop-up))) ;; (add-hook 'window-configuration-change-hook #'pop-up nil t) ;; the following line triggers the `pop-up` hook function (pop-to-buffer "test"))) ;; evaluate code to remove the (global) hook (remove-hook 'window-configuration-change-hook #'pop-up) So you can start from emacs -Q, evaluate the above code, and do `M-x test`, as expected the 'pop-up' buffer will be selected. Now remove the hook (by evaluating the last line), then comment out the global hook and uncomment the local hook. Again do `M-x test`, this time, the 'test' buffer, wrongly and inconsistently, will be selected. To me this behavior looks like a bug. In GNU Emacs 27.2 (build 1, x86_64-redhat-linux-gnu, GTK+ Version 3.24.30, cairo version 1.17.4) of 2021-08-07 built on buildvm-x86-31.iad2.fedoraproject.org Windowing system distributor 'The X.Org Foundation', version 11.0.12014000 System Description: Fedora Linux 35 (Workstation Edition) Recent messages: Quit scroll-up-command: End of buffer user-error: No buttons! You can run the command =E2=80=98kill-buffer=E2=80=99 with C-x k delete-window: Attempt to delete minibuffer or sole ordinary window test2 (test evil-refresh-cursor window--adjust-process-windows) user-error: No replacement character typed evil-line-move: End of buffer Quit [4 times] (evil-refresh-cursor window--adjust-process-windows) Configured using: 'configure --build=3Dx86_64-redhat-linux-gnu --host=3Dx86_64-redhat-linux-gnu --program-prefix=3D --disable-dependency-tracking --prefix=3D/usr --exec-prefix=3D/usr --bindir=3D/usr/bin --sbindir=3D/usr/sbin --sysconfdir=3D/etc --datadir=3D/usr/share --includedir=3D/usr/include --libdir=3D/usr/lib64 --libexecdir=3D/usr/libexec --localstatedir=3D/var --sharedstatedir=3D/var/lib --mandir=3D/usr/share/man --infodir=3D/usr/share/info --with-dbus --with-gif --with-jpeg --with-png --with-rsvg --with-tiff --with-xft --with-xpm --with-x-toolkit=3Dgtk3 --with-gpm=3Dno --with-xwidgets --with-modules --with-harfbuzz --with-cairo --with-json build_alias=3Dx86_64-redhat-linux-gnu host_alias=3Dx86_64-redhat-linux-gnu CC=3Dgcc 'CFLAGS=3D-DMAIL_USE_LOCKF -= O2 -flto=3Dauto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=3Dformat-security -Wp,-D_FORTIFY_SOURCE=3D2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=3D/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=3D/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=3Dgeneric -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection' LDFLAGS=3D-Wl,-z,relro PKG_CONFIG_PATH=3D:/usr/lib64/pkgconfig:/usr/share/pkgconfig' Configured features: XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND DBUS GSETTINGS GLIB NOTIFY INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS XWIDGETS LIBSYSTEMD JSON PDUMPER GMP Important settings: value of $LANG: en_US.UTF-8 value of $XMODIFIERS: @im=3Dibus locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: marginalia-mode: t savehist-mode: t vertico-mode: t recentf-mode: t shell-dirtrack-mode: t evil-mode: t evil-local-mode: t global-undo-tree-mode: t undo-tree-mode: t override-global-mode: t tooltip-mode: t global-eldoc-mode: t eldoc-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 line-number-mode: t transient-mark-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs format-spec rfc822 mml mml-sec epa derived epg epg-config gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils help-fns radix-tree cl-print debug backtrace find-func cursor-sensor time-date consult-vertico consult bookmark text-property-search pp mule-util rx marginalia savehist orderless vertico evil-nerd-commenter evil-nerd-commenter-operator evil-nerd-commenter-sdk sgml-mode dom which-key bind-map recentf tree-widget wid-edit evil evil-keybindings evil-integration evil-maps evil-commands reveal flyspell ispell evil-jumps evil-command-window evil-types evil-search evil-ex shell pcomplete comint ansi-color evil-macros evil-repeat evil-states evil-core advice evil-common windmove thingatpt rect evil-digraphs evil-vars ring edmacro kmacro undo-tree diff cl-extra help-mode use-package use-package-ensure use-package-delight use-package-diminish use-package-bind-key bind-key easy-mmode use-package-core finder-inf info package easymenu browse-url url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs password-cache json subr-x map url-vars seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib chemacs tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type 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 elisp-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock syntax facemenu 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 charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote threads dbusbind inotify dynamic-setting system-font-setting font-render-setting xwidget-internal cairo move-toolbar gtk x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 289213 15010) (symbols 48 19826 1) (strings 32 93633 2529) (string-bytes 1 2476732) (vectors 16 32184) (vector-slots 8 380120 15630) (floats 8 94 84) (intervals 56 693 0) (buffers 1000 14)) --000000000000fa8a7105da6db346 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I am trying to pop to some (input) buffer when opening som= e (main)
buffer (for a gitter chat client, which is handy for Spacemacs<= br>interactive support). Anyway, I am trying to use a local hook-functionwhich 'pops up' the input buffer. As I am using pop-to-buffer, th= e input
buffer should get selected. However, it does not get selected wh= en using
a local hook, while it does work as expected when using the glo= bal hook.

I have used the following test code:

(defun pop-up = ()
=C2=A0 (pop-to-buffer "pop-up"))

(defun test ()
= =C2=A0 (interactive)
=C2=A0 (with-current-buffer (get-buffer-create &quo= t;test")
=C2=A0 =C2=A0 (add-hook 'window-configuration-change-h= ook #'pop-up)))
=C2=A0 =C2=A0 ;; (add-hook 'window-configuration= -change-hook #'pop-up nil t)
=C2=A0 =C2=A0
=C2=A0 =C2=A0 ;; the = following line triggers the `pop-up` hook function
=C2=A0 =C2=A0 (pop-to= -buffer "test")))

;; evaluate code to remove the (global) = hook
(remove-hook 'window-configuration-change-hook #'pop-up)
So you can start from emacs -Q, evaluate the above code, and do `M-xtest`, as expected the 'pop-up' buffer will be selected.

N= ow remove the hook (by evaluating the last line), then comment out the
g= lobal hook and uncomment the local hook. Again do `M-x test`, this
time,= the 'test' buffer, wrongly and inconsistently, will be selected.To me this behavior looks like a bug.



In GNU Emacs 27.2 (b= uild 1, x86_64-redhat-linux-gnu, GTK+ Version 3.24.30, cairo version 1.17.4= )
=C2=A0of 2021-08-07 built on buildvm-x86-31.iad2.fedoraproject.org
Windowing syst= em distributor 'The X.Org Foundation', version 11.0.12014000
Sys= tem Description: Fedora Linux 35 (Workstation Edition)

Recent messag= es:
Quit
scroll-up-command: End of buffer
user-error: No buttons!<= br>You can run the command =E2=80=98kill-buffer=E2=80=99 with C-x k
dele= te-window: Attempt to delete minibuffer or sole ordinary window
test2(test evil-refresh-cursor window--adjust-process-windows)
user-error: N= o replacement character typed
evil-line-move: End of buffer
Quit [4 t= imes]
(evil-refresh-cursor window--adjust-process-windows)
Configured= using:
=C2=A0'configure --build=3Dx86_64-redhat-linux-gnu
=C2=A0= --host=3Dx86_64-redhat-linux-gnu --program-prefix=3D
=C2=A0--disable-dep= endency-tracking --prefix=3D/usr --exec-prefix=3D/usr
=C2=A0--bindir=3D/= usr/bin --sbindir=3D/usr/sbin --sysconfdir=3D/etc
=C2=A0--datadir=3D/usr= /share --includedir=3D/usr/include --libdir=3D/usr/lib64
=C2=A0--libexec= dir=3D/usr/libexec --localstatedir=3D/var
=C2=A0--sharedstatedir=3D/var/= lib --mandir=3D/usr/share/man
=C2=A0--infodir=3D/usr/share/info --with-d= bus --with-gif --with-jpeg --with-png
=C2=A0--with-rsvg --with-tiff --wi= th-xft --with-xpm --with-x-toolkit=3Dgtk3
=C2=A0--with-gpm=3Dno --with-x= widgets --with-modules --with-harfbuzz
=C2=A0--with-cairo --with-json bu= ild_alias=3Dx86_64-redhat-linux-gnu
=C2=A0host_alias=3Dx86_64-redhat-lin= ux-gnu CC=3Dgcc 'CFLAGS=3D-DMAIL_USE_LOCKF -O2
=C2=A0-flto=3Dauto -f= fat-lto-objects -fexceptions -g -grecord-gcc-switches
=C2=A0-pipe -Wall = -Werror=3Dformat-security -Wp,-D_FORTIFY_SOURCE=3D2
=C2=A0-Wp,-D_GLIBCXX= _ASSERTIONS
=C2=A0-specs=3D/usr/lib/rpm/redhat/redhat-hardened-cc1 -fsta= ck-protector-strong
=C2=A0-specs=3D/usr/lib/rpm/redhat/redhat-annobin-cc= 1 -m64 -mtune=3Dgeneric
=C2=A0-fasynchronous-unwind-tables -fstack-clash= -protection -fcf-protection'
=C2=A0LDFLAGS=3D-Wl,-z,relro
=C2=A0P= KG_CONFIG_PATH=3D:/usr/lib64/pkgconfig:/usr/share/pkgconfig'

Con= figured features:
XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND DBUS GSETTINGS = GLIB NOTIFY
INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N= _FLT LIBOTF
ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS X= WIDGETS
LIBSYSTEMD JSON PDUMPER GMP

Important settings:
=C2=A0= value of $LANG: en_US.UTF-8
=C2=A0 value of $XMODIFIERS: @im=3Dibus
= =C2=A0 locale-coding-system: utf-8-unix

Major mode: Lisp Interaction=

Minor modes in effect:
=C2=A0 marginalia-mode: t
=C2=A0 saveh= ist-mode: t
=C2=A0 vertico-mode: t
=C2=A0 recentf-mode: t
=C2=A0 s= hell-dirtrack-mode: t
=C2=A0 evil-mode: t
=C2=A0 evil-local-mode: t=C2=A0 global-undo-tree-mode: t
=C2=A0 undo-tree-mode: t
=C2=A0 ove= rride-global-mode: t
=C2=A0 tooltip-mode: t
=C2=A0 global-eldoc-mode:= t
=C2=A0 eldoc-mode: t
=C2=A0 electric-indent-mode: t
=C2=A0 mous= e-wheel-mode: t
=C2=A0 tool-bar-mode: t
=C2=A0 menu-bar-mode: t
= =C2=A0 file-name-shadow-mode: t
=C2=A0 global-font-lock-mode: t
=C2= =A0 font-lock-mode: t
=C2=A0 blink-cursor-mode: t
=C2=A0 auto-composi= tion-mode: t
=C2=A0 auto-encryption-mode: t
=C2=A0 auto-compression-m= ode: t
=C2=A0 line-number-mode: t
=C2=A0 transient-mark-mode: t
Load-path shadows:
None found.

Features:
(shadow sort mail-e= xtr emacsbug message rmc puny dired dired-loaddefs
format-spec rfc822 mm= l mml-sec epa derived epg epg-config gnus-util
rmail rmail-loaddefs mm-d= ecode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailhe= ader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils h= elp-fns radix-tree cl-print debug
backtrace find-func cursor-sensor time= -date consult-vertico consult
bookmark text-property-search pp mule-util= rx marginalia savehist
orderless vertico evil-nerd-commenter evil-nerd-= commenter-operator
evil-nerd-commenter-sdk sgml-mode dom which-key bind-= map recentf
tree-widget wid-edit evil evil-keybindings evil-integration = evil-maps
evil-commands reveal flyspell ispell evil-jumps evil-command-w= indow
evil-types evil-search evil-ex shell pcomplete comint ansi-colorevil-macros evil-repeat evil-states evil-core advice evil-common
windm= ove thingatpt rect evil-digraphs evil-vars ring edmacro kmacro
undo-tree= diff cl-extra help-mode use-package use-package-ensure
use-package-deli= ght use-package-diminish use-package-bind-key bind-key
easy-mmode use-pa= ckage-core finder-inf info package easymenu browse-url
url-handlers url-= parse auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs passwor= d-cache json subr-x map url-vars seq byte-opt gv
bytecomp byte-compile c= conv cl-loaddefs cl-lib chemacs tooltip eldoc
electric uniquify ediff-ho= ok vc-hooks lisp-float-type mwheel term/x-win
x-win term/common-win x-dn= d tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace ne= wcomment text-mode elisp-mode lisp-mode
prog-mode register page tab-bar = menu-bar rfn-eshadow isearch timer
select scroll-bar mouse jit-lock font= -lock syntax facemenu font-core
term/tty-colors frame minibuffer cl-gene= ric 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 charscript charprop = case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloade= d nadvice loaddefs
button faces cus-face macroexp files text-properties = overlay sha1 md5
base64 format env code-pages mule custom widget hashtab= le-print-readable
backquote threads dbusbind inotify dynamic-setting sys= tem-font-setting
font-render-setting xwidget-internal cairo move-toolbar= gtk x-toolkit x
multi-tty make-network-process emacs)

Memory inf= ormation:
((conses 16 289213 15010)
=C2=A0(symbols 48 19826 1)
=C2= =A0(strings 32 93633 2529)
=C2=A0(string-bytes 1 2476732)
=C2=A0(vect= ors 16 32184)
=C2=A0(vector-slots 8 380120 15630)
=C2=A0(floats 8 94 = 84)
=C2=A0(intervals 56 693 0)
=C2=A0(buffers 1000 14))
--000000000000fa8a7105da6db346-- From unknown Fri Jun 13 11:33:40 2025 X-Loop: help-debbugs@gnu.org Subject: bug#54438: 27.2; inconsistent-behavior-global-vs-local-hook Resent-From: Michael Heerdegen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 18 Mar 2022 00:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54438 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: dalanicolai Cc: 54438@debbugs.gnu.org Received: via spool by 54438-submit@debbugs.gnu.org id=B54438.164756415110754 (code B ref 54438); Fri, 18 Mar 2022 00:43:02 +0000 Received: (at 54438) by debbugs.gnu.org; 18 Mar 2022 00:42:31 +0000 Received: from localhost ([127.0.0.1]:55709 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nV0hK-0002nO-Ok for submit@debbugs.gnu.org; Thu, 17 Mar 2022 20:42:30 -0400 Received: from mout.web.de ([212.227.17.11]:36777) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nV0hJ-0002nC-9p for 54438@debbugs.gnu.org; Thu, 17 Mar 2022 20:42:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1647564142; bh=BV2juHBJ8NJFWBnuJzKPq2lvVB6Bt/zcZkz0SDhnqN8=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=NvGYikysIrVwZENyVD/t/xBo0wWxMtRQuiJUlq4k6k2IcgMpfIihYL2FiD0YdOXQp aNS9asLjiqPhTAEofbL/89eA12UaFnrfIQlNe+Ue2VbeupnKkxBvLWen40XRzLcAix 1rs+OR3mAu2H67mU6FuPY/cA+m9gOoXW+5OyXoc8= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Received: from drachen.dragon ([84.60.174.212]) by smtp.web.de (mrweb105 [213.165.67.124]) with ESMTPSA (Nemesis) id 1N4627-1oCYl517WD-00zu4o; Fri, 18 Mar 2022 01:42:22 +0100 From: Michael Heerdegen References: Date: Fri, 18 Mar 2022 01:42:21 +0100 In-Reply-To: (dalanicolai@gmail.com's message of "Thu, 17 Mar 2022 18:52:58 +0100") Message-ID: <871qz0m6qa.fsf@web.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K1:+bYef0wbKG2YvtrTp+ALJS+8fjjzNDbbzlCwR5FVJ1GtYJL10BH x9fUvS2ghQHm4xWy96aMmnNB4Xld4mQegKT6nFefQT6DE1aSlqInVP5jeX0HBHt/AFH3iP/ wAbmXWmXgSeXXFqjg7smU/zYsk9no2RZOQazZn0fP1B9j1/rw8Hmn3wRuKKrookN/s9UShb +kW8+X6HXMNViU7hkp2CQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:2mUuXcBcaY4=:9KECfxX07RMQ3pJCUop+eb RFMRuaqTLHVuIgRZnSb4vTK2HxWhrtj7C6aBaCHD4DKCxqTNiC482JoJ0t531SE4OOI2T6Zvs xHXLEgr5zey6cRaTy2YrHkxK9gzMO5pikwP4s8EqJr0a0bDUNdoXob7anmaM/RMt6za0bmUtN 4JQaGygMpVX3ehLSh6AQe+G/mddf+Wz5fFQdzVs80a6tTBO3tYgCvuRbjOr3q6cqo+LgpEoqB EmpVjM7YG0K1Y7j3L9U8VBmtN0x2QGJMyvE00eCaEClquvlAHT1vTvfphfShBApJkka1P7CTh 9UORuEUz/3m19JmSK/bdtQ35RqD8GcC+3j4k91eTuNqDV3lhLyZCLVoUtybcD/kdivdXQn3Yr dwr9rGTo/kQwo/P9/8TEISr0FScfa3FXAD2o5nAyNEgzBIxJzVgujznsR6lxhUo0BwEadOQg0 rdR9dSEGByhZHChV/tZ4cnzrTl33Mf/qn62yVwvUS3Ji7/oaNV8CqYQZ8PTrGEyRsNkon2oI5 tX/2Idc2cVbAnNreCbTXL77sUgCCKj7rM3D5YZTWipiTIcd63JKZMYYXp1jRZdDiet7cECBoB pVRQYB65tXFXIPokxN3tkGwbB3JXsW3snjrPbqQ/zGWuLeODi8Tlm6iZ2lcEuwrvG3EkNVi3C Nwi4jB4ZLOic6KJNIQeXSyj99z95UmgS90XJmXPAC5ZphVE99pc0TKeXap220cIRars9jIL+f 6mgPrVInunET+3G9e+M2UC4JLVYQZ5I5PRV4OWbQ6gHi6KCwkUTD4crtAzlIsYEdOEhL68BCQ V+YvEPymsy9e2xjlsj9MhL/Fg/3uXkujdU4xhdnnieoMPDW39A8xIy+55H9ukAB9xqu6QELU7 9/jWw0vhJYUPtU0HsdwOFDUIAxUuV7nGC3iRpTEslh07ac8lXQM3Jf9z70Vhg6VS7h4PQevHT CkT2HUruxX4ndoG9KdXXpXXcDL96mjk0D1L8dJRLid7q0cIbhXrS/tEXq1E447ZB7gXm1qhBr yQB5QyOVkA3sPNjElATEdhyA9ruWFY4s9yx/uQ3hITiu7xAMyvTvKUnMu+YvlwRk89vm7cQvJ A+vSdaORsCakMQ= Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) 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.0 (-) dalanicolai writes: > (defun pop-up () > (pop-to-buffer "pop-up")) > > (defun test () > (interactive) > (with-current-buffer (get-buffer-create "test") > (add-hook 'window-configuration-change-hook #'pop-up))) > ;; (add-hook 'window-configuration-change-hook #'pop-up nil t) > > ;; the following line triggers the `pop-up` hook function > (pop-to-buffer "test"))) I think it's a bad idea to do something that changes the window configuration in `window-configuration-change-hook'. It's not unexpected to get an infinite recursion or any other unpredictable behavior. Michael. From unknown Fri Jun 13 11:33:40 2025 X-Loop: help-debbugs@gnu.org Subject: bug#54438: 27.2; inconsistent-behavior-global-vs-local-hook Resent-From: martin rudalics Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 18 Mar 2022 08:38:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54438 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: dalanicolai , 54438@debbugs.gnu.org Received: via spool by 54438-submit@debbugs.gnu.org id=B54438.16475926243196 (code B ref 54438); Fri, 18 Mar 2022 08:38:01 +0000 Received: (at 54438) by debbugs.gnu.org; 18 Mar 2022 08:37:04 +0000 Received: from localhost ([127.0.0.1]:56218 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nV86a-0000pT-3O for submit@debbugs.gnu.org; Fri, 18 Mar 2022 04:37:04 -0400 Received: from mout.gmx.net ([212.227.17.21]:58803) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nV86X-0000oy-RB for 54438@debbugs.gnu.org; Fri, 18 Mar 2022 04:37:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1647592615; bh=qv5FrSZk/eEcxFcRegD7oPh9aizc51wLIjRUy3fa/uA=; h=X-UI-Sender-Class:Date:Subject:To:References:From:In-Reply-To; b=Xw40K2f+9U51RMWW07ExA76G8aCAjTG17bhVKZdGhFovvAATgaDG4vScLuHbh4i+6 GSnp37uynIVP3zC8Kj/0St/yjkhXU8knGyEWpUbu5MbjF8e9jd9na3NTS9KGKBofe3 u7dKhUEUtCbgwj7m2iWymwaVQg1CdOcx9XamzuuY= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.1.101] ([212.95.5.195]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MYeMt-1naLB72t6p-00VjSr; Fri, 18 Mar 2022 09:36:55 +0100 Message-ID: Date: Fri, 18 Mar 2022 09:36:51 +0100 MIME-Version: 1.0 Content-Language: en-US References: From: martin rudalics In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:+AEgoG/VZw46/KJ1qNU9qtz9rRVNUID/M2WXwfWbOp3UsjVL4Qo 9tEZz/ZTp+bxRjWkaEqVfv+0VZj5+4XLfWVeQ7HwD9wozDRXB4QdJzQJ6PVhDoeHxe3pJDe Djhic2XcUOvcCCy6scnrRpXYowVBjJhbnYYSv9e4BDgY/clrAW3Hzwdt6g43McTDjWNMZjX 8uvclt6kw9Bm+gdfIjVRw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:iXLU4SX1IVw=:+wQy5YIjooJYAIIIUj1gHI sJx3OYIBkodzMvGRM2c57blVGOIOcfdB6hAdV/r3cKIZgNyz+YvyQLtTNFJ3AQbFey1W75ee1 /KXciGaCiv+V4YGVZiXAMLSgSc0BdmXRln++tbVNOtYV6tsGduxUBLUHmZeBnPUAvMYYyiQmA O5I6+okyoQcCCwj95J3YYM8xjeDZhc6XAFkurBsfs9X8lOlVgdt959gCupuzT0vO2Dt9FPmFN OYPIHIPngIZnDt4g/xUjcxUzmUIQuTA/Hr96dtRNpPeheWr9wX+0wsCwivxFcDPXijuE4nW18 Ql1tpeGDL/zqAzY+9f3yIARBEu8/zc+nB8cTWTXGcfnJRGFSbIdhCTzAZkZZwHeyoWh0coZan SUT0LML96/yvtFdZu56uXntGVdzxKjY2khxctibbkCgzz7x47BRteGdKz6otdzm+0pio8vovn UJ9uec0SH+hQ0bdX/vxOBqULbekSQWGBawjP3tPCk+8Upw3+OgeCOg8C1DcoyXhcTkeS6cqBF BHwRIrlfug0kPO3lLE8G/5nwilrIg2d2HAc1rTudehHfNOtxebh6vWl7fxhqJohvVhx/0XMD0 +jdif6Q6xz58vIiS/miFewpfAIxDYskXsQ9I6O/MAR8eDrpXSydalB2SsSeWtWFghkPRmoJRG iqFAVru+RGlY8lA5uQ33anTcrHv9M2PSLfFPmysc5C4x1Nis0Ka7N8K31Zg1akCnWlqwKvyWo W/YNqExcAKguWk/CrryJVaYAEOLWfn3jXPvyMs81P9KnqBVcuLT9ZZJQC4m1wWFNvhfMjMbUj 25be34Cp0Ua7FgL3nF9G7dD/oEWsTIBJeARKlOvjr6l1PVDwN+uXtOFO2xIYHUeJJE+a5Q79E rcaNxKZwZcBSu5I8SHnja7tcXRml/lP1w7kJS7ntrHQdL/PLo6F6K/I+aWtAYZsjWQ393ru49 kb247uEl1k7ly254XoxTJe6hMrzwuB7lWvTiTyKnAUkMmx9KJWhWcDN5GJd7Ke5cFmMAWiodF UtJMYhHHqkZYjU45eANnfkr6CqBhJznUT1Rv2nWUH2hWcwiZDD+0FLJXaUqnQGCFR0OvMlGSP GxRvcQjhZ6OQW4= X-Spam-Score: -0.7 (/) 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 (-) > I have used the following test code: > > (defun pop-up () > (pop-to-buffer "pop-up")) > > (defun test () > (interactive) > (with-current-buffer (get-buffer-create "test") > (add-hook 'window-configuration-change-hook #'pop-up))) > ;; (add-hook 'window-configuration-change-hook #'pop-up nil t) > > ;; the following line triggers the `pop-up` hook function > (pop-to-buffer "test"))) What is the last paren here supposed to close? Please provide two separate test sequences - one for the local and one for the global hook case. > ;; evaluate code to remove the (global) hook > (remove-hook 'window-configuration-change-hook #'pop-up) > > So you can start from emacs -Q, evaluate the above code, and do `M-x > test`, as expected the 'pop-up' buffer will be selected. > > Now remove the hook (by evaluating the last line), then comment out the > global hook and uncomment the local hook. Again do `M-x test`, this > time, the 'test' buffer, wrongly and inconsistently, will be selected. > To me this behavior looks like a bug. I'd recommend to use 'window-configuration-change-hook' only when you want the window/buffer of concern to be selected/made current while running the hook. Otherwise, you will inevitably run into problems when - OT1H you want to select another window (that for "pop-up") while running the hook, and - OTOH the mechanism at the end of run_window_configuration_change_hook (in window.c) restores the window selected before running the hook (apparently that for "test" in your case) which is certainly not a new window that popped up while running the hook. martin From unknown Fri Jun 13 11:33:40 2025 X-Loop: help-debbugs@gnu.org Subject: bug#54438: 27.2; inconsistent-behavior-global-vs-local-hook Resent-From: martin rudalics Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 18 Mar 2022 08:38:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54438 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Michael Heerdegen , dalanicolai Cc: 54438@debbugs.gnu.org Received: via spool by 54438-submit@debbugs.gnu.org id=B54438.16475926443230 (code B ref 54438); Fri, 18 Mar 2022 08:38:01 +0000 Received: (at 54438) by debbugs.gnu.org; 18 Mar 2022 08:37:24 +0000 Received: from localhost ([127.0.0.1]:56221 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nV86u-0000q2-CT for submit@debbugs.gnu.org; Fri, 18 Mar 2022 04:37:24 -0400 Received: from mout.gmx.net ([212.227.17.20]:59441) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nV86r-0000pm-Lk for 54438@debbugs.gnu.org; Fri, 18 Mar 2022 04:37:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1647592635; bh=f61gcT5QKWbm14/M4HIQygINN7MUeermEKLevviT7Dg=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To; b=EPZAEmHSOHZkZjF5DxiTfiepSyOvYIJ/v6YaHARitbX7E0X59x4mE5fDeCSzvesZx 5ezFp/Zkv7p8YkXe6odI+w345+BR3OZwgvbJsDAeREZPaBenXoHEiOzzq4bSMvz0sa kH/3d1WIGzFe3T4NQxQLHgjogRQz1WLr6a1K2s1c= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.1.101] ([212.95.5.195]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MXGvG-1nbAWK3OTm-00YlG8; Fri, 18 Mar 2022 09:37:15 +0100 Message-ID: <161a1515-187d-18c2-f9f1-86f4ea29614c@gmx.at> Date: Fri, 18 Mar 2022 09:37:12 +0100 MIME-Version: 1.0 Content-Language: en-US References: <871qz0m6qa.fsf@web.de> From: martin rudalics In-Reply-To: <871qz0m6qa.fsf@web.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:DhU4TEA96qfDQI0USa8oX4HCXddRGiwD4u4SgYOsb276PrB7gtl FuMt/g1nFQ+iLzznOTnzVdzBivIh+mjyXM7GOIVAzrJ+iNDJdla5cOfxEIORXgo6NBwO4u6 7FpsmcN4Taj/PtMEdiT3k0vBmoZiagpTRHsLG2J1EpHeu9W+HPkriMwgwMSPmdqPnf8fHO+ rsWDs0pLGI+PVE9VhmF4A== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:KA1yBr0UPu0=:UZ1Ynd5+tv0kXuZnk++20S 4fBaWVnqDQ6T0cEWPWVTonWsF0J3WwOuEZwLPxcuxyNwk5cgpYbXO/UkfU1w7Dgi7GmxfusAq 6n244LQBR99QW3clZMz/LUhtZupYNG205VGH5YDEM3l5SYdW6SrhFUbUOO9tdHLHrrW2yzHA8 Uz2Vkz4bTaEepYXvErXElFMoBmIvF32G3dKrJxTMIBxuHOy7pkw0Qn4fBR9sj5h9K9Ad3wkML Wmo1hwTHJ6nowU6Drz6P3QaiPGP7YcilpErmnblsqdsjTZwIclFmvo/tTpzQlCV17WDwDAHJi ydkpFYByDWPwdTvZ6QUcJr6GEez6Oy//KqBPeCkO7nqe1UB+0t5FxUhxUdxk/ovRjltH7kiyE UK5B8noUDg82G907JxzP/idPbxqiazS3iuM41hZcmHCr+bocfk7OLbelR+fXc/jifeFqaXWMh yJAK1AbRcxutKE8qPHcyefFp2VSoRsLUQ3QtwR7lAVb2eWAg0YaQNCTuAZESsJfKe7C2UL4Gj ghy1x5PD9OhYeZb84QEoWxL3y6KQ54tc/vxcT7Vhy0kphXsKH7NWRmsxDWRpasS0VTfsZzl4B dP3ghvL8CDdHnSWis94iqg3eQr5YRzl9SJbDgHVJIQ0Ahu+orPTNOB2JJWBkaMwyLmoiJdBgN HTdIvwhxv0TIkwrbFZ38xEpzmGLU62MBUTvGrQxEan0UsZ6EFQjqRAT9a0lDQnIxxR6XWtOs0 mqCV23ub64hKTG2a7OXtdE2AyT/6ZJLFFixbX84AMtNFwyfQzWt2giDB2t6VNX33JlumW7fVX wX2fi1i8nGcJToVG2uiW1Og4fFXhUEa97HUb3xEeuJVlbzbKwxP3Pc2FTDs1t7zT3OKtFsHHs jEVnaS6216eK4ZT+cY23VXpU27pnx7xStehw3I3d6aBLnhiadqishq+a/JcBxg8xmihuJ5DXR yUqAwnJ6rxiOZe9T9EhqA5j2HKWDcPHD4rprbW6+BHBBFpuNHuVcfvCjbAILjnUf9aOikoQG7 coPLaJENOZXA6PRvG7iQdbIgOt7l06hxfT6GmZk/M5d2z4TxfuUPxvqBozpCF1WQZXTVCxpJ2 JOn7JqG3JxV+9o= X-Spam-Score: -0.7 (/) 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 (-) > I think it's a bad idea to do something that changes the window > configuration in `window-configuration-change-hook'. It's not > unexpected to get an infinite recursion or any other unpredictable > behavior. People should avoid it in packages because they could easily step on each other's toes. Written carefully, it could be useful in private code. martin From unknown Fri Jun 13 11:33:40 2025 X-Loop: help-debbugs@gnu.org Subject: bug#54438: 27.2; inconsistent-behavior-global-vs-local-hook Resent-From: dalanicolai Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 18 Mar 2022 09:12:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54438 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: martin rudalics Cc: Michael Heerdegen , 54438@debbugs.gnu.org Received: via spool by 54438-submit@debbugs.gnu.org id=B54438.16475947086620 (code B ref 54438); Fri, 18 Mar 2022 09:12:01 +0000 Received: (at 54438) by debbugs.gnu.org; 18 Mar 2022 09:11:48 +0000 Received: from localhost ([127.0.0.1]:56268 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nV8eC-0001ii-GG for submit@debbugs.gnu.org; Fri, 18 Mar 2022 05:11:48 -0400 Received: from mail-yw1-f179.google.com ([209.85.128.179]:46050) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nV8eA-0001iG-9J for 54438@debbugs.gnu.org; Fri, 18 Mar 2022 05:11:46 -0400 Received: by mail-yw1-f179.google.com with SMTP id 00721157ae682-2e5ad7166f1so72112347b3.12 for <54438@debbugs.gnu.org>; Fri, 18 Mar 2022 02:11:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=HyiVzaSXTlKNq5jlXk+ZG5WJPavXRR+XIKQNanY5mWo=; b=g0UX2S61QNHDLpwRvmFFbUP8glgPN0k5HVHzHUjiqrACLowXYiPGtHPl9AkYw+ZJJ9 p60+XtooHLp4JzDgCfiZG4WTlTB/AH/hXpWxf7gFpyA/vS6TxUFCtxmAJtgC3uHlIQqv 6WrGteW5hkz8FYrC9Zu2rvUGkjvYFsEjiAnuXYVGv55m3xI/R7MI3eRCpsjSOw5o/M8D xR+10FSMQ9WDrVRWlk5l0ddiMvJDetDBBcgTJRCMfkDWM1a/TgvGotMvChaS+j9SMz/o DLWy7R3KrFGngWcD/JQ8ZbV6X6Ab+sEdsFh0wWlDcK2JvXdmW/avGPSePM6eO+kwgAJb GWLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=HyiVzaSXTlKNq5jlXk+ZG5WJPavXRR+XIKQNanY5mWo=; b=HB1dAMM9B4ll9GYjKKfWzvTnGUuQMLHey7GSMmN0th16PgW4pmYuIQ2i6bQAmW5L4u mpk8GiZo06+dwvS16Nfx/foXEkoc/UDcRv9YjGO4YnRWoE3deTH7oNgM4SsOEjeBp6v4 T3vkx21xgFX3ABWXRsnaP2sm30dQXv15VLQP4XTtlePZfFPp7ckEknmBH/MaNJJF+iN3 mUUocV94kI7PjRTcxLkiYmYcAYSASsRuGKZaQLWreR0OCd4pyDNGn9y3rkP0u540gxu7 mxMbRm97kUuvbmD9q4/36tGjS+zpIsYdVAHU7au6qpnxT3vw75byxr7KB7xofeqcYlda u7Ig== X-Gm-Message-State: AOAM531lYp8oSgpsthIBuXYCTF4bA7r9W8K+AEc9fgaz/Vo6v8upzL9k 72v/aPhWGkib6i8FmrRWFpKy2sqyc5ddqBVUHMM= X-Google-Smtp-Source: ABdhPJwb0yTmgbuv/bKGAPu25I8cM4Y35JIH68Uqe0AoQ6IGRDo/1W2/ktwnQ9iSfrgwexdhJoesr342LtESHS4vaj4= X-Received: by 2002:a81:8983:0:b0:2dd:4537:4e9 with SMTP id z125-20020a818983000000b002dd453704e9mr10362546ywf.452.1647594700763; Fri, 18 Mar 2022 02:11:40 -0700 (PDT) MIME-Version: 1.0 References: <871qz0m6qa.fsf@web.de> <161a1515-187d-18c2-f9f1-86f4ea29614c@gmx.at> In-Reply-To: <161a1515-187d-18c2-f9f1-86f4ea29614c@gmx.at> From: dalanicolai Date: Fri, 18 Mar 2022 10:11:29 +0100 Message-ID: Content-Type: multipart/alternative; boundary="000000000000df777d05da7a8895" X-Spam-Score: -0.0 (/) 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.0 (-) --000000000000df777d05da7a8895 Content-Type: text/plain; charset="UTF-8" Thank you for the reply. Ah, sorry I forgot to remove the parens to include the `pop-to-buffer` within the defun. About the 'restoring mechanism'; the global hook seems not to restore the window selected before running the hook. So here are the two separated test cases (they both use the 'pop-up' function) (defun pop-up () (pop-to-buffer "pop-up")) (defun test () (interactive) (with-current-buffer (get-buffer-create "test") (add-hook 'window-configuration-change-hook #'pop-up) (pop-to-buffer "test"))) ;; evaluate code to remove the (global) hook (remove-hook 'window-configuration-change-hook #'pop-up) (defun test () (interactive) (with-current-buffer (get-buffer-create "test") (add-hook 'window-configuration-change-hook #'pop-up nil t) (pop-to-buffer "test"))) So the 'restoring mechanism' works like you explained for the local hook but not for the global hook (where after calling 'test', the pop-up buffer will be selected). Also, I would expect that a hook just calls the hook function, and it would not 'restore the window selected before the hook'. I would say the restoring is undesired behavior. On Fri, 18 Mar 2022 at 09:37, martin rudalics wrote: > > I think it's a bad idea to do something that changes the window > > configuration in `window-configuration-change-hook'. It's not > > unexpected to get an infinite recursion or any other unpredictable > > behavior. > > People should avoid it in packages because they could easily step on > each other's toes. Written carefully, it could be useful in private > code. > > martin > --000000000000df777d05da7a8895 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thank you for the reply. Ah, sorry I forgot to remove= the parens to include the `pop-to-buffer` within the defun.

=
About the 'restoring mechanism'; the global hook seems n= ot to restore the window selected before running the hook.

So here are the two separated test cases (they both use the 'p= op-up' function)

(defun pop-up ()
=C2=A0 (p= op-to-buffer "pop-up"))

(defun test ()
=C2=A0 (interact= ive)
=C2=A0 (with-current-buffer (get-buffer-create "test")=C2=A0 =C2=A0 (add-hook 'window-configuration-change-hook #'pop-up= )
=C2=A0 =C2=A0 (pop-to-buffer "test")))

;; evaluate co= de to remove the (global) hook
(remove-hook 'window-configuration-ch= ange-hook #'pop-up)

(defun test ()
=C2=A0 (interactive)
= =C2=A0 (with-current-buffer (get-buffer-create "test")
=C2=A0 = =C2=A0 (add-hook 'window-configuration-change-hook #'pop-up nil t)<= br>=C2=A0 =C2=A0 (pop-to-buffer "test")))


So the 'restoring mechanism' works like you explai= ned for the local hook but not for the global hook
(where after c= alling 'test', the pop-up buffer will be selected).

<= /div>
Also, I would expect that a hook just calls the hook function, an= d it would not 'restore the window
=C2=A0selected before the = hook'. I would say the restoring is undesired behavior.
<= br>


On Fri, 18 Mar 2022 at 09:37, martin rudalics <<= a href=3D"mailto:rudalics@gmx.at" target=3D"_blank">rudalics@gmx.at>= wrote:
=C2=A0&g= t; I think it's a bad idea to do something that changes the window
=C2=A0> configuration in `window-configuration-change-hook'.=C2=A0 I= t's not
=C2=A0> unexpected to get an infinite recursion or any other unpredictab= le
=C2=A0> behavior.

People should avoid it in packages because they could easily step on
each other's toes.=C2=A0 Written carefully, it could be useful in priva= te
code.

martin
--000000000000df777d05da7a8895-- From unknown Fri Jun 13 11:33:40 2025 X-Loop: help-debbugs@gnu.org Subject: bug#54438: 27.2; inconsistent-behavior-global-vs-local-hook Resent-From: dalanicolai Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 18 Mar 2022 09:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54438 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: martin rudalics Cc: Michael Heerdegen , 54438@debbugs.gnu.org Received: via spool by 54438-submit@debbugs.gnu.org id=B54438.16475947896773 (code B ref 54438); Fri, 18 Mar 2022 09:14:02 +0000 Received: (at 54438) by debbugs.gnu.org; 18 Mar 2022 09:13:09 +0000 Received: from localhost ([127.0.0.1]:56272 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nV8fU-0001lB-Tu for submit@debbugs.gnu.org; Fri, 18 Mar 2022 05:13:09 -0400 Received: from mail-yb1-f170.google.com ([209.85.219.170]:40718) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nV8fR-0001kb-1A for 54438@debbugs.gnu.org; Fri, 18 Mar 2022 05:13:06 -0400 Received: by mail-yb1-f170.google.com with SMTP id z8so14769034ybh.7 for <54438@debbugs.gnu.org>; Fri, 18 Mar 2022 02:13:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=bjOdS12XAMa+B86TYB9489D8DwlkKnJLzsXUSp+BlHA=; b=A2Svwk4oT3DBAYy36DJCESYGIloGyLqqiWk5QTbpfLRr3jhhFyoPNvNuDx66T/nCQO kyZKkXPSEeQ2nxr2oBArJU/6LzjoAgeNq2N2Qb8iu8miZNXfhPZB2//mj8akZV/Zb8ca rNbZ1UXGeu/1AEEJBcifb2V25fTEMDHrv4IGQ4ZPAqtRKiSJAcK0YhI/+oP04AqfmF80 81qxXeba2eR9b0sWQ9WhnPpQlgZPpOS4KrhmQShckCMe9HL3FQQLFe0kJcyqk6RXsZnF b3tj7QMDH/Cyo7c+0qrGvX3YkECqfKeypcT/35AH4UypSMiFvEkA06t4wa9EemiPiqAY +Ydw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=bjOdS12XAMa+B86TYB9489D8DwlkKnJLzsXUSp+BlHA=; b=X3N0oMmqz42hqGCyUPqkNcbyqDLXJpNOkwoD4n8EXLyq2ZAqtes/kA4GIkGIqiavPV kLU+wOHoMqXusWXKXu1VgDsW4V3jOPd+0HqoJwi16fX+i3ZocVnWxlRLxp1LCBt3946n EKr9wWEiUyM1mtmv1GjzU9oP0t2+6QjU8/IUbJUeU+6F7b2LDM5b5xoNmEBqBwwCyUlu fkW3VZLO7uSUJskx7rxvtyZs4XVjhDyIOtnSGKbw8EYYDD1Cnf5xranBDsoRzRgNoUag OP+EQenGgLl8L5ZOToKH0/SXGWVz4zlTe7v5NxmiVE2dMAw2o6TRv7SciiwKUopOtgQ2 Euog== X-Gm-Message-State: AOAM532bhJdQplEAuwAycGT0zLy0iW1S9HEqXzErUoa021vKom7+JUCE RrxblB5rcSMtjgfOJsnUf5jm2f0c3sZQg200cTo= X-Google-Smtp-Source: ABdhPJz0aH+wS2Xrc/CQYlWr/y6AS5YkUa0X3hZamAGxESqUrF4K8Pzl/oD0NIXnkM0wPh+ASzt3OQBo6HjD3wWRkSY= X-Received: by 2002:a25:3bd4:0:b0:633:6772:5ac1 with SMTP id i203-20020a253bd4000000b0063367725ac1mr8700319yba.431.1647594779536; Fri, 18 Mar 2022 02:12:59 -0700 (PDT) MIME-Version: 1.0 References: <871qz0m6qa.fsf@web.de> <161a1515-187d-18c2-f9f1-86f4ea29614c@gmx.at> In-Reply-To: From: dalanicolai Date: Fri, 18 Mar 2022 10:12:48 +0100 Message-ID: Content-Type: multipart/alternative; boundary="000000000000916f6505da7a8d53" X-Spam-Score: -0.0 (/) 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.0 (-) --000000000000916f6505da7a8d53 Content-Type: text/plain; charset="UTF-8" And, moreover, the behavior for the global vs local hook is inconsistent... On Fri, 18 Mar 2022 at 10:11, dalanicolai wrote: > Thank you for the reply. Ah, sorry I forgot to remove the parens to > include the `pop-to-buffer` within the defun. > > About the 'restoring mechanism'; the global hook seems not to restore the > window selected before running the hook. > > So here are the two separated test cases (they both use the 'pop-up' > function) > > (defun pop-up () > (pop-to-buffer "pop-up")) > > (defun test () > (interactive) > (with-current-buffer (get-buffer-create "test") > (add-hook 'window-configuration-change-hook #'pop-up) > (pop-to-buffer "test"))) > > ;; evaluate code to remove the (global) hook > (remove-hook 'window-configuration-change-hook #'pop-up) > > (defun test () > (interactive) > (with-current-buffer (get-buffer-create "test") > (add-hook 'window-configuration-change-hook #'pop-up nil t) > (pop-to-buffer "test"))) > > > So the 'restoring mechanism' works like you explained for the local hook > but not for the global hook > (where after calling 'test', the pop-up buffer will be selected). > > Also, I would expect that a hook just calls the hook function, and it > would not 'restore the window > selected before the hook'. I would say the restoring is undesired > behavior. > > > > On Fri, 18 Mar 2022 at 09:37, martin rudalics wrote: > >> > I think it's a bad idea to do something that changes the window >> > configuration in `window-configuration-change-hook'. It's not >> > unexpected to get an infinite recursion or any other unpredictable >> > behavior. >> >> People should avoid it in packages because they could easily step on >> each other's toes. Written carefully, it could be useful in private >> code. >> >> martin >> > --000000000000916f6505da7a8d53 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
And, moreover, the behavior for the global vs local hook i= s inconsistent...

On Fri, 18 Mar 2022 at 10:11, dalanicolai <dalanicolai@gmail.com> wrote:
<= /div>
Thank you for the reply. Ah, sorry I forgot to remove the parens to inclu= de the `pop-to-buffer` within the defun.

About the= 'restoring mechanism'; the global hook seems not to restore the wi= ndow selected before running the hook.

So here are= the two separated test cases (they both use the 'pop-up' function)=

(defun pop-up ()
=C2=A0 (pop-to-buffer "p= op-up"))

(defun test ()
=C2=A0 (interactive)
=C2=A0 (with= -current-buffer (get-buffer-create "test")
=C2=A0 =C2=A0 (add-= hook 'window-configuration-change-hook #'pop-up)
=C2=A0 =C2=A0 (= pop-to-buffer "test")))

;; evaluate code to remove the (gl= obal) hook
(remove-hook 'window-configuration-change-hook #'pop-= up)

(defun test ()
=C2=A0 (interactive)
=C2=A0 (with-current-b= uffer (get-buffer-create "test")
=C2=A0 =C2=A0 (add-hook '= window-configuration-change-hook #'pop-up nil t)
=C2=A0 =C2=A0 (pop-= to-buffer "test")))


So th= e 'restoring mechanism' works like you explained for the local hook= but not for the global hook
(where after calling 'test',= the pop-up buffer will be selected).

Also, I woul= d expect that a hook just calls the hook function, and it would not 're= store the window
=C2=A0selected before the hook'. I would say= the restoring is undesired behavior.



On Fri, 18 Mar 2022 at 09:37, martin rudalics <rudalics@gmx.at> wrote:
=C2=A0> I think it's a = bad idea to do something that changes the window
=C2=A0> configuration in `window-configuration-change-hook'.=C2=A0 I= t's not
=C2=A0> unexpected to get an infinite recursion or any other unpredictab= le
=C2=A0> behavior.

People should avoid it in packages because they could easily step on
each other's toes.=C2=A0 Written carefully, it could be useful in priva= te
code.

martin
--000000000000916f6505da7a8d53-- From unknown Fri Jun 13 11:33:40 2025 X-Loop: help-debbugs@gnu.org Subject: bug#54438: 27.2; inconsistent-behavior-global-vs-local-hook Resent-From: martin rudalics Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 18 Mar 2022 09:59:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54438 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: dalanicolai Cc: Michael Heerdegen , 54438@debbugs.gnu.org, Stefan Monnier Received: via spool by 54438-submit@debbugs.gnu.org id=B54438.164759751711293 (code B ref 54438); Fri, 18 Mar 2022 09:59:01 +0000 Received: (at 54438) by debbugs.gnu.org; 18 Mar 2022 09:58:37 +0000 Received: from localhost ([127.0.0.1]:56362 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nV9NU-0002w4-MF for submit@debbugs.gnu.org; Fri, 18 Mar 2022 05:58:36 -0400 Received: from mout.gmx.net ([212.227.15.18]:44061) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nV9NT-0002vr-Hq for 54438@debbugs.gnu.org; Fri, 18 Mar 2022 05:58:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1647597505; bh=c2bH8QSadUgyWuFuY2in9rDWmSqwaykBvFfUYoiPRxA=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To; b=SVdmykI/E2ww/NTiS6igYiv/ZnwiBO/0kJpINhKr26oO/YAOj7+59cN8vGNToTwcZ V/WngwvENd74r+r3JDjdc8AQGzfWnkuMtTp7O0EanlwKn0RIeAJl+XUGhDwvm3gNzy Zvspc4nbaWK2kMEXz7oyNjOU3oRNGEk15CjaBKU4= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.1.101] ([212.95.5.195]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1McYCl-1o5rZc2Oc9-00d0r7; Fri, 18 Mar 2022 10:58:25 +0100 Message-ID: <8e029893-2d25-8302-7e30-c75abef3ec3e@gmx.at> Date: Fri, 18 Mar 2022 10:58:23 +0100 MIME-Version: 1.0 Content-Language: en-US References: <871qz0m6qa.fsf@web.de> <161a1515-187d-18c2-f9f1-86f4ea29614c@gmx.at> From: martin rudalics In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: base64 X-Provags-ID: V03:K1:aCz7KuVerhVn07vleC5RKR29CEYACD8GIaj7h4lpACKBg/pApOw 1m4WY9pBriiKeXqZPOQMhVCyeeXR8WuxbS/218ClSCdX+Bo8xSFsS3cf6JKsRdGbAa7eGGQ WjjjBj0dfeK5uxJcA9rfk6xe2iJ02WA0X46kKvWDsNIVoK72QWscPvoInzpVACiel7mCzGu eWBhG1C/djim5buothv4A== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:HxdP1qJdei4=:eg6pBuJlNpTUDZyIk08IGX etqwWSgvhMTtABxnG3miyn0XBzwGQRASmPLibJNZorsXvHczPuyjK4/w79KKA17xdH6es1+7p 5Sm01HdLGRUfs5teD3AuwrOZF3EnJEAeHT2TAgJmePVxDtTPAEzbxeww37DGg4jX8xWLg++at oLHTCyUK7czVaoKAFOfXUtl6EqUgb4I8YEz6Wfn1gBrc2uOB99pzwvy9yxWwEe5/cz1Ha7Hxk a4wI7DLnEcMQsj3GVkU/TIz6S6XGWvQCRTWdbHxShFRnD3u9MKjXcm4hl+/uB5jnEkSE4a5s0 nVKutM5Mhim8gCvH9YKMA0U3J8eIGdnJr90/SH1cdvSg1zmlr+yIufPTJcEEe+oQsZnJ23S5G VO1GG4Met1CBMZZiaa7qjKFuLkm1CvSqGys0npbds2cZ4oHkWjOWpa9VsIZsK9xW+QcJ4lOXV 6+MFXgAjBzl9/KZyNo/jiRfMwyhZmHuf+IUipZWjq3JgM0a4pJUx0bdPuL3yYL+HYVPFm96Zn m1c+BEMXPzMcoGTUx4NXMKd+NodrcdFttDRGZzhru0FADVgCBrQeEov/HAHr4Ocow+Kggp8ci Sz+i62IKjItkQeDAqieu3sDDRG7d5eJm6bUSyiXAVWbtvHPbKOHyQCo58m31xfEbh29TVHTUw D+3Ppg7wX/MuBImp7chJLuwz89DiVGljQZtAslv/gsQHpJ+deWhlt8nJdZDAkoHGBT69+w7K9 Eocw8ugsEKuSC3jhVCcnlVYpuSFeeSsZf/qLX2x1+AiwuNzMmdJSUkxxwcMW4P9wRqkPjs+mL MtAzN6MZzKZyZicbSE0jZ1NPNJXMNwQokAYDIVTJkZKxHjbsO4TWb1VeXNoR9VsXjcX2mTdIZ rLUytc8MCN5SqPK4A0QWXLRfgLIibrWQspP5NIwdg6gNhXXjQEVU8fnJg8CSLcz47ltErgWie 4ySy3S5UdDcEDV8fTJt2q33u1mwzA+FJvmhPo+9DocEMD/1JsCoSvrWGP0sFpNu+R8szCKGER e5pjL9w5gBIe5dCVUPaYA2QLKjjZEBRZ/tfeuDCXhzMOD37NHXHcYaN58Jo7o9d/PElWJkI4+ F2uc98TqjB7z9Q= X-Spam-Score: -0.7 (/) 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 (-) ID4gQWJvdXQgdGhlICdyZXN0b3JpbmcgbWVjaGFuaXNtJzsgdGhlIGdsb2JhbCBob29rIHNl ZW1zIG5vdCB0byByZXN0b3JlIHRoZQ0KID4gd2luZG93IHNlbGVjdGVkIGJlZm9yZSBydW5u aW5nIHRoZSBob29rLg0KDQpSaWdodC4gIFlvdSBjYW4gZWFzaWx5IHRlc3QgdGhhdCB5b3Vy c2VsZiBieSBjYWxsaW5nDQoncnVuLXdpbmRvdy1jb25maWd1cmF0aW9uLWNoYW5nZS1ob29r JyBkaXJlY3RseS4NCg0KID4gU28gdGhlICdyZXN0b3JpbmcgbWVjaGFuaXNtJyB3b3JrcyBs aWtlIHlvdSBleHBsYWluZWQgZm9yIHRoZSBsb2NhbCBob29rDQogPiBidXQgbm90IGZvciB0 aGUgZ2xvYmFsIGhvb2sNCiA+ICh3aGVyZSBhZnRlciBjYWxsaW5nICd0ZXN0JywgdGhlIHBv cC11cCBidWZmZXIgd2lsbCBiZSBzZWxlY3RlZCkuDQoNClJpZ2h0LiAgQmVjYXVzZSBmb3Ig cnVubmluZyB0aGUgZ2xvYmFsIGhvb2ssIEVtYWNzIGRvZXMgbm90IGVudGVyIHRoZQ0KKGNv c3RseSkgd2luZG93IHNlbGVjdGlvbiByaWdtYXJvbGUuICBCdXQgSSB0aGluayB0aGF0IGV2 ZW4gZm9yIHRoZQ0KZ2xvYmFsIGhvb2sgeW91IG1pZ2h0IGJlIGFibGUgdG8gcnVuIGludG8g dHJvdWJsZXMgd2hlbiB0aGUgY3VycmVudA0KYnVmZmVyIGFuZCB0aGF0IG9mIHRoZSBzZWxl Y3RlZCB3aW5kb3cgZGlmZmVyLiAgQSBjYXNlIGZvciB0aGUgZXhwZXJ0DQpvbmx5IHRob3Vn aC4NCg0KID4gQWxzbywgSSB3b3VsZCBleHBlY3QgdGhhdCBhIGhvb2sganVzdCBjYWxscyB0 aGUgaG9vayBmdW5jdGlvbiwgYW5kIGl0IHdvdWxkDQogPiBub3QgJ3Jlc3RvcmUgdGhlIHdp bmRvdw0KID4gICBzZWxlY3RlZCBiZWZvcmUgdGhlIGhvb2snLiBJIHdvdWxkIHNheSB0aGUg cmVzdG9yaW5nIGlzIHVuZGVzaXJlZCBiZWhhdmlvci4NCg0KVGhlIGlkZWEgaXMgcHJvYmFi bHkgdGhhdCBhIGZ1bmN0aW9uIG9uIHRoYXQgaG9vayBzaG91bGQgYmUgYWxsb3dlZCB0bw0K aW5hZHZlcnRlbnRseSBzZWxlY3Qgc29tZSBvdGhlciB3aW5kb3cgYW5kIGhhdmUgdGhlIGhv b2sgcnVubmVyIGZpeA0KdGhhdC4gIE1heWJlIFN0ZWZhbiBjYW4gdGVsbCB1cyBtb3JlLg0K DQpJbiBlaXRoZXIgY2FzZSB5b3UgY2FuIGF2b2lkIHRoZXNlIHByb2JsZW1zIGJ5IHJ1bm5p bmcgd2hhdGV2ZXIgeW91IGhhdmUNCmluIG1pbmQgb24gJ3dpbmRvdy1zdGF0ZS1jaGFuZ2Ut aG9vaycgd2l0aCB0aGUgZm9sbG93aW5nIGNhdmVhdDoNCg0KICAgIOKAoiBXaW5kb3cgY2hh bmdlIGZ1bmN0aW9ucyBzaG91bGQgbm90IGNyZWF0ZSBvciBkZWxldGUgd2luZG93cyBvcg0K ICAgICAgY2hhbmdlIHRoZSBidWZmZXIsIHNpemUgb3Igc2VsZWN0aW9uIHN0YXR1cyBvZiBh bnkgd2luZG93IGJlY2F1c2UNCiAgICAgIHRoZXJlIGlzIG5vIGd1YXJhbnRlZSB0aGF0IHRo ZSBpbmZvcm1hdGlvbiBhYm91dCBzdWNoIGEgY2hhbmdlIHdpbGwNCiAgICAgIGJlIHByb3Bh Z2F0ZWQgdG8gb3RoZXIgd2luZG93IGNoYW5nZSBmdW5jdGlvbnMuICBJZiBhdCBhbGwsIGFu eQ0KICAgICAgc3VjaCBjaGFuZ2Ugc2hvdWxkIGJlIGV4ZWN1dGVkIG9ubHkgYnkgdGhlIGxh c3QgZnVuY3Rpb24gbGlzdGVkIGJ5DQogICAgICB0aGUgZGVmYXVsdCB2YWx1ZSBvZiDigJh3 aW5kb3ctc3RhdGUtY2hhbmdlLWhvb2vigJkuDQoNCm1hcnRpbg0K From unknown Fri Jun 13 11:33:40 2025 X-Loop: help-debbugs@gnu.org Subject: bug#54438: 27.2; inconsistent-behavior-global-vs-local-hook Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 18 Mar 2022 12:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54438 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: martin rudalics Cc: Michael Heerdegen , dalanicolai , 54438@debbugs.gnu.org Received: via spool by 54438-submit@debbugs.gnu.org id=B54438.16476057052120 (code B ref 54438); Fri, 18 Mar 2022 12:16:02 +0000 Received: (at 54438) by debbugs.gnu.org; 18 Mar 2022 12:15:05 +0000 Received: from localhost ([127.0.0.1]:56476 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nVBVZ-0000Y8-Ew for submit@debbugs.gnu.org; Fri, 18 Mar 2022 08:15:05 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:26001) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nVBVX-0000XI-EA for 54438@debbugs.gnu.org; Fri, 18 Mar 2022 08:15:04 -0400 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 534571001E0; Fri, 18 Mar 2022 08:14:57 -0400 (EDT) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 73E40100054; Fri, 18 Mar 2022 08:14:51 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1647605691; bh=yyLMJsfh5Uyp7h65xyHdcjzejGWTz6sIwdyb4U3AChM=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=notKKHPJ97abtyDDYvRdpDWtmfalzWavLn2XJqABggIsSnMrAhkK+7LLeOqx1b2yU p/vKJgsF0nE1bSVrABjnI+XFOVZQEhv8eaJCfRsmSuFwuXQOZdRTs2aSarJSsHuCe2 g9b/ktdmmHYWbmixeR41B6TUDoDvJGxYrWLa47GiDoLr9V4j8CrCdEaasmLXEj2ghz RjN4NeN4X/ui8j7rRuyuo6vku5zNwbLlTylFgQG64pKrjja+A2UACkwL4NUOHWMmkH rOIfhOxdg4aHYEvp0q+dR6tU23DZF2O+bhJ3Knf0V4Z3J0xkzMe5sQESwckP43kMcS CDwC4weKRufAw== Received: from pastel (unknown [45.72.221.51]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id F23541201F4; Fri, 18 Mar 2022 08:14:50 -0400 (EDT) From: Stefan Monnier Message-ID: References: <871qz0m6qa.fsf@web.de> <161a1515-187d-18c2-f9f1-86f4ea29614c@gmx.at> <8e029893-2d25-8302-7e30-c75abef3ec3e@gmx.at> Date: Fri, 18 Mar 2022 08:14:49 -0400 In-Reply-To: <8e029893-2d25-8302-7e30-c75abef3ec3e@gmx.at> (martin rudalics's message of "Fri, 18 Mar 2022 10:58:23 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.047 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain T_SCC_BODY_TEXT_LINE -0.01 - X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) 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 (---) >> Also, I would expect that a hook just calls the hook function, and it would >> not 'restore the window >> selected before the hook'. I would say the restoring is undesired behavior. > > The idea is probably that a function on that hook should be allowed to > inadvertently select some other window and have the hook runner fix > that. Maybe Stefan can tell us more. No, IIRC it is just a consequence of needing to select windows when running the local part of the hook (since that part is supposed to be run for every window (which was modified) displaying that buffer). Stefan From unknown Fri Jun 13 11:33:40 2025 X-Loop: help-debbugs@gnu.org Subject: bug#54438: 27.2; inconsistent-behavior-global-vs-local-hook Resent-From: dalanicolai Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 18 Mar 2022 17:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54438 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Monnier Cc: Michael Heerdegen , martin rudalics , 54438@debbugs.gnu.org Received: via spool by 54438-submit@debbugs.gnu.org id=B54438.164762302119062 (code B ref 54438); Fri, 18 Mar 2022 17:04:02 +0000 Received: (at 54438) by debbugs.gnu.org; 18 Mar 2022 17:03:41 +0000 Received: from localhost ([127.0.0.1]:58256 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nVG0r-0004xO-8n for submit@debbugs.gnu.org; Fri, 18 Mar 2022 13:03:41 -0400 Received: from mail-yb1-f179.google.com ([209.85.219.179]:46777) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nVG0p-0004x9-Cr for 54438@debbugs.gnu.org; Fri, 18 Mar 2022 13:03:40 -0400 Received: by mail-yb1-f179.google.com with SMTP id v130so16857349ybe.13 for <54438@debbugs.gnu.org>; Fri, 18 Mar 2022 10:03:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=88te1xulGOCWPLYXoUqG1zj4hd5OsXJUxmHoGtun7AY=; b=byKCzg+900yjsMF11S73BK9OBUzBG8zfV6v51uR/ur+6T6QBBoAvfbjNK8RPtGsbzR 7cOLqi8qT5B+jDqyW1AH7AsUcgPJEZqYbraCwK2NlooVGJx2MJfG3aW5xzBpoIvjaBo6 6IxDT3Ci7WQxqv1b1FPbYLjLVOTHnXtwm+KU/ftcZLSKlYijk9zW2UqPECVO4txSqpNg 76AXjHZydTUtofwiN5Fj9G3Bj4bLgOnmoSiezEKfxuYU4eaA2M5DBnhaziT4ajU3q1LP g4/q/91UvzoRn0NxnxyNXBN/DZm9zbzA6rJknhXWvo/UfqM3CKN4eakgbkpRwEhsE2pg CaHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=88te1xulGOCWPLYXoUqG1zj4hd5OsXJUxmHoGtun7AY=; b=fefhFpRcfgtlMjgm3e0NhKWTJW6q06VluAG4BH+1/2XLlinVV3wf0P97dleaPZt0T1 doaPahFkj8QiXZCVwUl98suOkcFCLuotL5os/GF4c0xZp3sHr+Z15wn8xFF/D2PhjDiN scKlC6fikgUlemUtM9m0Ed3Jf5+W+429A8kvyApARhwog6cZhXX8vjNpYbYHjOrAD/Kd 4KxM69vT5EBEAOeRSUNMMKp1Dy7YPm1IMRuQmuQtmBNp6C4s3Yzut91TK/wcoer46aIt Y2oA9SiqvG+6I7iRFn3FON7C+cjtlCu7IpE282qxYMV4ZjBwNdkFBHsEWV5OszTTaXTm DR9g== X-Gm-Message-State: AOAM5335d+jmIm/XKUQUg0242Y9OoS2wSD8llRPIgOohCtrQNrtEwtkE yceqS51WGTj7E2XYEoYytdH/dO8FNg6wFz0b6bQ= X-Google-Smtp-Source: ABdhPJx0SRjrVDI02Vj/cNwz9Q0Mv2JeRhtjyuWdNavYfWRdkYFzi47A0Oay3O515ILP2su+XVIquukIty1rYjRToIE= X-Received: by 2002:a25:d2c1:0:b0:633:c33e:8df2 with SMTP id j184-20020a25d2c1000000b00633c33e8df2mr2363637ybg.597.1647623013615; Fri, 18 Mar 2022 10:03:33 -0700 (PDT) MIME-Version: 1.0 References: <871qz0m6qa.fsf@web.de> <161a1515-187d-18c2-f9f1-86f4ea29614c@gmx.at> <8e029893-2d25-8302-7e30-c75abef3ec3e@gmx.at> In-Reply-To: From: dalanicolai Date: Fri, 18 Mar 2022 18:03:22 +0100 Message-ID: Content-Type: multipart/alternative; boundary="000000000000734d7605da8120cf" X-Spam-Score: -0.0 (/) 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.0 (-) --000000000000734d7605da8120cf Content-Type: text/plain; charset="UTF-8" Thanks for your explanations... (although I will need some time to think about and understand them) On Fri, 18 Mar 2022 at 13:14, Stefan Monnier wrote: > >> Also, I would expect that a hook just calls the hook function, and it > would > >> not 'restore the window > >> selected before the hook'. I would say the restoring is undesired > behavior. > > > > The idea is probably that a function on that hook should be allowed to > > inadvertently select some other window and have the hook runner fix > > that. Maybe Stefan can tell us more. > > No, IIRC it is just a consequence of needing to select windows when > running the local part of the hook (since that part is supposed to be > run for every window (which was modified) displaying that buffer). > > > Stefan > > --000000000000734d7605da8120cf Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks for your explanations... (although I will need some= time to think about and understand them)

On Fri, 18 Mar 2022 at 13:14, = Stefan Monnier <monnier@iro.= umontreal.ca> wrote:
>> Also, I would expect that a hook just calls the hook f= unction, and it would
>> not 'restore the window
>>=C2=A0 =C2=A0selected before the hook'. I would say the restori= ng is undesired behavior.
>
> The idea is probably that a function on that hook should be allowed to=
> inadvertently select some other window and have the hook runner fix > that.=C2=A0 Maybe Stefan can tell us more.

No, IIRC it is just a consequence of needing to select windows when
running the local part of the hook (since that part is supposed to be
run for every window (which was modified) displaying that buffer).


=C2=A0 =C2=A0 =C2=A0 =C2=A0 Stefan

--000000000000734d7605da8120cf--