From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Anders Lindgren Newsgroups: gmane.emacs.bugs Subject: bug#16129: 24.3.50; Emacs slow with follow-mode when buffer ends before last window Date: Fri, 13 Dec 2013 15:34:07 +0100 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=089e016347a4d4492b04ed6b5a4c X-Trace: ger.gmane.org 1386945316 14569 80.91.229.3 (13 Dec 2013 14:35:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 13 Dec 2013 14:35:16 +0000 (UTC) To: 16129@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Dec 13 15:35:21 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VrTpo-0002lW-4G for geb-bug-gnu-emacs@m.gmane.org; Fri, 13 Dec 2013 15:35:20 +0100 Original-Received: from localhost ([::1]:42884 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VrTpl-0005Dh-L1 for geb-bug-gnu-emacs@m.gmane.org; Fri, 13 Dec 2013 09:35:17 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37820) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VrTph-0005Cv-15 for bug-gnu-emacs@gnu.org; Fri, 13 Dec 2013 09:35:15 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VrTpb-0000Ry-Ds for bug-gnu-emacs@gnu.org; Fri, 13 Dec 2013 09:35:12 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:60934) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VrTpb-0000Rp-As for bug-gnu-emacs@gnu.org; Fri, 13 Dec 2013 09:35:07 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VrTpa-0002dU-2j for bug-gnu-emacs@gnu.org; Fri, 13 Dec 2013 09:35:06 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Anders Lindgren Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 13 Dec 2013 14:35:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 16129 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.138694526910075 (code B ref -1); Fri, 13 Dec 2013 14:35:03 +0000 Original-Received: (at submit) by debbugs.gnu.org; 13 Dec 2013 14:34:29 +0000 Original-Received: from localhost ([127.0.0.1]:46720 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VrTow-0002cO-GB for submit@debbugs.gnu.org; Fri, 13 Dec 2013 09:34:28 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:35892) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VrTon-0002c7-Ui for submit@debbugs.gnu.org; Fri, 13 Dec 2013 09:34:19 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VrTol-0008TX-AS for submit@debbugs.gnu.org; Fri, 13 Dec 2013 09:34:17 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:34588) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VrTok-0008TQ-Rs for submit@debbugs.gnu.org; Fri, 13 Dec 2013 09:34:14 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37601) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VrToi-0004Rl-GJ for bug-gnu-emacs@gnu.org; Fri, 13 Dec 2013 09:34:14 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VrTog-0008SU-4L for bug-gnu-emacs@gnu.org; Fri, 13 Dec 2013 09:34:12 -0500 Original-Received: from mail-wg0-x22d.google.com ([2a00:1450:400c:c00::22d]:50026) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VrTof-0008SI-MT for bug-gnu-emacs@gnu.org; Fri, 13 Dec 2013 09:34:10 -0500 Original-Received: by mail-wg0-f45.google.com with SMTP id y10so1978285wgg.24 for ; Fri, 13 Dec 2013 06:34:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=yfPmwgtQt7OWplFMCXnug7jG23c4jLm4MIsCHPbNcx0=; b=I1PyL0/lcYOV1eXhfRslxJFB1SsErD+Hmc3hWwSQsBO5kVFwzbaaLIhpaV6UTbc1GA cH5BFcuGZ6PRaWiwGv07QAEf+XHT349t3R2OuT4z4esAiO8kfaiiMpaoh36syuECbofV i7ic1NhlTVlAjeMtOFFM0a8RX2hBVwdbVuVaCaG6jUcA7kKzsAPm6S4omUowGz/GW2/l AhkKG4oqj3v1it4ZqCewQf90XxW+uDKT25WdcCY9UOcQw3LwEcKlsZFkuMHGARbfdgSl V0DnxX2lxy0HZsUZjmVSoHATp6P2/xTQNTmj1gYJBw7meqPSnGWjVvA5oaHO90a7dJrz CNBQ== X-Received: by 10.194.85.75 with SMTP id f11mr2702515wjz.14.1386945247986; Fri, 13 Dec 2013 06:34:07 -0800 (PST) Original-Received: by 10.216.223.140 with HTTP; Fri, 13 Dec 2013 06:34:07 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:81878 Archived-At: --089e016347a4d4492b04ed6b5a4c Content-Type: text/plain; charset=ISO-8859-1 When follow-mode is enabled and the displayed buffer ends before the last window, Emacs becomes extremely slow. This broke on revision 115272 (see log below). Steps to repeat the problem: emacs -Q C-u 10 RET C-x 3 M-x follow-mode RET Here, moving the cursor up or down one line takes about one second. Holding and the arrow keys cause the cursor to disappear until the key is released or the edge of the buffer has been reached. The problem disappears as soon as some parts of the buffer is shown in the rightmost window. I am the original author of follow-mode, so I can share one interesting implementation detail. When the viewed buffer ends before the last window, follow-mode tries to display this window without any content (by setting the window start to point-max). Unfortunately, the Emacs display engine always tries ensure that windows are not empty so it repositions it... So, follow-mode hammers in its view of the world every chance it gets, currrently in post-command hook and window-scroll-functions. Sincerely, Anders Lindgren Ps. Log for revision 115272: revno: 115272 committer: Stefan Monnier branch nick: trunk timestamp: Thu 2013-11-28 17:43:09 -0500 message: Refine redisplay optimizations to only redisplay *some* frames/windows rather than all of them. * src/xdisp.c (REDISPLAY_SOME): New constant. (redisplay_other_windows, wset_redisplay, fset_redisplay) (bset_redisplay, bset_update_mode_line): New functions. (message_dolog): Use bset_redisplay. (clear_garbaged_frames): Use fset_redisplay. (echo_area_display): Use wset_redisplay. (buffer_shared_and_changed): Remove. (prepare_menu_bars): Call Vpre_redisplay_function before updating frame titles. Compute the actual set of windows redisplayed. Don't update frame titles and menu bars for frames that don't need to be redisplayed. (propagate_buffer_redisplay): New function. (AINC): New macro. (redisplay_internal): Use it. Be more selective in the set of windows we redisplay. Propagate windows_or_buffers_changed to update_mode_lines a bit later to simplify the code. (mark_window_display_accurate_1): Reset window and buffer's `redisplay' flag. (redisplay_window): Do nothing if neither the window nor the buffer nor the frame needs redisplay. * src/window.h (struct window): Add `redisplay' field. (wset_redisplay, fset_redisplay, bset_redisplay, bset_update_mode_line) (redisplay_other_windows, window_list): New declarations. * src/window.c (select_window, Fset_window_start): Use wset_redisplay. (window_list): Not static any more. (grow_mini_window, shrink_mini_window): Use fset_redisplay. * src/minibuf.c (read_minibuf_unwind): Don't redisplay everything. * src/insdel.c (prepare_to_modify_buffer_1): Use bset_redisplay. * src/frame.c (Fmake_frame_visible): Don't redisplay everything. * src/frame.h (struct frame): Add `redisplay' field. Move `external_menu_bar' bitfield next to other bit-fields. (SET_FRAME_GARBAGED): Use fset_redisplay. (SET_FRAME_VISIBLE): Don't garbage the frame; Use redisplay_other_windows. * src/buffer.h (struct buffer): Add `redisplay' field. * src/buffer.c (Fforce_mode_line_update): Pay attention to the `all' flag. (modify_overlay): Use bset_redisplay. * src/alloc.c (gc_sweep): Don't unmark strings while sweeping symbols. * lisp/doc-view.el (doc-view-goto-page): Update mode-line. In GNU Emacs 24.3.50.1 (x86_64-apple-darwin13.0.0, NS apple-appkit-1265.00) of 2013-12-13 on macpro.lan Bzr revision: 115272 monnier@iro.umontreal.ca-20131128224309-jg2ar5frhpri4yow Windowing system distributor `Apple', version 10.3.1265 Configured using: `configure --with-ns' Important settings: value of $LC_CTYPE: UTF-8 locale-coding-system: utf-8-unix default enable-multibyte-characters: t Major mode: Lisp Interaction Minor modes in effect: follow-mode: t tooltip-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Recent input: C-x 3 x f o l l o w - d e m o d e C-h v e m a c s - b z C-x o C-x b * s c C-x 1 F o l l o w - m o d e SPC s i s SPC R e d i d E m a c s SPC i s SPC s l o w SPC w h e n SPC f o l l o w - m o d e SPC i s SPC a e n a b l e d SPC a n d SPC b u f f e r SPC t a i l C-a Recent messages: Beginning of buffer End of buffer Follow mode enabled Beginning of buffer [4 times] End of buffer [13 times] Type "q" in help window to restore its previous buffer. Beginning of buffer [4 times] End of buffer [4 times] Beginning of buffer [6 times] is undefined Quit Load-path shadows: None found. Features: (shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils pp help-mode help-fns follow easymenu time-date tooltip ediff-hook vc-hooks lisp-float-type mwheel ns-win tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process cocoa ns multi-tty emacs) --089e016347a4d4492b04ed6b5a4c Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
When follow-mode is enabled and the displayed buffer = ends before the last window, Emacs becomes extremely slow.

