all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* set-window-start
@ 2004-07-15  2:02 Luc Teirlinck
  2004-07-15  7:07 ` set-window-start Lars Hansen
  2004-07-16  6:54 ` set-window-start Richard Stallman
  0 siblings, 2 replies; 6+ messages in thread
From: Luc Teirlinck @ 2004-07-15  2:02 UTC (permalink / raw)


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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: set-window-start
  2004-07-15  2:02 set-window-start Luc Teirlinck
@ 2004-07-15  7:07 ` Lars Hansen
  2004-07-16  6:54 ` set-window-start Richard Stallman
  1 sibling, 0 replies; 6+ messages in thread
From: Lars Hansen @ 2004-07-15  7:07 UTC (permalink / raw)
  Cc: emacs-devel

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

Recently I also noticed that something is wrong with window positions.
I noticed that when I evaluate

(let* ((edges (window-edges (selected-window)))
        (left (nth 0 edges))
        (top (nth 1 edges))
        (right (nth 2 edges))
        (bottom (nth 3 edges)))
   (list (window-at left top)
         (window-at right top)
         (window-at left bottom)
         (window-at right bottom)))

in the scratch buffer, it returns:

On Emacs 20.7:
(#<window 3 on *scratch*> nil #<window 4 on  *Minibuf-0*> nil)

On Emacs 21.2:
(#<window 3 on *scratch*> nil #<window 3 on *scratch*> nil)

On todays CVS Emacs:
(nil nil nil #<window 3 on *scratch*>)

As a result of the current state, windmove functions does not work 
correctly.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: set-window-start
  2004-07-15  2:02 set-window-start Luc Teirlinck
  2004-07-15  7:07 ` set-window-start Lars Hansen
@ 2004-07-16  6:54 ` Richard Stallman
  2004-07-16 17:26   ` set-window-start Kevin Rodgers
  1 sibling, 1 reply; 6+ messages in thread
From: Richard Stallman @ 2004-07-16  6:54 UTC (permalink / raw)
  Cc: emacs-devel

    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.

I think it is a bug.  There is a mechanism that is supposed to assure
that when Emacs chooses a new window-start, it tries to choose
the start of a line.  That mechanism should be disabled when you
specify a window-start explicitly.  Perhaps the code to disable
it is not working right.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: set-window-start
  2004-07-16  6:54 ` set-window-start Richard Stallman
@ 2004-07-16 17:26   ` Kevin Rodgers
  2004-07-16 20:03     ` set-window-start Luc Teirlinck
  2004-07-18  7:18     ` set-window-start Richard Stallman
  0 siblings, 2 replies; 6+ messages in thread
From: Kevin Rodgers @ 2004-07-16 17:26 UTC (permalink / raw)


Richard Stallman wrote:

 >     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.
 >
 > I think it is a bug.  There is a mechanism that is supposed to assure
 > that when Emacs chooses a new window-start, it tries to choose
 > the start of a line.  That mechanism should be disabled when you
 > specify a window-start explicitly.  Perhaps the code to disable
 > it is not working right.

Not surprising, given the comment that precedes it (in the 21.3 source):

   /* this is not right, but much easier than doing what is right. */
   w->start_at_line_beg = Qnil;

-- 
Kevin Rodgers

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: set-window-start
  2004-07-16 17:26   ` set-window-start Kevin Rodgers
@ 2004-07-16 20:03     ` Luc Teirlinck
  2004-07-18  7:18     ` set-window-start Richard Stallman
  1 sibling, 0 replies; 6+ messages in thread
From: Luc Teirlinck @ 2004-07-16 20:03 UTC (permalink / raw)
  Cc: emacs-devel

Kevin Rodgers wrote:

   Not surprising, given the comment that precedes it (in the 21.3 source):

      /* this is not right, but much easier than doing what is right. */
      w->start_at_line_beg = Qnil;

Actually, `set-window-start' worked OK in 20,7 and that comment was
already there,  The only change in the function since 20.7 apparently
is that:

CHECK_NUMBER_COERCE_MARKER (pos, 1);

got changed into:

CHECK_NUMBER_COERCE_MARKER (pos);

which seems harmless.

So the problem would appear to be not in `set-window-start', but
elsewhere.

Sincerely,

Luc.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: set-window-start
  2004-07-16 17:26   ` set-window-start Kevin Rodgers
  2004-07-16 20:03     ` set-window-start Luc Teirlinck
@ 2004-07-18  7:18     ` Richard Stallman
  1 sibling, 0 replies; 6+ messages in thread
From: Richard Stallman @ 2004-07-18  7:18 UTC (permalink / raw)
  Cc: emacs-devel

    Not surprising, given the comment that precedes it (in the 21.3 source):

       /* this is not right, but much easier than doing what is right. */
       w->start_at_line_beg = Qnil;

This is what's supposed to turn off the code that moves to
the line start.  I see no bug here.  I suspect a bug in
the code that is supposed to test start_at_line_beg.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-07-18  7:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-15  2:02 set-window-start Luc Teirlinck
2004-07-15  7:07 ` set-window-start Lars Hansen
2004-07-16  6:54 ` set-window-start Richard Stallman
2004-07-16 17:26   ` set-window-start Kevin Rodgers
2004-07-16 20:03     ` set-window-start Luc Teirlinck
2004-07-18  7:18     ` set-window-start Richard Stallman

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.