Fix bug #6671 with recentering and other scrolling problems.
authorEli Zaretskii <eliz@gnu.org>
Thu, 31 Mar 2011 19:12:30 +0000 (21:12 +0200)
committerEli Zaretskii <eliz@gnu.org>
Thu, 31 Mar 2011 19:12:30 +0000 (21:12 +0200)
 src/xdisp.c (SCROLL_LIMIT): New macro.
 (try_scrolling): Use it when setting scroll_limit.  Limit
 scrolling to 100 screen lines.
 (redisplay_window): Even when falling back on "recentering",
 position point in the window according to scroll-conservatively,
 scroll-margin, and scroll-*-aggressively variables.
 (try_scrolling): When point is above the window, allow searching
 as far as scroll_max, or one screenful, to compute vertical
 distance from PT to the scroll margin position.  This prevents
 try_scrolling from unnecessarily failing when
 scroll-conservatively is set to a value slightly larger than the
 window height.  Clean up the case of PT below the margin at bottom
 of window: scroll_max can no longer be INT_MAX.  When aggressive
 scrolling is in use, don't let point enter the opposite scroll
 margin as result of the scroll.
 (syms_of_xdisp) <scroll-conservatively>: Document the
 threshold of 100 lines for never-recentering scrolling.

 doc/emacs/display.texi (Auto Scrolling): Document the limit of 100 lines
 for never-recentering scrolling with `scroll-conservatively'.

1  2 
src/ChangeLog
src/xdisp.c

diff --cc src/ChangeLog
 -2011-03-30  Eli Zaretskii  <eliz@gnu.org>
++2011-03-31  Eli Zaretskii  <eliz@gnu.org>
 -      * xdisp.c (syms_of_xdisp) <scroll-conservatively>: Document the
++      * xdisp.c (SCROLL_LIMIT): New macro.
++      (try_scrolling): Use it when setting scroll_limit.  Limit
++      scrolling to 100 screen lines.
++      (redisplay_window): Even when falling back on "recentering",
++      position point in the window according to scroll-conservatively,
++      scroll-margin, and scroll-*-aggressively variables.  (Bug#6671)
++
++      (try_scrolling): When point is above the window, allow searching
++      as far as scroll_max, or one screenful, to compute vertical
++      distance from PT to the scroll margin position.  This prevents
++      try_scrolling from unnecessarily failing when
++      scroll-conservatively is set to a value slightly larger than the
++      window height.  Clean up the case of PT below the margin at bottom
++      of window: scroll_max can no longer be INT_MAX.  When aggressive
++      scrolling is in use, don't let point enter the opposite scroll
++      margin as result of the scroll.
++      (syms_of_xdisp) <scroll-conservatively>: Document the
+       threshold of 100 lines for never-recentering scrolling.
 -2011-03-29  Eli Zaretskii  <eliz@gnu.org>
++2011-03-26  Eli Zaretskii  <eliz@gnu.org>
 -      * xdisp.c (try_scrolling): When scrolling down aggressively,
 -      scroll one screen line less, to make sure we end up at the margin
 -      for fractions close to 1.
++      * xdisp.c (redisplay_window): Don't check buffer's clip_changed
++      flag as a prerequisite for invoking try_scrolling.  (Bug#6671)
 -2011-03-28  Eli Zaretskii  <eliz@gnu.org>
 +2011-03-31  Juanma Barranquero  <lekktu@gmail.com>
  
 -      * xdisp.c (try_scrolling): When point is above the window, allow
 -      searching as far as scroll_max, or one screenful, to compute
 -      vertical distance from PT to the scroll margin position.  This
 -      prevents try_scrolling from unnecessarily failing when
 -      scroll-conservatively is set to a value slightly larger than the
 -      window height.
 +      * dispextern.h (move_it_by_lines):
 +      * xdisp.c (move_it_by_lines): Remove parameter `need_y_p', unused
 +      since 2000-12-29T14:24:09Z!gerd@gnu.org.  All callers changed.
 +      (message_log_check_duplicate): Remove parameters `prev_bol' and
 +      `this_bol', unused since 1998-01-01T02:27:27Z!rms@gnu.org.  All callers changed.
 +      (redisplay_internal): Remove parameter `preserve_echo_area',
 +      unused since 1999-07-21T21:43:52Z!gerd@gnu.org.  All callers changed.
  
 -2011-03-27  Eli Zaretskii  <eliz@gnu.org>
 +      * indent.c (Fvertical_motion):
 +      * window.c (window_scroll_pixel_based, Frecenter):
 +      Don't pass `need_y_p' to `move_it_by_lines'.
  
 -      * xdisp.c (try_scrolling): Clean up the case of PT below the
 -      margin at bottom of window: scroll_max can no longer be INT_MAX.
 -      (redisplay_window): Find character position of margin and use
 -      that, rather than adding margin to PT.
 +2011-03-30  Stefan Monnier  <monnier@iro.umontreal.ca>
  
 -2011-03-26  Eli Zaretskii  <eliz@gnu.org>
 +      * eval.c (struct backtrace): Don't cheat with negative numbers, but do
 +      steal a few bits to be more compact.
 +      (interactive_p, Fbacktrace, Fbacktrace_frame, mark_backtrace):
 +      Remove unneeded casts.
  
 -      * xdisp.c (redisplay_window): Don't check buffer's clip_changed
 -      flag as a prerequisite for invoking try_scrolling.  (Bug#6671)
 -      (try_scrolling): Limit scrolling to 100 screen lines.
 -      (SCROLL_LIMIT): New macro.
 -      (try_scrolling): Use it when setting scroll_limit.
 -      (redisplay_window): Even when falling back on "recentering",
 -      position point in the window according to scroll-conservatively,
 -      scroll-margin, and scroll-*-aggressively variables.  (Bug#6671)
 -      (try_scrolling): When aggressive scrolling is in use, don't let
 -      point enter the opposite scroll margin as result of the scroll.
 -      (redisplay_window): Fix operator precedence in condition.
 +      * bytecode.c (Fbyte_code): CAR and CDR can GC.
 +
 +2011-03-30  Zachary Kanfer  <zkanfer@gmail.com>  (tiny change)
 +
 +      * keyboard.c (Fexecute_extended_command): Do log the "suggest key
 +      binding" message (bug#7967).
 +
 +2011-03-30  Paul Eggert  <eggert@cs.ucla.edu>
 +
 +      Fix more problems found by GCC 4.6.0's static checks.
 +
 +      * unexelf.c (unexec) [! (defined _SYSTYPE_SYSV || defined __sgi)]:
 +      Remove unused local var.
 +
 +      * editfns.c (Fmessage_box): Remove unused local var.
 +
 +      * xdisp.c (try_window_reusing_current_matrix, x_produce_glyphs):
 +      (note_mode_line_or_margin_highlight, note_mouse_highlight):
 +      Omit unused local vars.
 +      * window.c (shrink_windows): Omit unused local var.
 +      * menu.c (digest_single_submenu): Omit unused local var.
 +      * dispnew.c (update_window) [PERIODIC_PREEMPTION_CHECKING]:
 +      Omit unused local var.
 +
 +      * keyboard.c (parse_modifiers_uncached, parse_modifiers):
 +      Don't assume string length fits in int.
 +      (keyremap_step, read_key_sequence): Use size_t for sizes.
 +      (read_key_sequence): Don't check last_real_key_start redundantly.
 +
 +      * callproc.c (Fcall_process, Fcall_process_region): Use SAFE_ALLOCA
 +      instead of alloca (Bug#8344).
 +
 +      * eval.c (Fbacktrace): Don't assume nargs fits in int.
 +      (Fbacktrace_frame): Don't assume nframes fits in int.
 +
 +      * syntax.c (scan_sexps_forward): Avoid pointer wraparound.
 +
 +      * xterm.c (x_make_frame_visible, same_x_server): Redo to avoid overflow
 +      concerns.
 +
 +      * term.c (produce_glyphless_glyph): Remove unnecessary test.
 +
 +      * cm.c (calccost): Turn while-do into do-while, for clarity.
 +
 +      * keyboard.c (syms_of_keyboard): Use the same style as later
 +      in this function when indexing through an array.  This also
 +      works around GCC bug 48267.
 +
 +      * image.c (tiff_load): Fix off-by-one image count (Bug#8336).
 +
 +      * xselect.c (x_check_property_data): Return correct size (Bug#8335).
 +
 +      * chartab.c (sub_char_table_ref_and_range): Redo for slight
 +      efficiency gain, and to bypass a gcc -Wstrict-overflow warning.
 +
 +      * keyboard.c, keyboard.h (num_input_events): Now size_t.
 +      This avoids undefined behavior on integer overflow, and is a bit
 +      more convenient anyway since it is compared to a size_t variable.
 +
 +      Variadic C functions now count arguments with size_t, not int.
 +      This avoids an unnecessary limitation on 64-bit machines, which
 +      caused (substring ...) to crash on large vectors (Bug#8344).
 +      * lisp.h (struct Lisp_Subr.function.aMANY): Now takes size_t, not int.
 +      (DEFUN_ARGS_MANY, internal_condition_case_n, safe_call): Likewise.
 +      All variadic functions and their callers changed accordingly.
 +      (struct gcpro.nvars): Now size_t, not int.  All uses changed.
 +      * data.c (arith_driver, float_arith_driver): Likewise.
 +      * editfns.c (general_insert_function): Likewise.
 +      * eval.c (struct backtrace.nargs, interactive_p)
 +      (internal_condition_case_n, run_hook_with_args, apply_lambda)
 +      (funcall_lambda, mark_backtrace): Likewise.
 +      * fns.c (concat): Likewise.
 +      * frame.c (x_set_frame_parameters): Likewise.
 +      * fns.c (get_key_arg): Now accepts and returns size_t, and returns
 +      0 if not found, not -1.  All callers changed.
 +
 +      * alloc.c (garbage_collect): Don't assume stack size fits in int.
 +      (stack_copy_size): Now size_t, not int.
 +      (stack_copy, stack_copy_size): Define only if MAX_SAVE_STACK > 0.
 +
 +2011-03-28  Juanma Barranquero  <lekktu@gmail.com>
 +
 +      * coding.c (encode_designation_at_bol): Remove parameter `charbuf_end',
 +      unused since 2002-03-01T01:17:24Z!handa@m17n.org and 2008-02-01T16:01:31Z!miles@gnu.org.
 +      All callers changed.
 +
 +      * lisp.h (multibyte_char_to_unibyte):
 +      * character.c (multibyte_char_to_unibyte): Remove parameter `rev_tbl',
 +      unused since 2002-03-01T01:16:34Z!handa@m17n.org and 2008-02-01T16:01:31Z!miles@gnu.org.
 +      * character.h (CHAR_TO_BYTE8):
 +      * cmds.c (internal_self_insert):
 +      * editfns.c (general_insert_function):
 +      * keymap.c (push_key_description):
 +      * search.c (Freplace_match):
 +      * xdisp.c (message_dolog, set_message_1): All callers changed.
 +
 +2011-03-28  Stefan Monnier  <monnier@iro.umontreal.ca>
 +
 +      * keyboard.c (safe_run_hook_funcall): New function.
 +      (safe_run_hooks_1, safe_run_hooks_error, safe_run_hooks): On error,
 +      don't set the hook to nil, but remove the offending function instead.
 +      (Qcommand_hook_internal): Remove, unused.
 +      (syms_of_keyboard): Don't initialize Qcommand_hook_internal nor define
 +      Vcommand_hook_internal.
 +
 +      * eval.c (enum run_hooks_condition): Remove.
 +      (funcall_nil, funcall_not): New functions.
 +      (run_hook_with_args): Call each function through a `funcall' argument.
 +      Remove `cond' argument, now redundant.
 +      (Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success)
 +      (Frun_hook_with_args_until_failure): Adjust accordingly.
 +      (run_hook_wrapped_funcall, Frun_hook_wrapped): New functions.
 +
 +2011-03-28  Juanma Barranquero  <lekktu@gmail.com>
 +
 +      * dispextern.h (string_buffer_position): Remove declaration.
 +
 +      * print.c (strout): Remove parameter `multibyte', unused since
 +      1999-08-21T19:30:21Z!gerd@gnu.org.  All callers changed.
 +
 +      * search.c (boyer_moore): Remove parameters `len', `pos' and `lim',
 +      never used since function introduction in 1998-02-08T21:33:56Z!rms@gnu.org.
 +      All callers changed.
 +
 +      * w32.c (_wsa_errlist): Use braces for struct initializers.
 +
 +      * xdisp.c (string_buffer_position_lim): Remove parameter `w',
 +      never used since function introduction in 2001-03-09T18:41:50Z!gerd@gnu.org.
 +      All callers changed.
 +      (string_buffer_position): Likewise.  Also, make static (it's never
 +      used outside xdisp.c).
 +      (cursor_row_p): Remove parameter `w', unused since
 +      2000-10-17T16:08:57Z!gerd@gnu.org.  All callers changed.
 +      (decode_mode_spec): Remove parameter `precision', introduced during
 +      Gerd Moellmann's rewrite at 1999-07-21T21:43:52Z!gerd@gnu.org, but never used.
 +      All callers changed.
 +
 +2011-03-27  Jan Djärv  <jan.h.d@swipnet.se>
 +
 +      * nsterm.m (syms_of_nsterm): Use doc: for ns-auto-hide-menu-bar.
 +
 +2011-03-27  Anders Lindgren  <andlind@gmail.com>
 +
 +      * nsterm.m (ns_menu_bar_is_hidden): New variable.
 +      (ns_constrain_all_frames, ns_menu_bar_should_be_hidden)
 +      (ns_update_auto_hide_menu_bar): New functions.
 +      (ns_update_begin): Call ns_update_auto_hide_menu_bar.
 +      (applicationDidBecomeActive): Call ns_update_auto_hide_menu_bar and
 +      ns_constrain_all_frames.
 +      (constrainFrameRect): Return at once if ns_menu_bar_should_be_hidden.
 +      (syms_of_nsterm): DEFVAR ns-auto-hide-menu-bar, init to Qnil.
 +
 +2011-03-27  Jan Djärv  <jan.h.d@swipnet.se>
 +
 +      * nsmenu.m (runDialogAt): Remove argument to timer_check.
 +
 +2011-03-27  Glenn Morris  <rgm@gnu.org>
 +
 +      * syssignal.h: Replace RETSIGTYPE with void.
 +      * atimer.c, data.c, dispnew.c, emacs.c, floatfns.c, keyboard.c:
 +      * keyboard.h, lisp.h, process.c, sysdep.c, xterm.c:
 +      Replace SIGTYPE with void everywhere.
 +      * s/usg5-4-common.h (SIGTYPE): Remove definition.
 +      * s/template.h (SIGTYPE): Remove commented out definition.
  
- 2011-03-26  Eli Zaretskii  <eliz@gnu.org>
-       * xdisp.c (redisplay_window): Don't check buffer's clip_changed
-       flag as a prerequisite for invoking try_scrolling.  (Bug#6671)
  2011-03-26  Juanma Barranquero  <lekktu@gmail.com>
  
        * w32.c (read_unc_volume): Use parameter `henum', instead of
diff --cc src/xdisp.c
Simple merge