This broke on revision 115272 (see log below).

Steps to repeat the problem:

=A0 =A0 emacs -Q=
=A0 =A0 C-u 10 RET
=A0 =A0 C-x 3
=A0 =A0= M-x follow-mode RET
=A0 =A0 =A0 =A0 =A0Here, moving the curs= or up or down one line takes about one second. Holding and the arrow keys c= ause the cursor to disappear until the key is released or the edge of the b= uffer has been reached.

The problem disappears as soon as some parts of the buf= fer is shown in the rightmost window.

I am the ori= ginal author of follow-mode, so I can share one interesting implementation = detail. When the viewed buffer ends before the last window, follow-mode tri= es to display this window without any content (by setting the window start = to point-max). Unfortunately, the Emacs display engine always tries ensure = that windows are not empty so it repositions it... So, follow-mode hammers = in its view of the world every chance it gets, currrently in post-command h= ook and window-scroll-functions.

Sincerely,
=A0 =A0 =A0Anders Lindgren

Ps. Log for revision 115272:

revno: 115272

committer: Stefan Monnier <monnier@iro.umontreal.ca>

branch nick: trunk

timestamp: Thu 2013-11-28 17:43:09 -0500

message:

=A0 Refine redisplay optimizations to only redisplay *some* f= rames/windows

