From unknown Tue Aug 19 07:27:06 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#19684 <19684@debbugs.gnu.org> To: bug#19684 <19684@debbugs.gnu.org> Subject: Status: 25.0.50; `this-command` is set to `nil` before `window-scroll-functions` hook runs. Reply-To: bug#19684 <19684@debbugs.gnu.org> Date: Tue, 19 Aug 2025 14:27:06 +0000 retitle 19684 25.0.50; `this-command` is set to `nil` before `window-scroll= -functions` hook runs. reassign 19684 emacs submitter 19684 Keith David Bershatsky severity 19684 normal tag 19684 notabug thanks From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 25 02:20:09 2015 Received: (at submit) by debbugs.gnu.org; 25 Jan 2015 07:20:09 +0000 Received: from localhost ([127.0.0.1]:55570 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YFHUN-0001xj-Mk for submit@debbugs.gnu.org; Sun, 25 Jan 2015 02:20:08 -0500 Received: from eggs.gnu.org ([208.118.235.92]:53508) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YFHUL-0001ww-8p for submit@debbugs.gnu.org; Sun, 25 Jan 2015 02:20:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YFHUD-0007UI-Up for submit@debbugs.gnu.org; Sun, 25 Jan 2015 02:19:59 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:34682) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFHUD-0007UE-S2 for submit@debbugs.gnu.org; Sun, 25 Jan 2015 02:19:57 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55230) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFHUC-0002Uf-2H for bug-gnu-emacs@gnu.org; Sun, 25 Jan 2015 02:19:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YFHU7-0007Tq-1T for bug-gnu-emacs@gnu.org; Sun, 25 Jan 2015 02:19:56 -0500 Received: from cobb.liquidweb.com ([50.28.13.150]:42442) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFHU6-0007Sv-Pj for bug-gnu-emacs@gnu.org; Sun, 25 Jan 2015 02:19:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lawlist.com; s=default; h=Content-Type:MIME-Version:Subject:To:From:Message-ID:Date; bh=M09rpbZ1wPl2b44TfPhuO0MWTjj+PV09Hu6EZ0DoLpA=; b=7f1snOoxb4rxuTkHPKRdrmcxnRlU82F57OGwTPTca9iwoyT/3VXH2i718uL/8rVSPPJxG2H5cvi9gRXs/O2qB2wqwjmvKEkYQuU+W9RFRLjBlY7gSfllxO1bj2v8FYlw; Received: from cpe-104-173-54-60.socal.res.rr.com ([104.173.54.60]:55593 helo=MP.local) by cobb.liquidweb.com with esmtp (Exim 4.82) (envelope-from ) id 1YFHU3-0008MU-8B for bug-gnu-emacs@gnu.org; Sun, 25 Jan 2015 02:19:47 -0500 Date: Sat, 24 Jan 2015 23:19:48 -0800 Message-ID: From: Keith David Bershatsky To: bug-gnu-emacs@gnu.org Subject: 25.0.50; `this-command` is set to `nil` before `window-scroll-functions` hook runs. MIME-Version: 1.0 (generated by - "") Content-Type: text/plain; charset=US-ASCII X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - cobb.liquidweb.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lawlist.com X-Get-Message-Sender-Via: cobb.liquidweb.com: acl_c_relayhosts_text_entry: lawlist|lawlist.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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: -5.0 (-----) To the extent that a user wishes to use the value of `this-command` within a function attached to the `window-scroll-functions` hook, a workaround is needed because the default value is `nil`. In other words, something at the C source code level is setting the value to `nil` before the `window-scroll-functions` hook runs. There are two (2) workarounds that I am aware of. 1. Expressly call `redisplay` at the tail end of the series of functions attached to the `post-command-hook`. Calling `redisplay` somehow prevents `this-command` from being reset to `nil` and the `window-scroll-functions` hook can then take advantage of the existing value of `this-command`. 2. Create a separate variable -- e.g., `my-this-command` and set the value within a function attached to the `post-command-hook`. Like so: (setq my-this-command this-command). And, then use the value of `my-this-command` within the function attached to the `window-scroll-functions` hook. The most reliable test I have discovered to pinpoint when the `window-scroll-functions` hook will activate is by having the following code within a function attached to the `post-command-hook`: (pos-visible-in-window-p (point) (get-buffer-window (current-buffer) (selected-frame))). If the result is `t`, then the `window-scroll-functions` hook will be activating. I do not see a visual difference between either of the two workarounds mentioned above, even though I would expect to see a flicker on the screen with the first workaround. However, there is no flicker. The second workaround is probably a safer bet. Although this bug report has been submitted with Emacs Trunk from October 1, 2014; the behavior is the same with Emacs Trunk built on January 1, 2015. Thanks, Keith ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; In GNU Emacs 25.0.50.1 (x86_64-apple-darwin10.8.0, NS appkit-1038.36 Version 10.6.8 (Build 10K549)) of 2014-10-01 on MP.local Repository revision: 117996 dmantipov@yandex.ru-20141001132108-zdsxru2390mqyjlu Windowing system distributor `Apple', version 10.3.1038 Configured using: `configure --with-ns' Configured features: ACL LIBXML2 ZLIB Important settings: locale-coding-system: utf-8-unix Major mode: Fundamental Minor modes in effect: sd-mode: t sb-mode: t tb-mode: t shell-dirtrack-mode: t cm-mode: t frame-bufs-mode: t bc-mode: t ds-mode: t ml-mode: t Recent input: x r e p o r t - e m a c s - b u g Recent messages: Wrote /Users/HOME/.0.data/.0.emacs/.lock Load-path shadows: /Users/HOME/.0.data/.0.emacs/.0.wl/md4 hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/md4 /Users/HOME/.0.data/.0.emacs/.0.wl/hex-util hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/hex-util /Users/HOME/.0.data/.0.emacs/.0.wl/sasl hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/net/sasl /Users/HOME/.0.data/.0.emacs/.0.wl/sasl-ntlm hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/net/sasl-ntlm /Users/HOME/.0.data/.0.emacs/.0.wl/sasl-digest hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/net/sasl-digest /Users/HOME/.0.data/.0.emacs/.0.wl/sasl-cram hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/net/sasl-cram /Users/HOME/.0.data/.0.emacs/.0.wl/ntlm hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/net/ntlm /Users/HOME/.0.data/.0.emacs/.0.wl/hmac-md5 hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/net/hmac-md5 /Users/HOME/.0.data/.0.emacs/.0.wl/hmac-def hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/net/hmac-def /Users/HOME/.0.data/.0.emacs/.0.wl/rfc2368 hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/mail/rfc2368 /Users/HOME/.0.data/.0.emacs/.0.wl/utf7 hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/gnus/utf7 /Users/HOME/.0.data/.0.emacs/.0.wl/smime hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/gnus/smime /Users/HOME/.0.data/.0.emacs/.0.wl/pgg hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/obsolete/pgg /Users/HOME/.0.data/.0.emacs/.0.wl/pgg-pgp5 hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/obsolete/pgg-pgp5 /Users/HOME/.0.data/.0.emacs/.0.wl/pgg-pgp hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/obsolete/pgg-pgp /Users/HOME/.0.data/.0.emacs/.0.wl/pgg-parse hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/obsolete/pgg-parse /Users/HOME/.0.data/.0.emacs/.0.wl/pgg-gpg hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/obsolete/pgg-gpg /Users/HOME/.0.data/.0.emacs/.0.wl/pgg-def hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/obsolete/pgg-def Features: (shadow disp-table mime-setup mail-mime-setup semi-setup mime-image modb-standard elmo-imap4 emacsbug lawlist-desktop frameset lawlist-bk lawlist-arc lawlist-dv lawlist-mc rect lawlist-ztree lawlist-wl w3m-load mime-w3m w3m browse-url doc-view jka-compr image-mode w3m-hist w3m-fb bookmark-w3m w3m-ems mule-util w3m-ccl w3m-favicon w3m-image w3m-proc w3m-util wl-demo wl-spam elmo-spam elsp-header elsp-generic wl-fldmgr wl-score smtp sasl sasl-anonymous sasl-login sasl-plain wl-news wl-address pldap wl-thread wl-action wl-e21 wl-draft wl-template wl-summary ps-print ps-def lpr wl-refile wl-message wl-mime pgg mime-pgp mime-play filename mime-edit eword-encode pgg-parse pccl pccl-20 ccl pgg-def signature sendmail elmo-mime mmelmo-buffer mmelmo-imap mime-view mime-conf calist semi-def mmimap mime-parse mmbuffer wl-highlight elmo-filter elmo-multi elmo-nntp wl-folder wl wl-util crm pp elmo-pop3 elmo-net elmo-cache elmo-map elmo-dop elmo-flag elmo-localdir wl-vars elmo elmo-signal elmo-msgdb modb modb-generic modb-entity mime mmgeneric elmo-util emu invisible inv-23 poem poem-e20 poem-e20_3 utf7 eword-decode mel mime-def alist std11 mcharset mcs-20 mcs-e20 pces pces-e20 pces-20 broken pcustom elmo-date elmo-vars path-util poe pym static product wl-version elmo-version apel-ver luna lawlist-vr-hr lawlist-test lawlist-sb lawlist-vl lawlist-ln lawlist-hl lawlist-parens lawlist-dired tramp-sh lawlist-ws lawlist-calc lawlist-flyspell lawlist-yas lawlist-elisp lawlist-tex-mode skeleton compare-w lawlist-txt-mode lawlist-tabbar lawlist-github ido view vc-git vc vc-dispatcher tramp tramp-compat tramp-loaddefs trampver shell thingatpt time-stamp log-view log-edit message mml mml-sec mm-decode mm-bodies mm-encode gmm-utils mailheader pcvs-util add-log json help-mode grep compile find-lisp epa epg epg-config ediff-merg ediff-wind ediff-diff ediff-mult ediff-help ediff-init ediff-util ediff ert ewoc debug eieio-base diff-mode conf-mode autorevert filenotify lorg-calendar org-element lorg-search org-agenda context-menu dired-read-filename dired count-business-days lawlist-toodledo url-http tls url url-proxy url-privacy url-expand url-methods url-history mailcap url-auth url-cookie url-domsuf url-util url-parse auth-source eieio eieio-core password-cache url-gw url-vars lawlist-org lawlist-calendar org byte-opt bytecomp byte-compile cconv org-macro org-footnote org-pcomplete pcomplete org-list org-faces org-entities noutline outline org-version ob-emacs-lisp ob ob-tangle org-src ob-ref ob-lob ob-table ob-keys ob-exp ob-comint ob-core ob-eval org-compat org-macs org-loaddefs find-func cal-menu easymenu calendar cal-loaddefs format-spec lawlist-frame lawlist-cm lawlist-bbdb gnus gnus-ems nnheader gnus-util mail-utils wid-edit mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mailabbrev mail-extr rfc822 cl timezone lawlist-grep lawlist-compile rx comint ansi-color ring lawlist-frame-bufs advice derived lawlist-window lawlist-print lawlist-undo pcase lawlist-tm lawlist-bc lawlist-as cl-macs gv lawlist-ds lawlist-ml easy-mmode lawlist-misc lawlist-keymap edmacro kmacro eldoc cl-loaddefs cl-lib help-fns savehist saveplace server time-date tooltip electric uniquify ediff-hook vc-hooks lisp-float-type mwheel ns-win tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer 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 make-network-process cocoa ns multi-tty emacs) Memory information: ((conses 16 1229677 95833) (symbols 48 61646 0) (miscs 40 105 150) (strings 32 132512 13095) (string-bytes 1 4616193) (vectors 16 33496) (vector-slots 8 697599 22896) (floats 8 942 252) (intervals 56 4202 0) (buffers 976 11)) From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 25 05:39:10 2015 Received: (at 19684) by debbugs.gnu.org; 25 Jan 2015 10:39:10 +0000 Received: from localhost ([127.0.0.1]:55607 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YFKb0-0006Yj-FA for submit@debbugs.gnu.org; Sun, 25 Jan 2015 05:39:10 -0500 Received: from mout.gmx.net ([212.227.15.19]:49756) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YFKaz-0006YN-64 for 19684@debbugs.gnu.org; Sun, 25 Jan 2015 05:39:09 -0500 Received: from [93.82.15.236] ([93.82.15.236]) by mail.gmx.com (mrgmx002) with ESMTPSA (Nemesis) id 0M8NWM-1XTIBT3pwI-00vuJO; Sun, 25 Jan 2015 11:39:02 +0100 Message-ID: <54C4C7BB.5070204@gmx.at> Date: Sun, 25 Jan 2015 11:38:51 +0100 From: martin rudalics MIME-Version: 1.0 To: Keith David Bershatsky , 19684@debbugs.gnu.org Subject: Re: bug#19684: 25.0.50; `this-command` is set to `nil` before `window-scroll-functions` hook runs. References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:aKNUuCk6BhR9vm9Wf5aooso+kqxvRS6otXxpsCHgDR2QQnv7aHy BxyUmFD70a84vDRyOmkgiV3Cchn68F02xGP7W1S7jgV+Wv9wylV9ecX75uF5ec9PIbx3RKc umd/ObEbhjTAstTbI25vMJfwHpZeZqstuEo2Rx5gp3snjfHgraGVwiIKLXmR+TQ7HQKayTr uapY/EODSMijv7WGlKMAA== X-UI-Out-Filterresults: notjunk:1; X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 19684 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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.0 (/) > To the extent that a user wishes to use the value of `this-command` > within a function attached to the `window-scroll-functions` hook, a > workaround is needed because the default value is `nil`. In other > words, something at the C source code level is setting the value to > `nil` before the `window-scroll-functions` hook runs. Couldn't you use `last-command' here? martin From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 25 10:33:45 2015 Received: (at 19684) by debbugs.gnu.org; 25 Jan 2015 15:33:45 +0000 Received: from localhost ([127.0.0.1]:55957 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YFPC4-0006V5-HY for submit@debbugs.gnu.org; Sun, 25 Jan 2015 10:33:44 -0500 Received: from mtaout27.012.net.il ([80.179.55.183]:44441) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YFPC2-0006Uq-Co for 19684@debbugs.gnu.org; Sun, 25 Jan 2015 10:33:43 -0500 Received: from conversion-daemon.mtaout27.012.net.il by mtaout27.012.net.il (HyperSendmail v2007.08) id <0NIQ00900O3QFQ00@mtaout27.012.net.il> for 19684@debbugs.gnu.org; Sun, 25 Jan 2015 17:26:41 +0200 (IST) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout27.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NIQ0066DO8HK030@mtaout27.012.net.il>; Sun, 25 Jan 2015 17:26:41 +0200 (IST) Date: Sun, 25 Jan 2015 17:33:20 +0200 From: Eli Zaretskii Subject: Re: bug#19684: 25.0.50; `this-command` is set to `nil` before `window-scroll-functions` hook runs. In-reply-to: X-012-Sender: halo1@inter.net.il To: Keith David Bershatsky Message-id: <8361buswn3.fsf@gnu.org> References: X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 19684 Cc: 19684@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Eli Zaretskii 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 (+) > Date: Sat, 24 Jan 2015 23:19:48 -0800 > From: Keith David Bershatsky > > To the extent that a user wishes to use the value of `this-command` within a > function attached to the `window-scroll-functions` hook, a workaround is needed > because the default value is `nil`. In other words, something at the C source > code level is setting the value to `nil` before the `window-scroll-functions` > hook runs. That "something" is the command loop itself: it resets 'this-command' when the command finishes and returns to the loop. Recall that in Emacs, execution of commands running the Lisp interpreter is separated from redisplay: the latter runs when Emacs is idle and is waiting for input. Since most of the calls to window-scroll-functions are made by the display engine, the command already returned to the command loop by that time. > Calling `redisplay` somehow prevents `this-command` from being reset > to `nil` I hope it is now clear why this happens: in this scenario redisplay is entered before the command finishes, so 'this-command' was still not reset. > The most reliable test I have discovered to pinpoint when the > `window-scroll-functions` hook will activate is by having the following code > within a function attached to the `post-command-hook`: > (pos-visible-in-window-p (point) (get-buffer-window (current-buffer) > (selected-frame))). If the result is `t`, then the `window-scroll-functions` > hook will be activating. You are well-advised not to depend on such implementation details. > Although this bug report has been submitted with Emacs Trunk from October 1, > 2014; the behavior is the same with Emacs Trunk built on January 1, 2015. Emacs always behaved like that. And it's not a bug. From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 25 11:14:27 2015 Received: (at 19684) by debbugs.gnu.org; 25 Jan 2015 16:14:27 +0000 Received: from localhost ([127.0.0.1]:56056 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YFPpS-0008Pl-Fp for submit@debbugs.gnu.org; Sun, 25 Jan 2015 11:14:26 -0500 Received: from pruche.dit.umontreal.ca ([132.204.246.22]:49006) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YFPpQ-0008PT-0u; Sun, 25 Jan 2015 11:14:24 -0500 Received: from ceviche.home (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id t0PGEMtF014830; Sun, 25 Jan 2015 11:14:22 -0500 Received: by ceviche.home (Postfix, from userid 20848) id 4BDBE66135; Sun, 25 Jan 2015 11:14:22 -0500 (EST) From: Stefan Monnier To: Keith David Bershatsky Subject: Re: bug#19684: 25.0.50; `this-command` is set to `nil` before `window-scroll-functions` hook runs. Message-ID: References: Date: Sun, 25 Jan 2015 11:14:22 -0500 In-Reply-To: (Keith David Bershatsky's message of "Sat, 24 Jan 2015 23:19:48 -0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV5197=0 X-NAI-Spam-Version: 2.3.0.9393 : core <5197> : inlines <1943> : streams <1379257> : uri <1843774> X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: 19684 Cc: 19684@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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.3 (-) tags 19684 notabug thanks > 1. Expressly call `redisplay` at the tail end of the series of > functions attached to the `post-command-hook`. > Calling `redisplay` somehow prevents `this-command` from being > reset to `nil` and the `window-scroll-functions` hook can then > take advantage of the existing value of `this-command`. It's not that calling `redisplay' prevents it. It's that the normal redisplay is run later (potentially much later if there are other things pending), at a point which is not directly connected with the command, hence this-command is not set any more because we're really not in the process of running that command any more. Stefan From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 25 12:42:56 2015 Received: (at 19684) by debbugs.gnu.org; 25 Jan 2015 17:42:56 +0000 Received: from localhost ([127.0.0.1]:56155 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YFRD5-0005QX-NZ for submit@debbugs.gnu.org; Sun, 25 Jan 2015 12:42:56 -0500 Received: from cobb.liquidweb.com ([50.28.13.150]:54535) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YFRD3-0005Q7-4p for 19684@debbugs.gnu.org; Sun, 25 Jan 2015 12:42:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lawlist.com; s=default; h=Content-Type:MIME-Version:Subject:Cc:To:From:Message-ID:Date; bh=PcTJDmOqOtftOZSVzGMBtQLLnyt3R40kxoLUqGxy9X0=; b=vXJIxOm5iY3gfhle4JmdGZRFjFRHOkiyeMcwrVDCi1Oqw7FZMIESv6UZJwKxS45r/ulHbGjVJa8/ICfaI2pehWBXyJgxVRLDezv9AGka8tCMCFyoVmcF3X11sajM7Vmx; Received: from cpe-104-173-54-60.socal.res.rr.com ([104.173.54.60]:49746 helo=MP.local) by cobb.liquidweb.com with esmtp (Exim 4.82) (envelope-from ) id 1YFRCu-0000BR-EG; Sun, 25 Jan 2015 12:42:44 -0500 Date: Sun, 25 Jan 2015 09:42:44 -0800 Message-ID: From: Keith David Bershatsky To: Martin Rudalics , Eli Zaretskii , Stefan Monnier Subject: Re: bug#19684: 25.0.50; `this-command` is set to `nil` before `window-scroll-functions` hook runs. MIME-Version: 1.0 (generated by - "") Content-Type: text/plain; charset=US-ASCII X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - cobb.liquidweb.com X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lawlist.com X-Get-Message-Sender-Via: cobb.liquidweb.com: acl_c_relayhosts_text_entry: lawlist|lawlist.com X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 19684 Cc: 19684@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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.0 (/) Thank you (Eli, Stefan and Martin) for helping me to better understand how the redisplay process works. I was surprised to learn that I could not depend upon either `this-command` or `last-command` when using the `window-scroll-functions` hook because a forced redisplay prior thereto -- e.g., `(redisplay)` -- makes a difference in the values. To obtain the name of the interactive function that ran before the `window-scroll-functions` hook was triggered: `this-command` may be used in the `window-scroll-functions` when there IS a forced redisplay prior thereto. `last command` may be used in the `window-scroll-functions` when there is NOT a forced redisplay prior thereto. I am unaware of any documentation that could have helped me to discover the behavior described above. Perhaps the Emacs team might consider adding something to the doc-string and/or the manual so that a user is advised as to the behavior, and to suggest an alternative approach: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defvar my-command nil) (defun set-my-command () (setq my-command this-command)) (add-hook 'post-command-hook 'set-my-command) (defun wsf-fn (win _start) "NOTE: Since the `window-scroll-functions` hook may be called more than once, the user may not wish to set `my-command` to `nil` at this time." (message "my-command: %s | this-command: %s | last-command: %s" my-command this-command last-command) (setq my-command nil)) (add-hook 'window-scroll-functions-hook 'wsf-fn) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Thanks, Keith From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 01 16:17:17 2019 Received: (at 19684-done) by debbugs.gnu.org; 1 Oct 2019 20:17:17 +0000 Received: from localhost ([127.0.0.1]:34889 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iFOaD-0002jy-30 for submit@debbugs.gnu.org; Tue, 01 Oct 2019 16:17:17 -0400 Received: from mail-pf1-f180.google.com ([209.85.210.180]:36634) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iFOaB-0002eo-AP for 19684-done@debbugs.gnu.org; Tue, 01 Oct 2019 16:17:15 -0400 Received: by mail-pf1-f180.google.com with SMTP id y22so8883599pfr.3 for <19684-done@debbugs.gnu.org>; Tue, 01 Oct 2019 13:17:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=pCOoDgIt8lc+fyTb6VyOWVFDk1mansRyQVyODX01l8g=; b=M+tE2lhl56rNFyk94CLQ3T/d2RsKMX/pQU55sIG7aorSPTR/OBmul2vWuq14Pr0bTH Q3yd2w7qJR6KAl1hrShSJcRiEjlz3gt8XErPaBQvpE1e1XsZEay4j2P0Ho58HiE+8eII O9Q109P/Bp6qH3dQaZKuepUqlfYri7GxekJNaQWWJDs58JhZRKvjubLuisHJkO5126Eq cTi9pECNe7+Gu27+8ve9FJAOaWjkmAf1oc6TMxXgqi3G1X5Py7IV7kJSmioCQE+AMjDw GdmG1KgLCBDuFFw3v76kpQTgx3wym7cd25ZdPQ1nGuDkf5elq4bGGvzFvrlR8PF4zYXb iMTw== X-Gm-Message-State: APjAAAWf5f47eI3AzfQf4DBpgGa1Y59I1Og+SpQz0jW8TNmPhkCptxCq 6KnoOjMYjyOAKhtxfD0xgJc5Igz8N8W4Nmz9API= X-Google-Smtp-Source: APXvYqxucnGxfc3SqdZCVqISOxoEIYcMt0IVwMxJy2BHGGw27oIV37n2Hh/d49EryVfvLBvDLjSX2aRmy/lcZBqh5oQ= X-Received: by 2002:a17:90a:cc08:: with SMTP id b8mr7516482pju.119.1569961029460; Tue, 01 Oct 2019 13:17:09 -0700 (PDT) MIME-Version: 1.0 From: Stefan Kangas Date: Tue, 1 Oct 2019 22:16:57 +0200 Message-ID: Subject: Re: bug#19684: 25.0.50; `this-command` is set to `nil` before `window-scroll-functions` hook runs. To: Stefan Monnier Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.2 (/) X-Debbugs-Envelope-To: 19684-done Cc: Keith David Bershatsky , 19684-done@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: -0.8 (/) Stefan Monnier writes: > tags 19684 notabug > thanks > >> 1. Expressly call `redisplay` at the tail end of the series of >> functions attached to the `post-command-hook`. >> Calling `redisplay` somehow prevents `this-command` from being >> reset to `nil` and the `window-scroll-functions` hook can then >> take advantage of the existing value of `this-command`. > > It's not that calling `redisplay' prevents it. It's that the normal > redisplay is run later (potentially much later if there are other things > pending), at a point which is not directly connected with the command, > hence this-command is not set any more because we're really not in the > process of running that command any more. This was already tagged notabug; I'm now also closing it. Best regards, Stefan Kangas From unknown Tue Aug 19 07:27:06 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 30 Oct 2019 11:24:10 +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