Commit 37139317 authored by Alan Mackenzie's avatar Alan Mackenzie
Browse files

New feature optionally to accelerate auto-repeated scrolling.

src/xdisp.c: Remove "static" from declaration of
Qfontification_functions.

src/window.c (window_scroll): bind fontification-functions to nil when
scrolling by whole screens and fast-but-imprecise-scrolling is non-nil.
(syms_of_window): New DEFVAR_BOOL fast-but-imprecise-scrolling.

src/lisp.h (bool): Declare Qfontification_functions extern.

lisp/cus-start.el (all): Add fast-but-imprecise-scrolling.

doc/emacs/display.texi (Scrolling): fast-but-imprecise-scrolling.
Describe new variable.

etc/NEWS: Add entry for fast-but-imprecise-scrolling.
parent 33c5143f
2014-12-14 Alan Mackenzie <acm@muc.de>
* display.texi (Scrolling): fast-but-imprecise-scrolling.
Describe new variable.
2014-12-14 Cameron Desautels <camdez@gmail.com> 2014-12-14 Cameron Desautels <camdez@gmail.com>
* custom.texi (Saving Customizations): Mention * custom.texi (Saving Customizations): Mention
......
...@@ -127,6 +127,19 @@ the mouse wheel (@pxref{Mouse Commands}); in general, it affects any ...@@ -127,6 +127,19 @@ the mouse wheel (@pxref{Mouse Commands}); in general, it affects any
command that has a non-@code{nil} @code{scroll-command} property. command that has a non-@code{nil} @code{scroll-command} property.
@xref{Property Lists,,, elisp, The Emacs Lisp Reference Manual}. @xref{Property Lists,,, elisp, The Emacs Lisp Reference Manual}.
@vindex fast-but-imprecise-scrolling
Sometimes, particularly when you hold down keys such as @kbd{C-v}
and @kbd{M-v}, activating keyboard auto-repeat, Emacs fails to keep up
with the rapid rate of scrolling requested; the display doesn't update
and Emacs can become unresponsive to input for quite a long time. You
can counter this sluggishness by setting the variable
@code{fast-but-imprecise-scrolling} to a non-@code{nil} value. This
instructs the scrolling commands not to fontify (@pxref{Font Lock})
any unfontified text they scroll over, instead to assume it has the
default face. This can cause Emacs to scroll to somewhat wrong buffer
positions when the faces in use are not all the same size, even with
single (i.e. without auto-repeat) scrolling operations.
@vindex scroll-up @vindex scroll-up
@vindex scroll-down @vindex scroll-down
@findex scroll-up-line @findex scroll-up-line
......
2014-12-14 Alan Mackenzie <acm@muc.de>
* NEWS: Add entry for fast-but-imprecise-scrolling.
2014-12-14 Cameron Desautels <camdez@gmail.com> 2014-12-14 Cameron Desautels <camdez@gmail.com>
* NEWS: Mention `custom-prompt-customize-unsaved-options'. * NEWS: Mention `custom-prompt-customize-unsaved-options'.
......
...@@ -153,6 +153,12 @@ name (as returned from, for instance, `file-name-all-completions' is ...@@ -153,6 +153,12 @@ name (as returned from, for instance, `file-name-all-completions' is
a directory file name. It returns non-nil if the last character in a directory file name. It returns non-nil if the last character in
the name is a forward slash. the name is a forward slash.
+++
** New variable `fast-but-imprecise-scrolling' inhibits
fontification during full screen scrolling operations, giving less
hesitant operation during auto-repeat of C-v, M-v at the cost of
possible inaccuracies in the end position.
* Editing Changes in Emacs 25.1 * Editing Changes in Emacs 25.1
......
2014-12-14 Alan Mackenzie <acm@muc.de>
* lisp/cus-start.el (all): Add fast-but-imprecise-scrolling.
2014-12-14 Artur Malabarba <bruce.connor.am@gmail.com> 2014-12-14 Artur Malabarba <bruce.connor.am@gmail.com>
* let-alist.el: Add lexical binding. * let-alist.el: Add lexical binding.
......
...@@ -460,6 +460,7 @@ since it could result in memory overflow and make Emacs crash." ...@@ -460,6 +460,7 @@ since it could result in memory overflow and make Emacs crash."
:value display-buffer) :value display-buffer)
(other :tag "Always (t)" :value t)) (other :tag "Always (t)" :value t))
"24.3") "24.3")
(fast-but-imprecise-scrolling scrolling boolean "25.1")
(window-resize-pixelwise windows boolean "24.4") (window-resize-pixelwise windows boolean "24.4")
;; xdisp.c ;; xdisp.c
;; The whitespace group is for whitespace.el. ;; The whitespace group is for whitespace.el.
......
2014-12-14 Alan Mackenzie <acm@muc.de>
New feature optionally to accelerate auto-repeated scrolling.
* xdisp.c: Remove "static" from declaration of
Qfontification_functions.
* window.c (window_scroll): bind fontification-functions to nil
when scrolling by whole screens and
fast-but-imprecise-scrolling is non-nil.
(syms_of_window): New DEFVAR_BOOL
fast-but-imprecise-scrolling.
* lisp.h (bool): Declare Qfontification_functions extern.
2014-12-14 Eli Zaretskii <eliz@gnu.org> 2014-12-14 Eli Zaretskii <eliz@gnu.org>
Load system's default trusted Certificate Authorities if available. Load system's default trusted Certificate Authorities if available.
......
...@@ -830,6 +830,7 @@ extern Lisp_Object Qwindowp; ...@@ -830,6 +830,7 @@ extern Lisp_Object Qwindowp;
/* Defined in xdisp.c. */ /* Defined in xdisp.c. */
extern Lisp_Object Qimage; extern Lisp_Object Qimage;
extern Lisp_Object Qfontification_functions;
/* Extract a value or address from a Lisp_Object. */ /* Extract a value or address from a Lisp_Object. */
......
...@@ -4869,11 +4869,16 @@ window_internal_height (struct window *w) ...@@ -4869,11 +4869,16 @@ window_internal_height (struct window *w)
static void static void
window_scroll (Lisp_Object window, EMACS_INT n, bool whole, int noerror) window_scroll (Lisp_Object window, EMACS_INT n, bool whole, int noerror)
{ {
ptrdiff_t count = SPECPDL_INDEX ();
immediate_quit = 1; immediate_quit = 1;
n = clip_to_bounds (INT_MIN, n, INT_MAX); n = clip_to_bounds (INT_MIN, n, INT_MAX);
wset_redisplay (XWINDOW (window)); wset_redisplay (XWINDOW (window));
if (whole && Vfast_but_imprecise_scrolling)
specbind (Qfontification_functions, Qnil);
/* If we must, use the pixel-based version which is much slower than /* If we must, use the pixel-based version which is much slower than
the line-based one but can handle varying line heights. */ the line-based one but can handle varying line heights. */
if (FRAME_WINDOW_P (XFRAME (XWINDOW (window)->frame))) if (FRAME_WINDOW_P (XFRAME (XWINDOW (window)->frame)))
...@@ -4881,6 +4886,8 @@ window_scroll (Lisp_Object window, EMACS_INT n, bool whole, int noerror) ...@@ -4881,6 +4886,8 @@ window_scroll (Lisp_Object window, EMACS_INT n, bool whole, int noerror)
else else
window_scroll_line_based (window, n, whole, noerror); window_scroll_line_based (window, n, whole, noerror);
unbind_to (count, Qnil);
/* Bug#15957. */ /* Bug#15957. */
XWINDOW (window)->window_end_valid = 0; XWINDOW (window)->window_end_valid = 0;
immediate_quit = 0; immediate_quit = 0;
...@@ -7478,6 +7485,17 @@ frame's character size, at least one window may get resized ...@@ -7478,6 +7485,17 @@ frame's character size, at least one window may get resized
pixelwise even if this option is nil. */); pixelwise even if this option is nil. */);
window_resize_pixelwise = 0; window_resize_pixelwise = 0;
DEFVAR_BOOL ("fast-but-imprecise-scrolling",
Vfast_but_imprecise_scrolling,
doc: /* When non-nil, accelerate scrolling operations.
This comes into play when scrolling rapidly over previously
unfontified buffer regions. Only those portions of the buffer which
are actually going to be displayed get fontified.
Note that this optimization can cause the portion of the buffer
displayed after a scrolling operation to be somewhat inaccurate. */);
Vfast_but_imprecise_scrolling = 0;
defsubr (&Sselected_window); defsubr (&Sselected_window);
defsubr (&Sminibuffer_window); defsubr (&Sminibuffer_window);
defsubr (&Swindow_minibuffer_p); defsubr (&Swindow_minibuffer_p);
......
...@@ -347,7 +347,7 @@ Lisp_Object Qtext; ...@@ -347,7 +347,7 @@ Lisp_Object Qtext;
/* Holds the list (error). */ /* Holds the list (error). */
static Lisp_Object list_of_error; static Lisp_Object list_of_error;
static Lisp_Object Qfontification_functions; Lisp_Object Qfontification_functions;
static Lisp_Object Qwrap_prefix; static Lisp_Object Qwrap_prefix;
static Lisp_Object Qline_prefix; static Lisp_Object Qline_prefix;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment