unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* set-window-start in Elisp manual
@ 2008-01-16 22:52 Stephen Berman
  2008-01-17 13:11 ` martin rudalics
  2008-01-20  6:14 ` Richard Stallman
  0 siblings, 2 replies; 8+ messages in thread
From: Stephen Berman @ 2008-01-16 22:52 UTC (permalink / raw)
  To: emacs-devel

Node Window Start of the Emacs Lisp manual give the following example of
using set-window-start:

          ;; 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 ----------

When I try this (in GNU Emacs 23.0.50.2 (i686-pc-linux-gnu, GTK+ Version
2.12.0) of 2008-01-16 on escher, also with -Q), the sexp does eval to 2,
but window-start and point remain at 1, and the buffer display does not
change.  Is the example wrong, or is there a bug in set-window-start, or
am I misunderstanding the example?  (If the latter, then I also do not
understand how set-window-start is supposed to work, so in that case I
would appreciate clarification.)

Steve Berman

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

* Re: set-window-start in Elisp manual
  2008-01-16 22:52 set-window-start in Elisp manual Stephen Berman
@ 2008-01-17 13:11 ` martin rudalics
  2008-01-17 14:29   ` Johan Bockgård
  2008-01-20  6:14 ` Richard Stallman
  1 sibling, 1 reply; 8+ messages in thread
From: martin rudalics @ 2008-01-17 13:11 UTC (permalink / raw)
  To: Stephen Berman; +Cc: emacs-devel

> When I try this (in GNU Emacs 23.0.50.2 (i686-pc-linux-gnu, GTK+ Version
> 2.12.0) of 2008-01-16 on escher, also with -Q), the sexp does eval to 2,
> but window-start and point remain at 1, and the buffer display does not
> change.  Is the example wrong, or is there a bug in set-window-start, or
> am I misunderstanding the example?  (If the latter, then I also do not
> understand how set-window-start is supposed to work, so in that case I
> would appreciate clarification.)

FWIW this used to work in Emacs 20 but was already broken in Emacs 21.
We would have to find out why and where `window-start' gets reset to 1.

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

* Re: set-window-start in Elisp manual
  2008-01-17 13:11 ` martin rudalics
@ 2008-01-17 14:29   ` Johan Bockgård
  2008-01-17 15:33     ` Stephen Berman
  0 siblings, 1 reply; 8+ messages in thread
From: Johan Bockgård @ 2008-01-17 14:29 UTC (permalink / raw)
  To: emacs-devel

martin rudalics <rudalics@gmx.at> writes:

> FWIW this used to work in Emacs 20 but was already broken in Emacs 21.
> We would have to find out why and where `window-start' gets reset to 1.

      [xdisp.c:13049]

      /* If window starts on a continuation line, maybe adjust the
         window start in case the window's width changed.  */
      if (XMARKER (w->start)->buffer == current_buffer)
        compute_window_start_on_continuation_line (w);

-- 
Johan Bockgård

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

* Re: set-window-start in Elisp manual
  2008-01-17 14:29   ` Johan Bockgård
@ 2008-01-17 15:33     ` Stephen Berman
  2008-01-17 15:40       ` Johan Bockgård
  0 siblings, 1 reply; 8+ messages in thread
From: Stephen Berman @ 2008-01-17 15:33 UTC (permalink / raw)
  To: emacs-devel

On Thu, 17 Jan 2008 15:29:01 +0100 bojohan+news@dd.chalmers.se (Johan Bockgård) wrote:

> martin rudalics <rudalics@gmx.at> writes:
>
>> FWIW this used to work in Emacs 20 but was already broken in Emacs 21.
>> We would have to find out why and where `window-start' gets reset to 1.
>
>       [xdisp.c:13049]
>
>       /* If window starts on a continuation line, maybe adjust the
>          window start in case the window's width changed.  */
>       if (XMARKER (w->start)->buffer == current_buffer)
>         compute_window_start_on_continuation_line (w);

How does this piece of code relate to the set-window-start issue, since
the latter doesn't seem to involve a continuation line?  Or did you
accidentally paste in the wrong bit, and really mean the following
(which is at xdisp.c:13049 in my sources from yesterday; the above is at
line 12966):

  /* If window-start is screwed up, choose a new one.  */
  if (XMARKER (w->start)->buffer != current_buffer)
    goto recenter;

I cannot tell, because I don't understand the code.  I would be grateful
for any elucidation anyone cares to give.  In particular, I would like
to understand an apparent restriction on window-start in conjunction
with display properties.  I've posted several times about this, but the
only response I've gotten was from RMS (see
http://permalink.gmane.org/gmane.emacs.devel/86019), which was too terse
for me to really understand.  If someone who does understand it has the
time to elaborate, I would be most grateful.

Steve Berman

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

