From: Dmitry Antipov <dmantipov@yandex.ru>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Latest changes in redisplay code
Date: Thu, 07 Feb 2013 19:42:49 +0400 [thread overview]
Message-ID: <5113CB79.5070500@yandex.ru> (raw)
In-Reply-To: <8362259uxk.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 1212 bytes --]
On 02/06/2013 10:08 PM, Eli Zaretskii wrote:
>> Date: Wed, 06 Feb 2013 11:37:30 +0400
>> From: Dmitry Antipov <dmantipov@yandex.ru>
>> CC: emacs-devel@gnu.org
>>
>> On 02/05/2013 10:01 PM, Eli Zaretskii wrote:
>>
>>> In any case, the potential for problems is still there, because now
>>> w->base_line_pos gets reset to zero in many more places than it was
>>> before. Previously, only xdisp.c would manipulate this attribute in a
>>> few well-defined places. Now it can be reset by any function that
>>> calls adjust_window_count, including wset_buffer, which is called from
>>> many primitives, most of them outside xdisp.c. Therefore, it's quite
>>> possible that we will now have to count from the beginning of the
>>> buffer much more frequently than we did before. In large buffers,
>>> this could be quite a hit.
>>
>> Hm. I'll try to reproduce such a situation and check what happens.
>> Maybe we should invalidate window_end_valid and base_line_pos only
>> if either window is really switched to another buffer or buffer
>> is changed.
>
> That'd be hard, because there are many places that switch to another
> buffer temporarily, and they all call adjust_window_count.
What about this?
Dmitry
[-- Attachment #2: wset_buffer.patch --]
[-- Type: text/plain, Size: 1850 bytes --]
=== modified file 'src/window.c'
--- src/window.c 2013-02-01 07:23:18 +0000
+++ src/window.c 2013-02-07 05:31:20 +0000
@@ -269,9 +269,10 @@
}
/* Called when W's buffer slot is changed. ARG -1 means that W is about to
- cease its buffer, and 1 means that W is about to set up the new one. */
+ cease its buffer, and 1 means that W is about to set up the new one.
+ Return W's buffer if it's a buffer or NULL otherwise. */
-static void
+static struct buffer *
adjust_window_count (struct window *w, int arg)
{
eassert (eabs (arg) == 1);
@@ -283,21 +284,34 @@
b = b->base_buffer;
b->window_count += arg;
eassert (b->window_count >= 0);
- /* These should be recalculated by redisplay code. */
- w->window_end_valid = 0;
- w->base_line_pos = 0;
+ return b;
}
+ return NULL;
}
-/* Set W's buffer slot to VAL and recompute number
- of windows showing VAL if it is a buffer. */
+/* Set W's buffer slot to VAL and recompute number of windows showing
+ VAL if it is a buffer, catch some redisplay's attention if needed. */
void
wset_buffer (struct window *w, Lisp_Object val)
{
- adjust_window_count (w, -1);
+ struct buffer *oldb, *newb;
+
+ oldb = adjust_window_count (w, -1);
w->buffer = val;
- adjust_window_count (w, 1);
+ newb = adjust_window_count (w, 1);
+ if ((oldb && oldb == newb
+ && ((BUF_UNCHANGED_MODIFIED (oldb) < BUF_MODIFF (oldb))
+ || (BUF_OVERLAY_UNCHANGED_MODIFIED (oldb)
+ < BUF_OVERLAY_MODIFF (oldb))))
+ || (!oldb && newb))
+ {
+ /* If W's buffer was changed since last redisplay or W
+ is switched to another buffer from no buffer, next
+ redisplay should recalculate these fields. */
+ w->window_end_valid = 0;
+ w->base_line_pos = 0;
+ }
}
/* Build a frequently used 4-integer (X Y W H) list. */
next prev parent reply other threads:[~2013-02-07 15:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-04 16:25 Latest changes in redisplay code Eli Zaretskii
2013-02-04 17:04 ` martin rudalics
2013-02-05 5:52 ` Dmitry Antipov
2013-02-05 18:01 ` Eli Zaretskii
2013-02-05 20:58 ` martin rudalics
2013-02-06 15:39 ` Stefan Monnier
2013-02-06 7:37 ` Dmitry Antipov
2013-02-06 18:08 ` Eli Zaretskii
2013-02-07 15:42 ` Dmitry Antipov [this message]
2013-02-08 14:11 ` 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=5113CB79.5070500@yandex.ru \
--to=dmantipov@yandex.ru \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
/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.