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#17678: 24.4.50; Feature Request -- calculate new `window-start` & `window-end` before visual redisplay Date: Fri, 13 Jun 2014 13:21:02 -0700 Message-ID: <982E0AD5-5D0B-43F0-BF17-CDAB88C239BA@lawlist.com> References: <831tuvz3n8.fsf@gnu.org> <83ha3qxbcc.fsf@gnu.org> <8361k5xra8.fsf@gnu.org> <83r42tvt0l.fsf@gnu.org> <83ha3ox3vk.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1402690945 31654 80.91.229.3 (13 Jun 2014 20:22:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 13 Jun 2014 20:22:25 +0000 (UTC) Cc: 17678@debbugs.gnu.org To: Eli Zaretskii , Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jun 13 22:22:19 2014 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 1WvXzO-0000Yx-Gm for geb-bug-gnu-emacs@m.gmane.org; Fri, 13 Jun 2014 22:22:18 +0200 Original-Received: from localhost ([::1]:33076 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WvXzN-0000SY-Rd for geb-bug-gnu-emacs@m.gmane.org; Fri, 13 Jun 2014 16:22:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47168) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WvXzF-0000QQ-29 for bug-gnu-emacs@gnu.org; Fri, 13 Jun 2014 16:22:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WvXz8-00035Q-Qt for bug-gnu-emacs@gnu.org; Fri, 13 Jun 2014 16:22:09 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:55832) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WvXz8-00034i-OL for bug-gnu-emacs@gnu.org; Fri, 13 Jun 2014 16:22:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1WvXz7-0006Ti-Vx for bug-gnu-emacs@gnu.org; Fri, 13 Jun 2014 16:22:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Keith David Bershatsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 13 Jun 2014 20:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17678 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 17678-submit@debbugs.gnu.org id=B17678.140269087324820 (code B ref 17678); Fri, 13 Jun 2014 20:22:01 +0000 Original-Received: (at 17678) by debbugs.gnu.org; 13 Jun 2014 20:21:13 +0000 Original-Received: from localhost ([127.0.0.1]:46982 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WvXyK-0006SD-34 for submit@debbugs.gnu.org; Fri, 13 Jun 2014 16:21:12 -0400 Original-Received: from cobb.liquidweb.com ([50.28.13.150]:45320) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WvXyH-0006Rs-V3 for 17678@debbugs.gnu.org; Fri, 13 Jun 2014 16:21:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lawlist.com; s=default; h=To:References:Message-Id:Content-Transfer-Encoding:Cc:Date:In-Reply-To:From:Content-Type:Mime-Version:Subject; bh=6aBDThrhdYfnftb0rfVM7/CLE9m2UjJmqSfem5WRH8A=; b=U8udA+JXtHUdA54RN8oIaYg56ZmuMR/dh7Q82yJWb5sq+3CxxqqKNEjwWCxWPTzgflNdaaYuJrBoUKddcBD12r+rVcwKVG/AW7RiMCkqgrM8RUsNsx+stmFO6ug9Seri; Original-Received: from cpe-75-85-5-102.socal.res.rr.com ([75.85.5.102]:51262 helo=[192.168.0.4]) by cobb.liquidweb.com with esmtpa (Exim 4.82) (envelope-from ) id 1WvXy7-0005qS-A8; Fri, 13 Jun 2014 16:20:59 -0400 In-Reply-To: X-Mailer: Apple Mail (2.1084) 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: authenticated_id: lawlist/from_h 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:90356 Archived-At: Here is a first draft, which appears to correctly handle common movement = through the buffer using `beginning-of-buffer`, `end-of-buffer`, and = custom paragraph forward / backward function. = ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;= ;;;;;;;;;;; =20 (defvar 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 'old-window-start) =20 (defvar 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 'old-window-end) =20 (defvar 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 'old-window-end-forced) =20 (defun test-post-command-hook () (when (and (not (minibufferp)) (window-live-p (get-buffer-window (current-buffer)))) (setq old-window-start (window-start)) (setq old-window-end (window-end)) (setq old-window-end-forced (window-end nil t)) (when (and (not (< (point) old-window-start)) (not (> (point) old-window-end)) (not (> (point) old-window-end-forced))) (message (concat "P.C.H. -- `point`: %s | " "`old-window-start`: %s | " "`old-window-end`: %s | " "`old-window-end-forced`: %s") (point) old-window-start old-window-end old-window-end-forced)))) =20 (defun test-window-scroll-functions (win _start) "Good for things like: `beginning-of-buffer`; `end-of-buffer`; = `yank`; etc" (when (and (not (minibufferp)) (window-live-p (get-buffer-window (current-buffer)))) (when (or (< (point) old-window-start) (> (point) old-window-end) (> (point) old-window-end-forced)) (message (concat "W.S.F. -- `point`: %s | " "*new* window-start: %s | " "*new* window-end: %s") (point) _start (window-end win t))))) =20 (define-minor-mode test-mode "A minor-mode for testing `window-start` and `window-end`." :init-value nil :lighter " =F0=9D=93=A3=F0=9D=93=94=F0=9D=93=A2=F0=9D=93=A3" :keymap nil :global nil (cond (test-mode (condition-case error (progn (setq scroll-conservatively 101) (setq scroll-margin 0) (add-hook 'post-command-hook 'test-post-command-hook nil = t) (add-hook 'window-scroll-functions = 'test-window-scroll-functions nil t) (message "Turned ON `test-mode`.")) (error (test-mode 0) (signal (car error) (cdr error))))) ((not test-mode) (remove-hook 'post-command-hook 'test-post-command-hook t) (remove-hook 'window-scroll-functions = 'test-window-scroll-functions t) (message "Turned OFF `test-mode`.") ))) =20 = ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;= ;;;;;;;;;;;=