From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: Unfreezing the display during auto-repeated scrolling. Simpler approach. Date: Fri, 21 Nov 2014 15:44:20 +0000 Message-ID: <20141121154420.GA24582@acm.acm> References: <83wq7j0xqj.fsf@gnu.org> <20141029145211.GB2953@acm.acm> <20141029212525.GD2953@acm.acm> <20141030220919.GB2721@acm.acm> <83oasszn9e.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1416584730 31779 80.91.229.3 (21 Nov 2014 15:45:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 21 Nov 2014 15:45:30 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier , Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Nov 21 16:45:22 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XrqOV-0000ay-IT for ged-emacs-devel@m.gmane.org; Fri, 21 Nov 2014 16:45:12 +0100 Original-Received: from localhost ([::1]:41203 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XrqOV-0004iE-7L for ged-emacs-devel@m.gmane.org; Fri, 21 Nov 2014 10:45:11 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38309) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XrqON-0004do-BU for emacs-devel@gnu.org; Fri, 21 Nov 2014 10:45:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XrqOI-0001yq-H6 for emacs-devel@gnu.org; Fri, 21 Nov 2014 10:45:03 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:36770 helo=mail.muc.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XrqOI-0001yb-25 for emacs-devel@gnu.org; Fri, 21 Nov 2014 10:44:58 -0500 Original-Received: (qmail 81812 invoked by uid 3782); 21 Nov 2014 15:44:56 -0000 Original-Received: from acm.muc.de (pD951AF0D.dip0.t-ipconnect.de [217.81.175.13]) by colin.muc.de (tmda-ofmipd) with ESMTP; Fri, 21 Nov 2014 16:44:54 +0100 Original-Received: (qmail 24636 invoked by uid 1000); 21 Nov 2014 15:44:20 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 8.x X-Received-From: 193.149.48.1 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:177950 Archived-At: Hello, Stefan and Eli. This matter was hanging in the air when Emacs was converted to git. Just a short summary of this change: introduce a new user option, off by default, which suppresses fontification (by binding fontification-functions to nil) when the user scrolls by whole screens. This change is ready to be applied to the Emacs master branch. Is it OK to apply it now? For reference here is the change: 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 use-default-face-for-fast-scrolling is non-nil. (syms_of_window): New DEFVAR_BOOL use-default-face-for-fast-scrolling. src/lisp.h (bool): Declare Qfontification_functions extern. lisp/cus-start.el (all): Add use-default-face-for-fast-scrolling. doc/emacs/display.texi (Scrolling): use-default-face-for-fast-scrolling. Describe new variable. etc/NEWS: Add entry for use-default-face-for-fast-scrolling. diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index aa9804f..409fb54 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog @@ -1,3 +1,8 @@ +2014-11-21 Alan Mackenzie + + * display.texi (Scrolling): use-default-face-for-fast-scrolling. + Describe new variable. + 2014-11-21 Eli Zaretskii * maintaining.texi (Version Control Systems): Move "@end itemize" diff --git a/doc/emacs/display.texi b/doc/emacs/display.texi index a5555d5..f655ed3 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 non-@code{nil} @code{scroll-command} property. @xref{Property Lists,,, elisp, The Emacs Lisp Reference Manual}. +@vindex use-default-face-for-fast-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{use-default-face-for-fast-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 diff --git a/etc/ChangeLog b/etc/ChangeLog index d57190f..19a542a 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,7 @@ +2014-11-21 Alan Mackenzie + + * NEWS: Add entry for use-default-face-for-fast-scrolling. + 2014-11-19 Leo Liu * NEWS: Mention new macro define-advice. diff --git a/etc/NEWS b/etc/NEWS index 769d2c6..2d27639 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -113,6 +113,12 @@ this has no effect. *** A new text property `inhibit-read-only' can be used in read-only buffers to allow certain parts of the text to be writable. ++++ +** New variable `use-default-face-for-fast-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/cus-start.el b/lisp/cus-start.el index 3b8885a..ae29c29 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") + (use-default-face-for-fast-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 b169479..f660642 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,18 @@ +2014-11-21 Alan Mackenzie + + 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 + use-default-face-for-fast-scrolling is non-nil. + (syms_of_window): New DEFVAR_BOOL + use-default-face-for-fast-scrolling. + + * lisp.h (bool): Declare Qfontification_functions extern. + 2014-11-17 Paul Eggert Improve time stamp handling, and be more consistent about it. diff --git a/src/lisp.h b/src/lisp.h index bdff019..7dfd1fa 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -829,6 +829,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..2585d32 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 && Vuse_default_face_for_fast_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 ("use-default-face-for-fast-scrolling", + Vuse_default_face_for_fast_scrolling, + doc: /* When non-nil, accelerate repeated 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. */); + Vuse_default_face_for_fast_scrolling = 0; + defsubr (&Sselected_window); defsubr (&Sminibuffer_window); defsubr (&Swindow_minibuffer_p); diff --git a/src/xdisp.c b/src/xdisp.c index 1b015e7..5751693 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; -- Alan Mackenzie (Nuremberg, Germany).