emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/scroll-on-drag 31f322554d 31/35: Cleanup: move force-redis


From: ELPA Syncer
Subject: [nongnu] elpa/scroll-on-drag 31f322554d 31/35: Cleanup: move force-redisplay into an inline function
Date: Thu, 7 Jul 2022 12:02:52 -0400 (EDT)

branch: elpa/scroll-on-drag
commit 31f322554d8bda5028cc4b83a54d77c56bd1d91d
Author: Campbell Barton <ideasman42@gmail.com>
Commit: Campbell Barton <ideasman42@gmail.com>

    Cleanup: move force-redisplay into an inline function
---
 scroll-on-drag.el | 26 +++++++++++---------------
 1 file changed, 11 insertions(+), 15 deletions(-)

diff --git a/scroll-on-drag.el b/scroll-on-drag.el
index f0b80f9893..c99fe037f6 100644
--- a/scroll-on-drag.el
+++ b/scroll-on-drag.el
@@ -149,6 +149,12 @@ Argument ALSO-MOVE-POINT When non-nil, move the POINT as 
well."
 
 ;; End generic scrolling functions.
 
+(defsubst scroll-on-drag--force-redisplay-with-hooks ()
+  "Wrapper for `redisplay' that ignores `inhibit-redisplay'."
+  (let ((inhibit-redisplay nil))
+    (run-hooks 'scroll-on-drag-redisplay-hook)
+    (redisplay)))
+
 
 ;; ---------------------------------------------------------------------------
 ;; Public Functions
@@ -285,9 +291,7 @@ Returns true when scrolling took place, otherwise nil."
                   (setq delta-px-accum (- delta-px-accum (* lines 
this-frame-char-height)))
                   (let ((lines-remainder (scroll-on-drag--scroll-by-lines 
this-window lines t)))
                     (unless (zerop (- lines lines-remainder))
-                      (let ((inhibit-redisplay nil))
-                        (run-hooks 'scroll-on-drag-redisplay-hook)
-                        (redisplay))))))
+                      (scroll-on-drag--force-redisplay-with-hooks)))))
               (funcall timer-start-fn self-fn)))
 
           ((eq scroll-on-drag-style 'line-by-pixel)
@@ -345,9 +349,7 @@ Returns true when scrolling took place, otherwise nil."
                             (scroll-on-drag--scroll-by-lines this-window (- 
lines) t)))))))
 
                 (when do-draw
-                  (let ((inhibit-redisplay nil))
-                    (run-hooks 'scroll-on-drag-redisplay-hook)
-                    (redisplay))))
+                  (scroll-on-drag--force-redisplay-with-hooks)))
               (funcall timer-start-fn self-fn)))))
 
       ;; Apply pixel offset and snap to a line.
@@ -358,9 +360,7 @@ Returns true when scrolling took place, otherwise nil."
               (scroll-on-drag--scroll-by-lines this-window 1 nil))
             (set-window-vscroll this-window 0 t)
             (setq delta-px-accum 0)
-            (let ((inhibit-redisplay nil))
-              (run-hooks 'scroll-on-drag-redisplay-hook)
-              (redisplay)))))
+            (scroll-on-drag--force-redisplay-with-hooks))))
 
       (scroll-reset-fn
         (lambda ()
@@ -381,9 +381,7 @@ Returns true when scrolling took place, otherwise nil."
           (let ((lines-from-top (count-lines (window-start) 
(line-beginning-position))))
             (when (> scroll-margin lines-from-top)
               (forward-line (- scroll-margin lines-from-top))
-              (let ((inhibit-redisplay nil))
-                (run-hooks 'scroll-on-drag-redisplay-hook)
-                (redisplay)))))))
+              (scroll-on-drag--force-redisplay-with-hooks))))))
 
     ;; ---------------
     ;; Main Event Loop
@@ -397,9 +395,7 @@ Returns true when scrolling took place, otherwise nil."
               (setq has-scrolled nil)
               (funcall scroll-reset-fn)
               (funcall scroll-restore-fn)
-              (let ((inhibit-redisplay nil))
-                (run-hooks 'scroll-on-drag-redisplay-hook)
-                (redisplay))
+              (scroll-on-drag--force-redisplay-with-hooks)
               t)
 
             ;; Space keeps current position, restarts scrolling.



reply via email to

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