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

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

[nongnu] elpa/scroll-on-jump 18e524a367: Add scroll-on-jump-mode-line-fo


From: ELPA Syncer
Subject: [nongnu] elpa/scroll-on-jump 18e524a367: Add scroll-on-jump-mode-line-format to optionally override the mode-line
Date: Sun, 22 Jan 2023 01:01:45 -0500 (EST)

branch: elpa/scroll-on-jump
commit 18e524a36706fbdf9ad88cf3df8f6d669b4e8221
Author: Campbell Barton <ideasman42@gmail.com>
Commit: Campbell Barton <ideasman42@gmail.com>

    Add scroll-on-jump-mode-line-format to optionally override the mode-line
    
    This can be used to prevent complex mode-lines interfering with
    scrolling performance.
---
 readme.rst        |  6 +++++-
 scroll-on-jump.el | 30 +++++++++++++++++++++++-------
 2 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/readme.rst b/readme.rst
index 714e640a0c..a4af4efebf 100644
--- a/readme.rst
+++ b/readme.rst
@@ -166,8 +166,12 @@ While the defaults seem to work well, these values can be 
customized.
    The duration for jumping to take, set to ``0.0`` to jump immediately.
 ``scroll-on-jump-smooth``: t
    When not nil, use smooth scrolling (by pixels).
-``scroll-on-jump-use-curve``
+``scroll-on-jump-use-curve``: t
    Apply a curve to the scroll speed, starting and ending slow.
+``scroll-on-jump-mode-line-format``: nil
+   When non-nil, use this value for the ``mode-line-format`` while scrolling.
+   This can be used to temporarily override the mode-line while scrolling.
+   It can also help to avoid overly complex mode-lines from slowing down 
scrolling.
 
 
 Installation
diff --git a/scroll-on-jump.el b/scroll-on-jump.el
index 12d03ed442..baf19d0f8c 100644
--- a/scroll-on-jump.el
+++ b/scroll-on-jump.el
@@ -44,6 +44,12 @@
   "Apply a curve to the scroll speed, starting and ending slow."
   :type 'boolean)
 
+(defcustom scroll-on-jump-mode-line-format nil
+  "The `mode-line-format' to use or nil to leave the `mode-line-format' 
unchanged.
+
+This can be useful to use a simplified or event disabling the mode-line
+while scrolling, as a complex mode-line can interfere with smooth scrolling."
+  :type '(choice (const nil) string))
 
 ;; ---------------------------------------------------------------------------
 ;; Generic Utilities
@@ -321,14 +327,10 @@ Argument ALSO-MOVE-POINT moves the point while scrolling."
 
   (run-window-scroll-functions window))
 
-(defun scroll-on-jump--scroll-impl (window lines-scroll dir also-move-point)
-  "Scroll WINDOW LINES-SCROLL lines along DIR direction.
-Moving the point when ALSO-MOVE-POINT is set."
-
+(defun scroll-on-jump--scroll-animated (window lines-scroll dir 
also-move-point)
+  "Perform an animated scroll.
+see `scroll-on-jump--scroll-impl' for doc-strings for WINDOW, LINES-SCROLL, 
DIR & ALSO-MOVE-POINT."
   (cond
-   ;; No animation.
-   ((zerop scroll-on-jump-duration)
-    (scroll-on-jump--immediate-scroll window lines-scroll dir))
    ;; Use pixel scrolling.
    ;;
    ;; NOTE: only pixel scroll >1 lines so actions that move the cursor up/down 
one
@@ -343,6 +345,20 @@ Moving the point when ALSO-MOVE-POINT is set."
    (t
     (scroll-on-jump--animated-scroll-by-line window lines-scroll dir 
also-move-point))))
 
+(defun scroll-on-jump--scroll-impl (window lines-scroll dir also-move-point)
+  "Scroll WINDOW LINES-SCROLL lines along DIR direction.
+Moving the point when ALSO-MOVE-POINT is set."
+  (cond
+   ;; No animation.
+   ((zerop scroll-on-jump-duration)
+    (scroll-on-jump--immediate-scroll window lines-scroll dir))
+   (scroll-on-jump-mode-line-format
+    (let ((mode-line-format scroll-on-jump-mode-line-format))
+      (scroll-on-jump--scroll-animated window lines-scroll dir 
also-move-point))
+    (force-mode-line-update))
+   (t
+    (scroll-on-jump--scroll-animated window lines-scroll dir 
also-move-point))))
+
 (defun scroll-on-jump-auto-center (window point-prev point-next)
   "Re-frame WINDOW from POINT-PREV to POINT-NEXT, optionally animating."
   ;; Count lines, excluding the current line.



reply via email to

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