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)