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.
This commit is contained in:
Alan Mackenzie 2014-12-14 18:26:44 +00:00
parent 33c5143fa6
commit 3713931778
10 changed files with 68 additions and 1 deletions

View file

@ -1,3 +1,8 @@
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>
* custom.texi (Saving Customizations): Mention

View file

@ -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.
@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-down
@findex scroll-up-line

View file

@ -1,3 +1,7 @@
2014-12-14 Alan Mackenzie <acm@muc.de>
* NEWS: Add entry for fast-but-imprecise-scrolling.
2014-12-14 Cameron Desautels <camdez@gmail.com>
* NEWS: Mention `custom-prompt-customize-unsaved-options'.

View file

@ -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
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

View file

@ -1,3 +1,7 @@
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>
* let-alist.el: Add lexical binding.

View file

@ -460,6 +460,7 @@ since it could result in memory overflow and make Emacs crash."
:value display-buffer)
(other :tag "Always (t)" :value t))
"24.3")
(fast-but-imprecise-scrolling scrolling boolean "25.1")
(window-resize-pixelwise windows boolean "24.4")
;; xdisp.c
;; The whitespace group is for whitespace.el.

View file

@ -1,3 +1,18 @@
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>
Load system's default trusted Certificate Authorities if available.

View file

@ -830,6 +830,7 @@ extern Lisp_Object Qwindowp;
/* Defined in xdisp.c. */
extern Lisp_Object Qimage;
extern Lisp_Object Qfontification_functions;
/* Extract a value or address from a Lisp_Object. */

View file

@ -4869,11 +4869,16 @@ window_internal_height (struct window *w)
static void
window_scroll (Lisp_Object window, EMACS_INT n, bool whole, int noerror)
{
ptrdiff_t count = SPECPDL_INDEX ();
immediate_quit = 1;
n = clip_to_bounds (INT_MIN, n, INT_MAX);
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
the line-based one but can handle varying line heights. */
if (FRAME_WINDOW_P (XFRAME (XWINDOW (window)->frame)))
@ -4881,6 +4886,8 @@ window_scroll (Lisp_Object window, EMACS_INT n, bool whole, int noerror)
else
window_scroll_line_based (window, n, whole, noerror);
unbind_to (count, Qnil);
/* Bug#15957. */
XWINDOW (window)->window_end_valid = 0;
immediate_quit = 0;
@ -7478,6 +7485,17 @@ frame's character size, at least one window may get resized
pixelwise even if this option is nil. */);
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 (&Sminibuffer_window);
defsubr (&Swindow_minibuffer_p);

View file

@ -347,7 +347,7 @@ Lisp_Object Qtext;
/* Holds the list (error). */
static Lisp_Object list_of_error;
static Lisp_Object Qfontification_functions;
Lisp_Object Qfontification_functions;
static Lisp_Object Qwrap_prefix;
static Lisp_Object Qline_prefix;