[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/scroll-on-drag 823aab7938 27/35: Cleanup: replace 'if' wit
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/scroll-on-drag 823aab7938 27/35: Cleanup: replace 'if' with 'cond' |
Date: |
Thu, 7 Jul 2022 12:02:52 -0400 (EDT) |
branch: elpa/scroll-on-drag
commit 823aab79388e91958a41271fb444d794d781d17f
Author: Campbell Barton <ideasman42@gmail.com>
Commit: Campbell Barton <ideasman42@gmail.com>
Cleanup: replace 'if' with 'cond'
Personal preference.
---
scroll-on-drag.el | 51 ++++++++++++++++++++++++++++-----------------------
1 file changed, 28 insertions(+), 23 deletions(-)
diff --git a/scroll-on-drag.el b/scroll-on-drag.el
index 92ced47b88..9329211072 100644
--- a/scroll-on-drag.el
+++ b/scroll-on-drag.el
@@ -211,11 +211,13 @@ Returns true when scrolling took place, otherwise nil."
(y-init (funcall mouse-y-fn))
(point-of-last-line
- (if scroll-on-drag-smooth
- (save-excursion
- (goto-char (point-max))
- (line-beginning-position))
- 0))
+ (cond
+ (scroll-on-drag-smooth
+ (save-excursion
+ (goto-char (point-max))
+ (line-beginning-position)))
+ (t
+ 0)))
(mouse-y-delta-scale-fn
;; '(f * motion-scale) ^ power', then truncate to int.
@@ -280,9 +282,9 @@ Returns true when scrolling took place, otherwise nil."
(do-draw nil)
(delta-scaled (funcall mouse-y-delta-scale-fn delta)))
- (if scroll-on-drag-smooth
+ (cond
;; Smooth-Scrolling.
- (progn
+ (scroll-on-drag-smooth
(scroll-on-drag--scroll-by-pixels
this-window
this-frame-char-height
@@ -294,7 +296,7 @@ Returns true when scrolling took place, otherwise nil."
;; Non-Smooth-Scrolling (snap to lines).
;; Basically same logic as above, but only step over lines.
- (progn
+ (t
(setq delta-px-accum (+ delta-scaled delta-px-accum))
(let ((lines (/ delta-px-accum this-frame-char-height)))
@@ -367,21 +369,24 @@ Returns true when scrolling took place, otherwise nil."
t)
((mouse-movement-p event)
(setq delta (- (funcall mouse-y-fn) y-init))
- (if (zerop delta)
- (funcall timer-stop-fn)
- (when (zerop delta-prev)
- (unless has-scrolled
- ;; Clamp point to scroll bounds on first scroll,
- ;; allow pressing 'Esc' to use unclamped position.
- (when scroll-on-drag-smooth
- (funcall scroll-consrtain-point-below-window-start-fn))
- (setq has-scrolled t))
- (unless has-scrolled-real
- (let ((inhibit-redisplay nil))
- (run-hooks 'scroll-on-drag-pre-hook)))
- (setq has-scrolled-real t)
- (funcall timer-stop-fn)
- (funcall timer-update-fn timer-update-fn)))
+ (cond
+ ((zerop delta)
+ (funcall timer-stop-fn))
+ (t
+ (when (zerop delta-prev)
+ (unless has-scrolled
+ ;; Clamp point to scroll bounds on first scroll,
+ ;; allow pressing 'Esc' to use unclamped position.
+ (when scroll-on-drag-smooth
+ (funcall scroll-consrtain-point-below-window-start-fn))
+ (setq has-scrolled t))
+ (unless has-scrolled-real
+ (let ((inhibit-redisplay nil))
+ (run-hooks 'scroll-on-drag-pre-hook)))
+ (setq has-scrolled-real t)
+ (funcall timer-stop-fn)
+ (funcall timer-update-fn timer-update-fn))))
+
(setq delta-prev delta)
t)
;; Cancel...
- [nongnu] elpa/scroll-on-drag a668537a8d 02/35: Initial modal scroll, (continued)
- [nongnu] elpa/scroll-on-drag a668537a8d 02/35: Initial modal scroll, ELPA Syncer, 2022/07/07
- [nongnu] elpa/scroll-on-drag 494de949d5 04/35: Restore indent level, ELPA Syncer, 2022/07/07
- [nongnu] elpa/scroll-on-drag 6cf8c0d81e 06/35: Enable smooth scrolling by default, ELPA Syncer, 2022/07/07
- [nongnu] elpa/scroll-on-drag 888abd04c3 09/35: Add melpa link, ELPA Syncer, 2022/07/07
- [nongnu] elpa/scroll-on-drag d8582732d1 29/35: Scroll the window under the mouse cursor, ELPA Syncer, 2022/07/07
- [nongnu] elpa/scroll-on-drag 31c3baed1d 08/35: Check x-pointer-shape is available before setting, ELPA Syncer, 2022/07/07
- [nongnu] elpa/scroll-on-drag fa6a293c74 14/35: Correct macro, ELPA Syncer, 2022/07/07
- [nongnu] elpa/scroll-on-drag 81623ccc59 10/35: Add pre/post hooks, ELPA Syncer, 2022/07/07
- [nongnu] elpa/scroll-on-drag fb9af98461 34/35: Change URL to codeberg, ELPA Syncer, 2022/07/07
- [nongnu] elpa/scroll-on-drag d6257b2fb7 05/35: Prevent cursor changing over text, ELPA Syncer, 2022/07/07
- [nongnu] elpa/scroll-on-drag 823aab7938 27/35: Cleanup: replace 'if' with 'cond',
ELPA Syncer <=
- [nongnu] elpa/scroll-on-drag be3c43b74e 21/35: Fix restoring the point with mixed tabs/spaces, ELPA Syncer, 2022/07/07
- [nongnu] elpa/scroll-on-drag 3cd1e1801a 23/35: Update URL, ELPA Syncer, 2022/07/07
- [nongnu] elpa/scroll-on-drag 2fbd643ea9 16/35: Add .elisp-autofmt to enable auto-formatting, ELPA Syncer, 2022/07/07
- [nongnu] elpa/scroll-on-drag 01c14f4c02 35/35: Cleanup: quiet checkdoc warning, ELPA Syncer, 2022/07/07
- [nongnu] elpa/scroll-on-drag 0a362232a0 19/35: Run 'run-window-scroll-functions' after scrolling, ELPA Syncer, 2022/07/07
- [nongnu] elpa/scroll-on-drag 8962f5f8a7 30/35: Add scroll-on-drag-clamp option to prevent scrolling past point-max, ELPA Syncer, 2022/07/07
- [nongnu] elpa/scroll-on-drag 2d79a6d9c2 18/35: Cleanup: minor syntax changes, ELPA Syncer, 2022/07/07
- [nongnu] elpa/scroll-on-drag 97741be699 32/35: Remove override for timer-idle-list, ELPA Syncer, 2022/07/07
- [nongnu] elpa/scroll-on-drag f9379c56df 03/35: Call redisplay explicitly, ELPA Syncer, 2022/07/07
- [nongnu] elpa/scroll-on-drag 56ab51a329 07/35: Use zerop instead of comparing with zero, ELPA Syncer, 2022/07/07