From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Phil Sung Newsgroups: gmane.emacs.bugs Subject: bug#925: 23.0.60; follow-mode doesn't work in buffers with a header line Date: Wed, 10 Sep 2008 12:53:54 -0400 Message-ID: <18631.64418.476362.955622@gargle.gargle.HOWL> References: <18628.21774.308940.632822@gargle.gargle.HOWL> <48C54DE8.8080100@gmx.at> Reply-To: Phil Sung , 925@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1221066504 30724 80.91.229.12 (10 Sep 2008 17:08:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 10 Sep 2008 17:08:24 +0000 (UTC) To: martin rudalics , 925@emacsbugs.donarmstrong.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Sep 10 19:09:19 2008 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KdTBl-0001gv-Tj for geb-bug-gnu-emacs@m.gmane.org; Wed, 10 Sep 2008 19:09:10 +0200 Original-Received: from localhost ([127.0.0.1]:46422 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KdTAl-000429-FO for geb-bug-gnu-emacs@m.gmane.org; Wed, 10 Sep 2008 13:08:07 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KdTAH-0003Gu-TY for bug-gnu-emacs@gnu.org; Wed, 10 Sep 2008 13:07:38 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KdTAG-0003Dl-CY for bug-gnu-emacs@gnu.org; Wed, 10 Sep 2008 13:07:37 -0400 Original-Received: from [199.232.76.173] (port=57007 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KdTAG-0003DC-3I for bug-gnu-emacs@gnu.org; Wed, 10 Sep 2008 13:07:36 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:38736) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KdTAF-0007Rx-BH for bug-gnu-emacs@gnu.org; Wed, 10 Sep 2008 13:07:35 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m8AH7WfH027774; Wed, 10 Sep 2008 10:07:33 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id m8AH03p6023730; Wed, 10 Sep 2008 10:00:03 -0700 X-Loop: don@donarmstrong.com Resent-From: Phil Sung Original-Sender: Phil Sung Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Wed, 10 Sep 2008 17:00:03 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 925 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 925-submit@emacsbugs.donarmstrong.com id=B925.122106567721906 (code B ref 925); Wed, 10 Sep 2008 17:00:03 +0000 Original-Received: (at 925) by emacsbugs.donarmstrong.com; 10 Sep 2008 16:54:37 +0000 Original-Received: from yx-out-2324.google.com (yx-out-2324.google.com [74.125.44.29]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m8AGsUPw021882 for <925@emacsbugs.donarmstrong.com>; Wed, 10 Sep 2008 09:54:32 -0700 Original-Received: by yx-out-2324.google.com with SMTP id 8so1553144yxg.31 for <925@emacsbugs.donarmstrong.com>; Wed, 10 Sep 2008 09:54:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:mime-version :content-type:content-transfer-encoding:message-id:date:to:subject :in-reply-to:references:x-mailer:sender; bh=ig/9R3gem/F5xic42n30hMoTvM6fCRCaH59w3/aaOQU=; b=E/WkuSUdVGk/IRN66Nh1BxNaBDewAn9poIOxJM/8tskf4GTUx3DSGj5A7iRuOw2HGd +aaJhD7H0YD2/eL34ikf9w60r6CNcX5y63kbMjZTXxbKtnQK5h2GmtE0ly0mBjcU6zK8 oN05gmhbKnNpGEExpd2SG1s03rJI6UZ+ejIac= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:mime-version:content-type:content-transfer-encoding:message-id :date:to:subject:in-reply-to:references:x-mailer:sender; b=cri/R6iA8MWgLsz4hHRMbTtDyU2IPtTC7CHy8MSJmAu4i2jFb8RUrajC4qRsJ1Tnym 3sALDdP+yQWqvQb7I3Y5yFLnGZ0fw9za6aVA6hU7o+/IJ5eMz0tjvgBoEzMOGlISGH0x 1DZbonvSK8C2ZdX+LxMZwY2wTuQiaQ6+B7/AA= Original-Received: by 10.114.26.18 with SMTP id 18mr923338waz.162.1221065669842; Wed, 10 Sep 2008 09:54:29 -0700 (PDT) Original-Received: from creme-brulee ( [18.95.1.79]) by mx.google.com with ESMTPS id 6sm9986962ywp.3.2008.09.10.09.54.28 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 10 Sep 2008 09:54:29 -0700 (PDT) In-Reply-To: <48C54DE8.8080100@gmx.at> X-Mailer: VM 8.0.9 under Emacs 23.0.60.1 (i486-pc-linux-gnu) X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) Resent-Date: Wed, 10 Sep 2008 13:07:37 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:20440 Archived-At: martin rudalics writes: > Does it help when you set `scroll-conservatively' to 100? No, it doesn't. When I do that, not only does the expected behavior not happen, point moves back to the center of the first screen. This didn't happen with the default value of scroll-conservatively. Here's what I now think is going on: When there's a header line, follow-mode miscomputes the beginning of the second window-- if you try out the "steps to reproduce", you can see that there's one line after the end of the first window which is not visible in the second window. When you try to C-n to that line, follow-mode can't display that line in either window, so something weird happens. I tried the (flawed) patch below, which decreases the effective window-height when there's a header line. I'm not sure if this is the right approach. With this patch, point correctly moves from one window to the other, and the two windows display consecutive lines, as expected. However, sometimes when moving point between windows, the text will shift up or down by a line. I don't know why that happens. Thanks, Phil follow.el (follow-scroll-down, follow-calc-win-end, follow-estimate-first-window-start): reduce effective window height when header line is present. diff --git a/lisp/follow.el b/lisp/follow.el index 508d0f5..766dfce 100644 --- a/lisp/follow.el +++ b/lisp/follow.el @@ -624,7 +624,7 @@ Works like `scroll-up' when not in Follow mode." (select-window win) (goto-char start) (vertical-motion (- (- (window-height win) - 1 + (if header-line-format 2 1) next-screen-context-lines))) (set-window-start win (point)) (goto-char start) @@ -887,7 +887,8 @@ Returns (end-pos end-of-buffer-p)" (prog1 (save-excursion (goto-char (window-start)) - (setq height (- (window-height) 1)) + (setq height (- (window-height) + (if header-line-format 2 1))) (setq buffer-end-p (if (bolp) (not (= height (vertical-motion height))) @@ -1219,7 +1220,9 @@ position of the first window. Otherwise it is a good guess." ;(setq exact (bolp)) (vertical-motion 0 win) (while pred - (vertical-motion (- 1 (window-height (car pred))) (car pred)) + (vertical-motion (- (if header-line-format 2 1) + (window-height (car pred))) + (car pred)) (if (not (bolp)) (setq exact nil)) (setq pred (cdr pred)))