=A0 rather than all of them.

=A0 * src/xdisp.c (REDISPLAY_SOME): New constant.

=A0 (redisplay_other_windows, wset_redisplay, fset_redisplay)=

=A0 (bset_redisplay, bset_update_mode_line): New functions.

=A0 (message_dolog): Use bset_redisplay.

=A0 (clear_garbaged_frames): Use fset_redisplay.

=A0 (echo_area_display): Use wset_redisplay.

=A0 (buffer_shared_and_changed): Remove.

=A0 (prepare_menu_bars): Call Vpre_redisplay_function before = updating

=A0 frame titles.=A0 Compute the actual set of windows redisp= layed.

=A0 Don't update frame titles and menu bars for frames th= at don't need to

=A0 be redisplayed.

=A0 (propagate_buffer_redisplay): New function.

=A0 (AINC): New macro.

=A0 (redisplay_internal): Use it.=A0 Be more selective in the= set of windows

=A0 we redisplay.=A0 Propagate windows_or_buffers_changed to<= /p>

=A0 update_mode_lines a bit later to simplify the code.

=A0 (mark_window_display_accurate_1): Reset window and buffer= 's

=A0 `redisplay' flag.

=A0 (redisplay_window): Do nothing if neither the window nor = the buffer nor

=A0 the frame needs redisplay.

=A0 * src/window.h (struct window): Add `redisplay' field= .

=A0 (wset_redisplay, fset_redisplay, bset_redisplay, bset_upd= ate_mode_line)

=A0 (redisplay_other_windows, window_list): New declarations.=

=A0 * src/window.c (select_window, Fset_window_start): Use ws= et_redisplay.

=A0 (window_list): Not static any more.

=A0 (grow_mini_window, shrink_mini_window): Use fset_redispla= y.

=A0 * src/minibuf.c (read_minibuf_unwind): Don't redispla= y everything.

=A0 * src/insdel.c (prepare_to_modify_buffer_1): Use bset_red= isplay.

=A0 * src/frame.c (Fmake_frame_visible): Don't redisplay = everything.

=A0 * src/frame.h (struct frame): Add `redisplay' field.<= /p>

=A0 Move `external_menu_bar' bitfield next to other bit-f= ields.

=A0 (SET_FRAME_GARBAGED): Use fset_redisplay.

=A0 (SET_FRAME_VISIBLE): Don't garbage the frame;

=A0 Use redisplay_other_windows.

=A0 * src/buffer.h (struct buffer): Add `redisplay' field= .

=A0 * src/buffer.c (Fforce_mode_line_update): Pay attention t= o the `all' flag.

=A0 (modify_overlay): Use bset_redisplay.

=A0 * src/alloc.c (gc_sweep): Don't unmark strings while = sweeping symbols.

=A0=A0

=A0 * lisp/doc-view.el (doc-view-goto-page): Update mode-line= .





In GNU Emacs 24.3.50.1 (x86_64-apple-darwin13.0.0, NS apple-appkit-1265.00= )
=A0of 2013-12-13 on macpro.lan
Bzr revision: 115272 monnier@iro.umontreal.ca-20131128224309-jg2ar5frh= pri4yow
Windowing system distributor `Apple', version 10.3.12= 65
Configured using:
=A0`configure --with-ns'

