From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Keith David Bershatsky Newsgroups: gmane.emacs.bugs Subject: bug#19684: 25.0.50; `this-command` is set to `nil` before `window-scroll-functions` hook runs. Date: Sun, 25 Jan 2015 09:42:44 -0800 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (generated by - "") Content-Type: text/plain; charset=US-ASCII X-Trace: ger.gmane.org 1422207799 25316 80.91.229.3 (25 Jan 2015 17:43:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 25 Jan 2015 17:43:19 +0000 (UTC) Cc: 19684@debbugs.gnu.org To: Martin Rudalics , Eli Zaretskii , Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jan 25 18:43:18 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YFRDO-0007fU-GI for geb-bug-gnu-emacs@m.gmane.org; Sun, 25 Jan 2015 18:43:14 +0100 Original-Received: from localhost ([::1]:38452 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFRDO-0007wY-0v for geb-bug-gnu-emacs@m.gmane.org; Sun, 25 Jan 2015 12:43:14 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40605) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFRDJ-0007tq-MG for bug-gnu-emacs@gnu.org; Sun, 25 Jan 2015 12:43:10 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YFRDF-0003NM-PL for bug-gnu-emacs@gnu.org; Sun, 25 Jan 2015 12:43:09 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:37466) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFRDF-0003NG-Lv for bug-gnu-emacs@gnu.org; Sun, 25 Jan 2015 12:43:05 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YFRDF-0005RU-1B for bug-gnu-emacs@gnu.org; Sun, 25 Jan 2015 12:43:05 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Keith David Bershatsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 25 Jan 2015 17:43:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19684 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: notabug Original-Received: via spool by 19684-submit@debbugs.gnu.org id=B19684.142220777620871 (code B ref 19684); Sun, 25 Jan 2015 17:43:04 +0000 Original-Received: (at 19684) by debbugs.gnu.org; 25 Jan 2015 17:42:56 +0000 Original-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 Original-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; Original-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 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:98716 Archived-At: 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