emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 3713931: New feature optionally to accelerate auto-


From: Alan Mackenzie
Subject: [Emacs-diffs] master 3713931: New feature optionally to accelerate auto-repeated scrolling.
Date: Sun, 14 Dec 2014 18:32:18 +0000

branch: master
commit 3713931778c9bc8674c391dbb9149ac6288922f2
Author: Alan Mackenzie <address@hidden>
Commit: Alan Mackenzie <address@hidden>

    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.
---
 doc/emacs/ChangeLog    |    5 +++++
 doc/emacs/display.texi |   13 +++++++++++++
 etc/ChangeLog          |    4 ++++
 etc/NEWS               |    6 ++++++
 lisp/ChangeLog         |    4 ++++
 lisp/cus-start.el      |    1 +
 src/ChangeLog          |   15 +++++++++++++++
 src/lisp.h             |    1 +
 src/window.c           |   18 ++++++++++++++++++
 src/xdisp.c            |    2 +-
 10 files changed, 68 insertions(+), 1 deletions(-)

diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog
index cd46d9f..d2f7a34 100644
--- a/doc/emacs/ChangeLog
+++ b/doc/emacs/ChangeLog
@@ -1,3 +1,8 @@
+2014-12-14  Alan Mackenzie  <address@hidden>
+
+       * display.texi (Scrolling): fast-but-imprecise-scrolling.
+       Describe new variable.
+
 2014-12-14  Cameron Desautels  <address@hidden>
 
        * custom.texi (Saving Customizations): Mention
diff --git a/doc/emacs/display.texi b/doc/emacs/display.texi
index a5555d5..12a8e1b 100644
--- a/doc/emacs/display.texi
+++ b/doc/emacs/display.texi
@@ -127,6 +127,19 @@ the mouse wheel (@pxref{Mouse Commands}); in general, it 
affects any
 command that has a address@hidden @code{scroll-command} property.
 @xref{Property Lists,,, elisp, The Emacs Lisp Reference Manual}.
 
address@hidden 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
address@hidden to a address@hidden 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
diff --git a/etc/ChangeLog b/etc/ChangeLog
index f344e24..0a06cbd 100644
--- a/etc/ChangeLog
+++ b/etc/ChangeLog
@@ -1,3 +1,7 @@
+2014-12-14  Alan Mackenzie  <address@hidden>
+
+       * NEWS: Add entry for fast-but-imprecise-scrolling.
+
 2014-12-14  Cameron Desautels  <address@hidden>
 
        * NEWS: Mention `custom-prompt-customize-unsaved-options'.
diff --git a/etc/NEWS b/etc/NEWS
index 37cb4b4..6b1a4e3 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -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
 
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 288589d..8a0d518 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,7 @@
+2014-12-14  Alan Mackenzie  <address@hidden>
+
+       * lisp/cus-start.el (all): Add fast-but-imprecise-scrolling.
+
 2014-12-14  Artur Malabarba  <address@hidden>
 
        * let-alist.el: Add lexical binding.
diff --git a/lisp/cus-start.el b/lisp/cus-start.el
index 3b8885a..4049974 100644
--- a/lisp/cus-start.el
+++ b/lisp/cus-start.el
@@ -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.
diff --git a/src/ChangeLog b/src/ChangeLog
index fd56186..46bf280 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,18 @@
+2014-12-14  Alan Mackenzie  <address@hidden>
+
+       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  <address@hidden>
 
        Load system's default trusted Certificate Authorities if available.
diff --git a/src/lisp.h b/src/lisp.h
index a56c4a7..37172c6 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -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.  */
diff --git a/src/window.c b/src/window.c
index 7c2b3ca..0b76664 100644
--- a/src/window.c
+++ b/src/window.c
@@ -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);
diff --git a/src/xdisp.c b/src/xdisp.c
index f022790..48a2979 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -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;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]