Important settings:
=A0 value of $LC_CTYPE: U= TF-8
=A0 locale-coding-system: utf-8-unix
=A0 default e= nable-multibyte-characters: t

Major mode: Lisp Int= eraction

Minor modes in effect:
=A0 follow-mode: t
=A0 tooltip-mode: t
=A0 mouse-wheel-mode: t
=A0 = tool-bar-mode: t
=A0 menu-bar-mode: t
=A0 file-name-sha= dow-mode: t
=A0 global-font-lock-mode: t
=A0 font-lock-mode: t
=A0 blink-cursor-mode: t
=A0 auto-composition-mode: t
= =A0 auto-encryption-mode: t
=A0 auto-compression-mode: t
=A0 line-number-mode: t
=A0 transient-mark-mode: t

Recent input:
<up> <up> <up> <up> <up> <up> <= ;up> <up> <up> <up> <up>=A0
<up>= <down> <down> <down> <down> <down> <down&= gt; <down>=A0
<down> <down> <down> <down> <down> <d= own> <down> <down>=A0
C-x 3 <up> <up> = <up> <up> <up> <up> <up> <up> <escap= e>=A0
x f o l l o w - d e <backspace> <backspace> m o d e=A0
<return> <up> <up> <up> <up> <up>= ; <up> <up> <up> <up>=A0
<up> <d= own> <down> <down> <down> <down> <down> &l= t;down>=A0
<down> <down> <down> <down> <down> <d= own> <down> <down>=A0
<down> <down> &l= t;down> <down> <down> <down> <down> <down>= =A0
<down> <down> <down> <down> <up> <up&= gt; <up> <up> <up>=A0
<up> <up> <= ;up> <up> <up> C-h v e m a c s - b z <tab>=A0
<return> <up> <up> <up> <up> <up> <u= p> <up> <up> <down>=A0
<down> <down= > <down> <down> <down> <down> <down> <d= own>=A0
<down> <down> <down> <down> <down> <d= own> <down> <down>=A0
<down> <up> <= up> <up> <up> <up> <up> C-x o C-x b *=A0
s c <tab> <return> <up> <up> <up> <up> = <up> <up> <up>=A0
<up> <up> <up&= gt; <up> <up> <up> <up> <down> <down> C= -x=A0
1 <down> <down> <down> <down> <down> <= ;down> <down>=A0
<down> <down> <menu-bar&= gt; <help-menu> <send-emacs-bug-report>=A0
F o l l o = w - m o d e SPC s <backspace> i s SPC <backspace>=A0
<backspace> <backspace> <backspace> <backspace>= ; <backspace>=A0
<backspace> <backspace> <ba= ckspace> <backspace> <backspace>=A0
<backspace&= gt; <backspace> <backspace> <backspace> R e=A0
d i d <backspace> <backspace> <backspace> <backsp= ace>=A0
<backspace> E m a c s SPC i s SPC s l o w SPC w = h e=A0
n SPC f o l l o w - m o d e SPC i s SPC a <backspace>= ;=A0
e n a b l e d SPC a n d SPC b u f f e r SPC t a i l=A0
C-a &= lt;right> <right> <right> <right> <right> <ri= ght>=A0
<right> <right> <right> <s-backsp= ace> <menu-bar> <help-menu>=A0
<send-emacs-bug-report>

Recent messages= :
Beginning of buffer
End of buffer
Follow mo= de enabled
Beginning of buffer [4 times]
End of buffer = [13 times]
Type "q" in help window to restore its previous buffer.
Beginning of buffer [4 times]
End of buffer [4 times]
=
Beginning of buffer [6 times]
<s-backspace> is undefin= ed
Quit

Load-path shadows:
None found.=

Features:
(shadow sort gnus-util mail-e= xtr emacsbug message format-spec rfc822 mml
mml-sec mm-decode mm-= bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util
=
mail-prsvr mail-utils pp help-mode help-fns follow easymenu time-date<= /div>
tooltip ediff-hook vc-hooks lisp-float-type mwheel ns-win tool-ba= r dnd
fontset image regexp-opt fringe tabulated-list newcomment lisp-mode
prog-mode register page menu-bar rfn-eshadow timer select scroll-ba= r
mouse jit-lock font-lock syntax facemenu font-core frame cham g= eorgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
=
japanese hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abb= rev
minibuffer nadvice loaddefs button faces cus-face macroexp files
=
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-proces= s
cocoa ns multi-tty emacs)

--089e016347a4d4492b04ed6b5a4c--