emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

set-window-start


From: Luc Teirlinck
Subject: set-window-start
Date: Wed, 14 Jul 2004 21:02:41 -0500 (CDT)

There has been an undocumented change in the behavior of
`set-window-start' since Emacs 20.7.

In Emacs 20.7, (set-window-start WINDOW POS) makes POS the window
start, as documented.  In current CVS and in 21.3, it makes the window
start either at the _beginning_ of the line POS is on, _or_ at the
beginning of the _next_ line, according to rules that are not clear.

Is that change intentional (and just needs to be properly documented),
or a bug?

As an illustration, look at the example taken from (elisp)Window Start:

     For example, if point is 1 and you set the start of the window
     to 2, then point would be "above" the top of the window.  The
     display routines will automatically move point if it is still 1
     when redisplay occurs.  Here is an example:

          ;; Here is what `foo' looks like before executing
          ;;   the `set-window-start' expression.

          ---------- Buffer: foo ----------
          -!-This is the contents of buffer foo.
          2
          3
          4
          5
          6
          ---------- Buffer: foo ----------

          (set-window-start
           (selected-window)
           (1+ (window-start)))
          => 2

          ;; Here is what `foo' looks like after executing
          ;;   the `set-window-start' expression.
          ---------- Buffer: foo ----------
          his is the contents of buffer foo.
          2
          3
          -!-4
          5
          6
          ---------- Buffer: foo ----------

This example works as described in Emacs 20.7.  In current CVS (and in
21.3), `set-window-start' still returns 2, but the window still starts at 1
(and point does not move).

The behavior is even weirder in the next example:

This is the contents of buffer foo.
12345
2
3
4
5
6

With point anywhere on the line 12345, _except_ on the "5":

(set-window-start (selected-window) (point))

makes the window start at the beginning of that line, but on the "5",
it makes it start at the beginning of the _next_ line.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]