all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Phil Sung <psung@mit.edu>
To: martin rudalics <rudalics@gmx.at>, 925@emacsbugs.donarmstrong.com
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	[thread overview]
Message-ID: <18631.64418.476362.955622@gargle.gargle.HOWL> (raw)
In-Reply-To: <48C54DE8.8080100@gmx.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)))






  reply	other threads:[~2008-09-10 16:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <49074F4C.6080008@gmx.at>
2008-09-07 22:26 ` bug#925: 23.0.60; follow-mode doesn't work in buffers with a header line Phil Sung
2008-09-08 16:08   ` martin rudalics
2008-09-10 16:53     ` Phil Sung [this message]
2008-09-11  8:54       ` martin rudalics
2008-10-28 17:55   ` bug#925: marked as done (23.0.60; follow-mode doesn't work in buffers with a header line) Emacs bug Tracking System

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=18631.64418.476362.955622@gargle.gargle.HOWL \
    --to=psung@mit.edu \
    --cc=925@emacsbugs.donarmstrong.com \
    --cc=rudalics@gmx.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.