From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 02 21:07:13 2014 Received: (at submit) by debbugs.gnu.org; 3 Oct 2014 01:07:13 +0000 Received: from localhost ([127.0.0.1]:59601 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XZrKx-0005cZ-Hs for submit@debbugs.gnu.org; Thu, 02 Oct 2014 21:07:12 -0400 Received: from eggs.gnu.org ([208.118.235.92]:43153) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XZrKv-0005cQ-9A for submit@debbugs.gnu.org; Thu, 02 Oct 2014 21:07:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XZrKn-0000OG-OZ for submit@debbugs.gnu.org; Thu, 02 Oct 2014 21:07:09 -0400 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]:59804) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XZrKn-0000Nl-Kz for submit@debbugs.gnu.org; Thu, 02 Oct 2014 21:07:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44858) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XZrKh-0002DD-6p for bug-gnu-emacs@gnu.org; Thu, 02 Oct 2014 21:07:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XZrKa-0000CJ-Rl for bug-gnu-emacs@gnu.org; Thu, 02 Oct 2014 21:06:55 -0400 Received: from cobb.liquidweb.com ([50.28.13.150]:37096) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XZrKa-00009O-Hn for bug-gnu-emacs@gnu.org; Thu, 02 Oct 2014 21:06:48 -0400 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=NRj2PLtoeVPA7gAMcsklY8nlq0GZebxrGQurSGvSXuY=; b=jqZ0O8PfwLogNMV+577NDUdZBtELLEWA1IbSe+KJL3UNW3fLne7X4uF4st/DbCFN3Baap5G1hZNRe0vfDWfMvcxWFMDZeSUqadtzW88MWuOpPxMP3bna1mWLgqjrfmS6; Received: from cpe-75-85-5-102.socal.res.rr.com ([75.85.5.102]:49691 helo=MP.local) by cobb.liquidweb.com with esmtp (Exim 4.82) (envelope-from ) id 1XZrKV-0006aY-Tq for bug-gnu-emacs@gnu.org; Thu, 02 Oct 2014 21:06:44 -0400 Date: Thu, 02 Oct 2014 18:06:45 -0700 Message-ID: From: Keith David Bershatsky To: bug-gnu-emacs@gnu.org Subject: 25.0.50; `window-end win t` produces erroenous result with `window-scroll-functions` hook. User-Agent: / () / () APEL/10.8 Emacs/25.0.50 (x86_64-apple-darwin10.8.0) MULE/6.0 (HANACHIRUSATO) 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 (-----) Steps to reproduce the issue. 1. Create a function that reports (e.g., a message) the value of `(window-end win t)` and attach that function to the `window-scroll-functions` hook. 2. Open a long file in either fundamental-mode or text-mode. 3. M-x end-of-buffer 4. M-x beginning-of-buffer The result of step 4 reports an erroneous window-end value that is at the very end of the buffer, instead of the correct window-end (i.e., which is much closer to the beginning of the buffer). This makes it impossible to correctly draw overlays between window-start and window-end, because Emacs thinks the entire buffer should be used following an interactive use of `beginning-of-buffer`. Please feel free to use my test-mode, which is a minor mode for testing window-start and window-end. Thanks, Keith ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; test-mode (defvar test-old-window-start nil "This local variable is set within the `post-command-hook`; and, is also used by the `window-scroll-functions` hook.") (make-variable-buffer-local 'test-old-window-start) (defvar test-old-window-end nil "This local variable is set within the `post-command-hook`; and, is also used by the `window-scroll-functions` hook.") (make-variable-buffer-local 'test-old-window-end) (defvar test-old-window-end-forced nil "This local variable is set within the `post-command-hook`; and, is also used by the `window-scroll-functions` hook.") (make-variable-buffer-local 'test-old-window-end-forced) (defvar test-new-window-start nil "This local variable is set within the `window-scroll-functions`.") (make-variable-buffer-local 'test-new-window-start) (defvar test-new-window-end nil "This local variable is set within the `window-scroll-functions`.") (make-variable-buffer-local 'test-new-window-end) (defun test-post-command-hook () "NOT good for things like: `beginning-of-buffer`; `end-of-buffer`; `yank`; etc. NOTE: When using `this-command` in conjunction with the `post-command-hook`, the `window-scroll-functions` hook would need to use `last-command`." (when (and (not (minibufferp)) (window-live-p (get-buffer-window (current-buffer)))) (setq test-old-window-start (window-start)) (setq test-old-window-end (window-end)) (setq test-old-window-end-forced (window-end nil t)) ;; DEBUGGING TEST ;; (message "pt: %s | ows: %s | owe: %s | owe-f: %s" ;; (point) ;; test-old-window-start ;; test-old-window-end ;; test-old-window-end-forced) (when (or (and (not (< (point) test-old-window-start)) (pos-visible-in-window-p (point) (get-buffer-window (current-buffer) (selected-frame))) (not (> (point) test-old-window-end)) (not (> (point) test-old-window-end-forced))) ;; special situation when deleting region greater than size of window. (and (region-active-p) (< test-old-window-end 0)) ;; special situation when deleting region greater than size of window. (and (region-active-p) (> (point) test-old-window-start) (> (point) test-old-window-end) (< (point) test-old-window-end-forced)) ) (test-mode-demonstration test-old-window-start test-old-window-end test-old-window-end-forced nil nil)))) (defun test-window-scroll-functions (win _start) "Good for things like: `beginning-of-buffer`; `end-of-buffer`; `yank`; etc. NOTE: When using `this-command` in conjunction with the `post-command-hook`, the `window-scroll-functions` hook would need to use `last-command`." (when (and test-old-window-start test-old-window-end test-old-window-end-forced (not (minibufferp)) (window-live-p (get-buffer-window (current-buffer)))) ;; DEBUGGING TEST ;; (message "nws: %s | nwe-f: %s" _start (window-end nil t)) (when (or (not (= _start test-old-window-start)) (not (pos-visible-in-window-p (point) (get-buffer-window (current-buffer) (selected-frame)))) (< (point) test-old-window-start) (> (point) test-old-window-end) (> (point) test-old-window-end-forced)) (setq test-new-window-start _start) (setq test-new-window-end (window-end win t)) ;; FIX-ME -- special circumstance when jumping paragraph down. ;; (when (> (point) test-new-window-end) ;; (setq test-new-window-end . . . (test-mode-demonstration nil nil nil test-new-window-start test-new-window-end) (setq test-old-window-start nil) (setq test-old-window-end nil) (setq test-old-window-end-forced nil)))) (defun test-mode-demonstration (&optional test-old-window-start test-old-window-end test-old-window-end-forced test-new-window-start test-new-window-end) "This is a test-mode demonstration function." (let* ( (window-start (cond (test-old-window-start test-old-window-start) (test-new-window-start test-new-window-start) (t (window-start)))) (window-end (cond ((and test-old-window-end test-old-window-end-forced (= test-old-window-end test-old-window-end-forced)) test-old-window-end) ((and test-old-window-end test-old-window-end-forced (> test-old-window-end-forced test-old-window-end)) test-old-window-end-forced) (test-new-window-end test-new-window-end) (t (window-end (selected-window) t)))) ) (cond ((and test-old-window-start test-old-window-end test-old-window-end-forced) (message (concat "P.C.H. -- `point`: %s | " "`test-old-window-start`: %s | " "`test-old-window-end`: %s | " "`test-old-window-end-forced`: %s") (point) test-old-window-start test-old-window-end test-old-window-end-forced)) ((and test-new-window-start test-new-window-end) (message (concat "W.S.F. -- `point`: %s | " "`test-new-window-start`: %s | " "`test-new-window-end`: %s") (point) test-new-window-start test-new-window-end))) )) (define-minor-mode test-mode "A minor-mode for testing `window-start` / `window-end` BEFORE visual redisplay." :init-value nil :lighter " TEST" :keymap nil :global nil :group nil (cond (test-mode (condition-case error (progn (setq scroll-conservatively 101) (setq max-mini-window-height 2) (add-hook 'post-command-hook 'test-post-command-hook nil t) (add-hook 'window-scroll-functions 'test-window-scroll-functions nil t) (when (called-interactively-p 'any) (message "Turned ON `test-mode`."))) (error (test-mode 0) (signal (car error) (cdr error))))) ((not test-mode) (setq max-mini-window-height 0.25) (remove-hook 'post-command-hook 'test-post-command-hook t) (remove-hook 'window-scroll-functions 'test-window-scroll-functions t) (when (called-interactively-p 'any) (message "Turned OFF `test-mode`.") )))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 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: Text Minor modes in effect: sd-mode: t test-mode: t sb-mode: t tb-mode: t shell-dirtrack-mode: t cm-mode: t bc-mode: t as-mode: t ds-mode: t ml-mode: t Recent input: Recent messages: Mark set W.S.F. -- `point`: 1 | `test-new-window-start`: 1 | `test-new-window-end`: 339823 Turned ON `test-mode`. P.C.H. -- `point`: 1191 | `test-old-window-start`: 1 | `test-old-window-end`: 5438 | `test-old-window-end-forced`: 5438 W.S.F. -- `point`: 339823 | `test-new-window-start`: 339179 | `test-new-window-end`: 339823 Mark set W.S.F. -- `point`: 1 | `test-new-window-start`: 1 | `test-new-window-end`: 339823 W.S.F. -- `point`: 339823 | `test-new-window-start`: 339179 | `test-new-window-end`: 339823 Mark set W.S.F. -- `point`: 1 | `test-new-window-start`: 1 | `test-new-window-end`: 339823 Load-path shadows: /Users/HOME/.0.data/.0.emacs/.0.flim/md4 hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/md4 /Users/HOME/.0.data/.0.emacs/.0.flim/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.flim/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.flim/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.flim/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.flim/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.flim/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.flim/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.flim/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.simi/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.simi/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.simi/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.simi/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.simi/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.simi/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.simi/pgg-def hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/obsolete/pgg-def Features: (shadow emacsbug modb-legacy mime-setup mail-mime-setup semi-setup mime-image modb-standard elmo-imap4 eieio-opt speedbar sb-image ezimage dframe lawlist-desktop frameset lawlist-dv lawlist-mc rect lawlist-ztree lawlist-wl elmo-nntp wl-demo wl-news wl-address wl-thread wl wl-e21 wl-draft elmo-pop3 wl-template elmo-net elmo-cache elmo-map elmo-dop wl-folder wl-spam wl-action wl-summary wl-refile wl-message wl-mime pgg mime-pgp wl-util pp elmo-flag elmo-localdir mime-play filename mime-edit eword-encode pgg-parse pccl pccl-20 pgg-def signature sendmail elmo-mime mmelmo-buffer mmelmo-imap mime-view mime-conf calist semi-def mmimap mime-parse mmbuffer mmgeneric elmo-filter elmo-multi elmo-spam elsp-header elsp-generic elmo elmo-signal wl-highlight wl-vars wl-version elmo-msgdb modb modb-generic modb-entity luna mime elmo-util emu invisible inv-23 poem poem-e20 poem-e20_3 eword-decode std11 elmo-date elmo-vars elmo-version w3m-load mime-w3m w3m browse-url doc-view jka-compr image-mode w3m-hist w3m-fb bookmark-w3m w3m-ems w3m-ccl ccl w3m-favicon w3m-image w3m-proc w3m-util lawlist-dired dired-aux lawlist-vr-hr lawlist-ws disp-table lawlist-calculator lawlist-flyspell bbdb-autoloads bbdb lawlist-yasnippet lawlist-tex-mode skeleton compare-w lawlist-text-mode lawlist-tabbar lawlist-github ido view tramp tramp-compat tramp-loaddefs trampver shell pcomplete help-mode grep compile comint epa epg epg-config diff-mode autorevert filenotify ansi-color find-lisp log-edit ring add-log thingatpt log-view pcvs-util conf-mode time-stamp vc-git vc vc-dispatcher ediff-merg ediff-wind ediff-diff ediff-mult ediff-help ediff-init ediff-util ediff rx ert ewoc debug timezone eieio-base lawlist-toodledo url-http url-auth url-gw url url-proxy url-privacy url-expand url-methods url-history url-cookie url-domsuf url-util url-parse auth-source eieio eieio-core password-cache url-vars mailcap json xml lawlist-org lawlist-calendar byte-opt bytecomp byte-compile cconv derived noutline outline gnus-sum gnus-group gnus-undo gnus-start gnus-cloud nnimap nnmail mail-source tls utf7 mel path-util mime-def alist mcharset mcs-20 mcs-e20 pcustom pces pces-e20 pces-20 broken poe pym static apel-ver product netrc nnoo parse-time gnus-spec gnus-int gnus-range message dired format-spec rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev gmm-utils mailheader gnus-win gnus gnus-ems nnheader gnus-util mail-utils mm-util mail-prsvr wid-edit cl lawlist-frame lawlist-init pcase cl-macs gv advice help-fns easy-mmode edmacro kmacro cl-loaddefs cl-lib savehist server ps-print ps-def lpr find-func saveplace easymenu 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 893343 108197) (symbols 48 57109 0) (miscs 40 115 576) (strings 32 115451 12362) (string-bytes 1 3835645) (vectors 16 43897) (vector-slots 8 1477759 244392) (floats 8 977 154) (intervals 56 4347 92) (buffers 976 16)) From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 02 22:11:13 2014 Received: (at 18618) by debbugs.gnu.org; 3 Oct 2014 02:11:13 +0000 Received: from localhost ([127.0.0.1]:59611 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XZsKv-0007Bm-AU for submit@debbugs.gnu.org; Thu, 02 Oct 2014 22:11:13 -0400 Received: from cobb.liquidweb.com ([50.28.13.150]:39355) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XZsKs-0007Bb-2y for 18618@debbugs.gnu.org; Thu, 02 Oct 2014 22:11:10 -0400 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=jtvmuOkAS2/5a6JT6ni3t5sHqgW9L+JsKYDzOAFgxx0=; b=eoTNuD0DESdv1mUZh5q8M4HHCvdzeJbK8CsvGmcnItcc7i1ORKLrEkKtu/Hr1Zv+crc2rNi4LpFZ+i6XzznRv8uaIzDoFYm0pytcobniiDMc47yU9xmlYcXIFhG+JqA1; Received: from cpe-75-85-5-102.socal.res.rr.com ([75.85.5.102]:49980 helo=MP.local) by cobb.liquidweb.com with esmtp (Exim 4.82) (envelope-from ) id 1XZsKo-0003bP-Gb for 18618@debbugs.gnu.org; Thu, 02 Oct 2014 22:11:06 -0400 Date: Thu, 02 Oct 2014 19:11:08 -0700 Message-ID: From: Keith David Bershatsky To: 18618@debbugs.gnu.org Subject: `window-end win t` produces erroenous result with `window-scroll-functions` hook. User-Agent: / () / () APEL/10.8 Emacs/24.4.50 (x86_64-apple-darwin10.8.0) MULE/6.0 (HANACHIRUSATO) 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: 18618 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 (/) Upon some further testing, I see that `transient-mark-mode` interferes with properly calculating the new window-end when using the window-scroll-functions hook (e.g., going from the end of the buffer the `beginning-of-buffer`). When `transient-mark-mode` is enabled, the wrong window end is reported. When `transient-mark-mode` is deactivated `(transient-mark-mode -1)`, the correct window end is reported. Keith From debbugs-submit-bounces@debbugs.gnu.org Fri May 28 23:37:30 2021 Received: (at 18618) by debbugs.gnu.org; 29 May 2021 03:37:30 +0000 Received: from localhost ([127.0.0.1]:55631 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lmpn0-0002kq-7G for submit@debbugs.gnu.org; Fri, 28 May 2021 23:37:30 -0400 Received: from quimby.gnus.org ([95.216.78.240]:33826) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lmpmy-0002kX-5w for 18618@debbugs.gnu.org; Fri, 28 May 2021 23:37:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=ccSwZ+9C/pdg7dfgQAnpb/tP4Wb4aocD4owebH+nGz4=; b=MRcb/6dBJlSvmyXlwNmQVRE5R5 bDv0OLFb0E5cQSCDOktMYVHsbUboWSmsLWT2D3n5sqkcBFVGnp4f2ptYKDxfTuRqjh4Qjpx0WzEm0 0XSJEo/tJz6kAGJYjxK7ZWXrEcmHx5jsENqcMaZsQh9omHpxCZuAjaFUd6xTWDtjBaM0=; Received: from cm-84.212.220.105.getinternet.no ([84.212.220.105] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lmpmp-0000fl-93; Sat, 29 May 2021 05:37:21 +0200 From: Lars Ingebrigtsen To: Keith David Bershatsky Subject: Re: bug#18618: 25.0.50; `window-end win t` produces erroenous result with `window-scroll-functions` hook. References: X-Now-Playing: Joni Mitchell's _Ladies of the Canyon_: "Ladies Of The Canyon" Date: Sat, 29 May 2021 05:37:18 +0200 In-Reply-To: (Keith David Bershatsky's message of "Thu, 02 Oct 2014 18:06:45 -0700") Message-ID: <87lf7yus5t.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Keith David Bershatsky writes: > Steps to reproduce the issue. > > 1. Create a function that reports (e.g., a message) the value of `(window-end win t)` and attach that function to the `window-scroll-functions` hook. > > 2. Open a [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 18618 Cc: 18618@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Keith David Bershatsky writes: > Steps to reproduce the issue. > > 1. Create a function that reports (e.g., a message) the value of `(window-end win t)` and attach that function to the `window-scroll-functions` hook. > > 2. Open a long file in either fundamental-mode or text-mode. > > 3. M-x end-of-buffer > > 4. M-x beginning-of-buffer > > The result of step 4 reports an erroneous window-end value that is at > the very end of the buffer, instead of the correct window-end (i.e., > which is much closer to the beginning of the buffer). (I'm going through old bug reports that unfortunately got no response at the time.) This problem is still present in Emacs 28. Here's an easier test case: (defun foo (win _) (message "End: %s" (window-end win t)) nil) (push 'foo window-scroll-functions) This reports the same number in both 3) and 4) when transient-mark-mode is switched on, but not when it's off. It's also correct if that mode is on, and the region is active. I haven't tried to debug further -- perhaps it's immediately obvious to somebody what could be causing this glitch? -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Sat May 29 02:16:47 2021 Received: (at 18618) by debbugs.gnu.org; 29 May 2021 06:16:47 +0000 Received: from localhost ([127.0.0.1]:55820 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lmsH9-0000jn-EX for submit@debbugs.gnu.org; Sat, 29 May 2021 02:16:47 -0400 Received: from gateway23.websitewelcome.com ([192.185.50.185]:48753) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lmsH7-0000hM-0q for 18618@debbugs.gnu.org; Sat, 29 May 2021 02:16:46 -0400 Received: from cm17.websitewelcome.com (cm17.websitewelcome.com [100.42.49.20]) by gateway23.websitewelcome.com (Postfix) with ESMTP id 651AC3C24 for <18618@debbugs.gnu.org>; Sat, 29 May 2021 01:16:44 -0500 (CDT) Received: from gator3053.hostgator.com ([50.87.144.69]) by cmsmtp with SMTP id msH5lR68qMGeEmsH6lNAHx; Sat, 29 May 2021 01:16:44 -0500 X-Authority-Reason: nr=8 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: Sender:Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=JqsopWoi1HUa8PzTNQAdrp8J4LFhP/YcUfU8k1ZHE7A=; b=cgCU6jI72o49YetH58ezDznURP h7g2s9LQTQ/9GYRbtZ9WDGJKU1oBe86MgUFkec+C6AQEZcEgg1UN2eJQZefZ+kMj6VGxAQS0/WWED AAvpT7C7f6v2RolWm2hERRbQLSOAglNPGJlZeN83ZQAGVao65iM4jTUEI/HU/4GkMRDp2HRvg9fh/ U6cnq/P0SF4xec92v6qqb7mWAJxtUGNSlsA6K+4E1nE+lZRBVrDIR9k7LZHpLkUmUBlmJlQYcBFRh AMHC6HAwh5sXUbFQ9rqVg/7tor3tXKEANNCK6sbpdwN+tMlLwUlkdeXNdUQXze5INsfLjAgsg2vOY 4WvixdRA==; Received: from cpe-45-48-245-70.socal.res.rr.com ([45.48.245.70]:57862 helo=mp-capitan.local) by gator3053.hostgator.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1lmsH5-004Imk-KI; Sat, 29 May 2021 01:16:43 -0500 Date: Fri, 28 May 2021 23:16:41 -0700 Message-ID: From: Keith David Bershatsky To: Lars Ingebrigtsen Subject: Re: bug#18618: 25.0.50; `window-end win t` produces erroenous result with `window-scroll-functions` hook. MIME-Version: 1.0 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 - gator3053.hostgator.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-BWhitelist: no X-Source-IP: 45.48.245.70 X-Source-L: No X-Exim-ID: 1lmsH5-004Imk-KI X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: cpe-45-48-245-70.socal.res.rr.com (mp-capitan.local) [45.48.245.70]:57862 X-Source-Auth: lawlist X-Email-Count: 2 X-Source-Cap: bGF3bGlzdDtsYXdsaXN0O2dhdG9yMzA1My5ob3N0Z2F0b3IuY29t X-Local-Domain: yes X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 18618 Cc: 18618@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Lars: I haven't played in depth with the Emacs internals for a couple of years or so. In working on my own feature requests (back in the day), I learned that window-start/end cannot be accurately ascertained with 100% certainty until the tail end of redisplay ... If a user were to add/remove something with Lisp, then redisplay would need to recalculate to take that modification into consideration -- necessitating further recalculation, which may alter window-start/end. In terms of my own feature requests, I opted to use `update_window` in dispnew.c to add visual modifications to the glass that did not alter any text or points in the buffer. That way, no further calculation was needed as to window-start/end points -- as said points were "final" calculations at that late stage of redisplay. The `window-scroll-functions` hook only operates under certain criteria, but not all the time. As of my last look a couple of years ago, there was no hook that operated towards the latter part of redisplay with 100% certainty. For a few years before using `update_window`, I used a combination of the `post-command-hook` and the `window-scroll-functions` hook to try and catch the majority of situations to ascertain window-start/end, but there were always several situations where the two hooks where insufficient ... An example of what users were required to do back in the day can be seen by examining libraries such as the deprecated linum-mode, which used both o f the aforementioned hooks because there is/was no sole hook that could accurately predict window-start/end with 100% certainty. Keith ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > Date: [05-28-2021 20:37:18] <29 May 2021 05:37:18 +0200> > From: Lars Ingebrigtsen > To: Keith David Bershatsky > Cc: 18618@debbugs.gnu.org > Subject: Re: bug#18618: 25.0.50; `window-end win t` produces erroenous result with `window-scroll-functions` hook. > > Keith David Bershatsky writes: > > > Steps to reproduce the issue. > > > > 1. Create a function that reports (e.g., a message) the value of `(window-end win t)` and attach that function to the `window-scroll-functions` hook. > > > > 2. Open a long file in either fundamental-mode or text-mode. > > > > 3. M-x end-of-buffer > > > > 4. M-x beginning-of-buffer > > > > The result of step 4 reports an erroneous window-end value that is at > > the very end of the buffer, instead of the correct window-end (i.e., > > which is much closer to the beginning of the buffer). > > (I'm going through old bug reports that unfortunately got no response at > the time.) > > This problem is still present in Emacs 28. Here's an easier test case: > > (defun foo (win _) > (message "End: %s" (window-end win t)) > nil) > (push 'foo window-scroll-functions) > > This reports the same number in both 3) and 4) when transient-mark-mode > is switched on, but not when it's off. It's also correct if that mode > is on, and the region is active. > > I haven't tried to debug further -- perhaps it's immediately obvious to > somebody what could be causing this glitch? > > -- > (domestic pets only, the antidote for overdose, milk.) > bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Sat May 29 02:24:29 2021 Received: (at 18618) by debbugs.gnu.org; 29 May 2021 06:24:29 +0000 Received: from localhost ([127.0.0.1]:55828 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lmsOa-0001e2-Mg for submit@debbugs.gnu.org; Sat, 29 May 2021 02:24:28 -0400 Received: from eggs.gnu.org ([209.51.188.92]:46200) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lmsOV-0001df-N0; Sat, 29 May 2021 02:24:27 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:35610) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lmsOQ-0000gB-6u; Sat, 29 May 2021 02:24:18 -0400 Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:4794 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lmsOP-0001JH-Pf; Sat, 29 May 2021 02:24:18 -0400 Date: Sat, 29 May 2021 09:24:23 +0300 Message-Id: <83im326ors.fsf@gnu.org> From: Eli Zaretskii To: Lars Ingebrigtsen In-Reply-To: <87lf7yus5t.fsf@gnus.org> (message from Lars Ingebrigtsen on Sat, 29 May 2021 05:37:18 +0200) Subject: Re: bug#18618: 25.0.50; `window-end win t` produces erroenous result with `window-scroll-functions` hook. References: <87lf7yus5t.fsf@gnus.org> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 18618 Cc: 18618@debbugs.gnu.org, esq@lawlist.com 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 (---) tags 18618 notabug close 18618 thanks > From: Lars Ingebrigtsen > Date: Sat, 29 May 2021 05:37:18 +0200 > Cc: 18618@debbugs.gnu.org > > Keith David Bershatsky writes: > > > Steps to reproduce the issue. > > > > 1. Create a function that reports (e.g., a message) the value of `(window-end win t)` and attach that function to the `window-scroll-functions` hook. > > > > 2. Open a long file in either fundamental-mode or text-mode. > > > > 3. M-x end-of-buffer > > > > 4. M-x beginning-of-buffer > > > > The result of step 4 reports an erroneous window-end value that is at > > the very end of the buffer, instead of the correct window-end (i.e., > > which is much closer to the beginning of the buffer). > > (I'm going through old bug reports that unfortunately got no response at > the time.) > > This problem is still present in Emacs 28. Here's an easier test case: > > (defun foo (win _) > (message "End: %s" (window-end win t)) > nil) > (push 'foo window-scroll-functions) > > This reports the same number in both 3) and 4) when transient-mark-mode > is switched on, but not when it's off. It's also correct if that mode > is on, and the region is active. > > I haven't tried to debug further -- perhaps it's immediately obvious to > somebody what could be causing this glitch? This isn't supposed to work. The doc string of window-end says: Return position at which display currently ends in WINDOW. WINDOW must be a live window and defaults to the selected one. This is updated by redisplay, when it runs to completion. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ By contrast, window-scroll-functions is a hook run by the display engine in the middle of redisplaying a window, when the display engine concludes that it is about to scroll the window. At that point, the window's redisplay is by definition not complete yet, so this can only work by chance. Which is why window-scroll-functions' doc string says explicitly this doesn't work: Note that the value of ‘window-end’ is not valid when these functions are called. So Emacs behaves here as designed and as documented, and I'm therefore closing this bug. From unknown Sun Jun 22 08:04:18 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 26 Jun 2021 11:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator