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

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

[nongnu] elpa/scroll-on-drag 271b4aa6b3 11/35: Add redisplay hook


From: ELPA Syncer
Subject: [nongnu] elpa/scroll-on-drag 271b4aa6b3 11/35: Add redisplay hook
Date: Thu, 7 Jul 2022 12:02:48 -0400 (EDT)

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

    Add redisplay hook
    
    Useful for updating other display options which aren't done automatic.
---
 scroll-on-drag.el | 28 +++++++++++++++++++++++-----
 1 file changed, 23 insertions(+), 5 deletions(-)

diff --git a/scroll-on-drag.el b/scroll-on-drag.el
index 0ab08d8207..8cf82d4ee8 100644
--- a/scroll-on-drag.el
+++ b/scroll-on-drag.el
@@ -71,6 +71,11 @@
   :group 'scroll-on-drag
   :type 'hook)
 
+(defcustom scroll-on-drag-redisplay-hook nil
+  "List of functions to run on scroll redraw."
+  :group 'scroll-on-drag
+  :type 'hook)
+
 
 ;; Generic scrolling functions.
 ;;
@@ -254,7 +259,9 @@ Returns true when scrolling took place, otherwise nil."
                     (- 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)) (redisplay))))))
+                      (let ((inhibit-redisplay nil))
+                        (run-hooks 'scroll-on-drag-redisplay-hook)
+                        (redisplay))))))
               (funcall timer-start-fn self-fn)))
 
           ((eq scroll-on-drag-style 'line-by-pixel)
@@ -295,7 +302,10 @@ Returns true when scrolling took place, otherwise nil."
                           (setq do-draw t))))))
 
                 (when do-draw
-                  (let ((inhibit-redisplay nil)) (redisplay))))
+                  (let
+                    ((inhibit-redisplay nil))
+                    (run-hooks 'scroll-on-drag-redisplay-hook)
+                    (redisplay))))
               (funcall timer-start-fn self-fn)))))
 
       ;; Apply pixel offset and snap to a line.
@@ -306,7 +316,10 @@ 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)) (redisplay)))))
+            (let
+              ((inhibit-redisplay nil))
+              (run-hooks 'scroll-on-drag-redisplay-hook)
+              (redisplay)))))
 
       (scroll-reset-fn
         (lambda ()
@@ -332,7 +345,10 @@ Returns true when scrolling took place, otherwise nil."
                   (save-excursion (move-beginning-of-line nil) (point)))))
             (when (> scroll-margin lines-from-top)
               (forward-line (- scroll-margin lines-from-top))
-              (let ((inhibit-redisplay nil)) (redisplay))
+              (let
+                ((inhibit-redisplay nil))
+                (run-hooks 'scroll-on-drag-redisplay-hook)
+                (redisplay))
               (setq restore-point-use-scroll-offset t))))))
 
     ;; Set arrow cursor (avoids annoying flicker on scroll).
@@ -353,7 +369,9 @@ Returns true when scrolling took place, otherwise nil."
               (setq has-scrolled nil)
               (funcall scroll-reset-fn)
               (funcall scroll-restore-fn)
-              (let ((inhibit-redisplay nil)) (redisplay))
+              (let ((inhibit-redisplay nil))
+                (run-hooks 'scroll-on-drag-redisplay-hook)
+                (redisplay))
               t)
 
             ;; Space keeps current position, restarts scrolling.



reply via email to

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