* Re: set-window-start in Elisp manual
  2008-01-17 15:33     ` Stephen Berman
@ 2008-01-17 15:40       ` Johan Bockgård
  2008-01-17 16:21         ` Stephen Berman
  0 siblings, 1 reply; 8+ messages in thread
From: Johan Bockgård @ 2008-01-17 15:40 UTC (permalink / raw)
  To: emacs-devel

Stephen Berman <Stephen.Berman@gmx.net> writes:

> On Thu, 17 Jan 2008 15:29:01 +0100 bojohan+news@dd.chalmers.se (Johan Bockgård) wrote:
>
>> martin rudalics <rudalics@gmx.at> writes:
>>
>>> FWIW this used to work in Emacs 20 but was already broken in Emacs 21.
>>> We would have to find out why and where `window-start' gets reset to 1.
>>
>>       [xdisp.c:13049]
>>
>>       /* If window starts on a continuation line, maybe adjust the
>>          window start in case the window's width changed.  */
>>       if (XMARKER (w->start)->buffer == current_buffer)
>>         compute_window_start_on_continuation_line (w);
>
> How does this piece of code relate to the set-window-start issue, since
> the latter doesn't seem to involve a continuation line?  Or did you
> accidentally paste in the wrong bit

The paste is correct, the line number is wrong. Sorry.

-- 
Johan Bockgård

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

* Re: set-window-start in Elisp manual
  2008-01-17 15:40       ` Johan Bockgård
@ 2008-01-17 16:21         ` Stephen Berman
  2008-01-18 14:03           ` Johan Bockgård
  0 siblings, 1 reply; 8+ messages in thread
From: Stephen Berman @ 2008-01-17 16:21 UTC (permalink / raw)
  To: emacs-devel

On Thu, 17 Jan 2008 16:40:12 +0100 bojohan+news@dd.chalmers.se (Johan Bockgård) wrote:

> Stephen Berman <Stephen.Berman@gmx.net> writes:
>
>> On Thu, 17 Jan 2008 15:29:01 +0100 bojohan+news@dd.chalmers.se (Johan Bockgård) wrote:
>>
>>> martin rudalics <rudalics@gmx.at> writes:
>>>
>>>> FWIW this used to work in Emacs 20 but was already broken in Emacs 21.
>>>> We would have to find out why and where `window-start' gets reset to 1.
>>>
>>>       [xdisp.c:13049]
>>>
>>>       /* If window starts on a continuation line, maybe adjust the
>>>          window start in case the window's width changed.  */
>>>       if (XMARKER (w->start)->buffer == current_buffer)
>>>         compute_window_start_on_continuation_line (w);
>>
>> How does this piece of code relate to the set-window-start issue, since
>> the latter doesn't seem to involve a continuation line?  Or did you
>> accidentally paste in the wrong bit
>
> The paste is correct, the line number is wrong. Sorry.

Ok, thanks for the correction.  My question wasn't rhetorical, I don't
see the relation between the set-window-start issue and continuation
lines.  Could you clarify, or at least point to where in the code this
relation is established?  Thanks.

Steve Berman

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

* Re: set-window-start in Elisp manual
  2008-01-17 16:21         ` Stephen Berman
@ 2008-01-18 14:03           ` Johan Bockgård
  0 siblings, 0 replies; 8+ messages in thread
From: Johan Bockgård @ 2008-01-18 14:03 UTC (permalink / raw)
  To: emacs-devel

Stephen Berman <Stephen.Berman@gmx.net> writes:

>>> On Thu, 17 Jan 2008 15:29:01 +0100 bojohan+news@dd.chalmers.se (Johan Bockgård) wrote:
>>>>       /* If window starts on a continuation line, maybe adjust the
>>>>          window start in case the window's width changed.  */
>>>>       if (XMARKER (w->start)->buffer == current_buffer)
>>>>         compute_window_start_on_continuation_line (w);

[...]

> I don't see the relation between the set-window-start issue and
> continuation lines. Could you clarify, or at least point to where in
> the code this relation is established?

`compute_window_start_on_continuation_line' (for whatever reason)
adjusts window start if it is not at the beginning of a line.

-- 
Johan Bockgård

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

* Re: set-window-start in Elisp manual
  2008-01-16 22:52 set-window-start in Elisp manual Stephen Berman
  2008-01-17 13:11 ` martin rudalics
@ 2008-01-20  6:14 ` Richard Stallman
  1 sibling, 0 replies; 8+ messages in thread
From: Richard Stallman @ 2008-01-20  6:14 UTC (permalink / raw)
  To: Stephen Berman; +Cc: emacs-devel

I think what's happening is that, if window-start isn't at the
beginning of a line, compute_window_start_on_continuation_line
assumes that means it's a continuation line.  In the normal
course of events, that's a valid heuristic.  It's only with code
like the example from the manual that it isn't valid.

So I think we should change the manual.

However, at the same time it might be ok to make the conditions
for calling compute_window_start_on_continuation_line narrower.
Maybe it doesn't need to be called so often.

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

end of thread, other threads:[~2008-01-20  6:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-16 22:52 set-window-start in Elisp manual Stephen Berman
2008-01-17 13:11 ` martin rudalics
2008-01-17 14:29   ` Johan Bockgård
2008-01-17 15:33     ` Stephen Berman
2008-01-17 15:40       ` Johan Bockgård
2008-01-17 16:21         ` Stephen Berman
2008-01-18 14:03           ` Johan Bockgård
2008-01-20  6:14 ` Richard Stallman

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).