all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: martin rudalics <rudalics@gmx.at>
Cc: dmantipov@yandex.ru, monnier@iro.umontreal.ca, emacs-devel@gnu.org
Subject: Re: 'struct window' cleanup #2
Date: Wed, 27 Jun 2012 19:59:25 +0300	[thread overview]
Message-ID: <83fw9g8zde.fsf@gnu.org> (raw)
In-Reply-To: <4FEAB0FD.9050409@gmx.at>

> Date: Wed, 27 Jun 2012 09:06:37 +0200
> From: martin rudalics <rudalics@gmx.at>
> CC: dmantipov@yandex.ru, monnier@iro.umontreal.ca, emacs-devel@gnu.org
> 
>  > Why a "hack"?  Lisp object are good precisely for this reason: that
>  > you can give them values of different types of object.
> 
> window_end_valid is documented as
> 
>      /* t if window_end_pos is truly valid.
>         This is nil if nontrivial redisplay is preempted
>         since in that case the frame image that window_end_pos
>         did not get onto the frame.  */
>      Lisp_Object window_end_valid;
> 
> but the code in xdisp.c checks it usually just as
> 
>       !NILP (w->window_end_valid)
> 
> Consequently, the assignment
> 
>        w->window_end_valid = w->buffer;
> 
> looks fragile (one has to be sure that the NILP checks don't happen
> while it's set to the buffer since otherwise we end up trying again for
> no use) and at least contradicts the initial comment of try_window_id
> 
> /* Try to redisplay window W by reusing its existing display.  W's
>     current matrix must be up to date when this function is called,
>     i.e. window_end_valid must not be nil.
> 
> but apparently the current matrix is not up to date when the value is
> non-nil but some other buffer.  So unless this is better documented
> and/or the corresponding code cleaned up it remains a "hack" IMHO.

What you see happens a lot in Emacs sources: comments don't correspond
to what the code really does, and tell only part of the story.
Usually, someone changes the code, but fails to update the comments
(because these comments are in another file, where the struct is
defined, not where the change is being done).  I tripped on such
issues several times when working on display features (in conjunction
with the various flags and state variables in 'struct it').

That's why I asked Dmitry to update and improve the comments whenever
some variable or struct member is being updated/modified.

>  >>  Can you see whether the part
>  >>
>  >>        /* When splitting windows or for new windows, it happens that
>  >> 	 redisplay is called with a nil window_end_vpos or one being
>  >> 	 larger than the window.  This should really be fixed in
>  >> 	 window.c.  I don't have this on my list, now, so we do
>  >> 	 approximately the same as the old redisplay code.  --gerd.  */
>  >>        && INTEGERP (w->window_end_vpos)
>  >>
>  >> in xdisp.c still makes sense?
>  >
>  > No, there's no code anymore that sets it to nil.
> 
> Fine (apparently that was another "hack" in redisplay).

No, it's another instance of "change-code-but-don't-update-comments"
phenomenon.



  reply	other threads:[~2012-06-27 16:59 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-25  8:56 'struct window' cleanup #2 Dmitry Antipov
2012-06-25 14:22 ` John Wiegley
2012-06-25 14:42   ` Dmitry Antipov
2012-06-25 14:27 ` Paul Eggert
2012-06-25 14:53 ` Stefan Monnier
2012-06-25 16:30   ` Dmitry Antipov
2012-06-25 16:35   ` martin rudalics
2012-06-25 16:49     ` Dmitry Antipov
2012-06-26  7:26       ` martin rudalics
2012-06-26  9:06         ` Dmitry Antipov
2012-06-26 15:37           ` Eli Zaretskii
2012-06-26 15:32         ` Eli Zaretskii
2012-06-26 16:49           ` Dmitry Antipov
2012-06-26 17:12             ` Eli Zaretskii
2012-06-27  0:42           ` Stefan Monnier
2012-06-27  3:03             ` Eli Zaretskii
2012-06-27  7:10               ` 'struct window' cleanup #3 Dmitry Antipov
2012-06-27 13:32                 ` Stefan Monnier
2012-06-27 17:37                   ` Eli Zaretskii
2012-06-27 17:24                 ` Eli Zaretskii
2012-06-27 17:59                   ` Dmitry Antipov
2012-06-27 19:36                     ` Eli Zaretskii
2012-07-01 15:05                       ` Dmitry Antipov
2012-07-01 15:42                         ` Andreas Schwab
2012-06-28 12:51                   ` Dmitry Antipov
2012-06-27  7:06           ` 'struct window' cleanup #2 martin rudalics
2012-06-27 16:59             ` Eli Zaretskii [this message]
2012-06-25 16:39 ` Eli Zaretskii

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=83fw9g8zde.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=dmantipov@yandex.ru \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --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.