[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/scroll-on-drag 56ab51a329 07/35: Use zerop instead of comp
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/scroll-on-drag 56ab51a329 07/35: Use zerop instead of comparing with zero |
Date: |
Thu, 7 Jul 2022 12:02:45 -0400 (EDT) |
branch: elpa/scroll-on-drag
commit 56ab51a329bb88cd8a03ae279e2b8921f7e214e3
Author: Campbell Barton <ideasman42@gmail.com>
Commit: Campbell Barton <ideasman42@gmail.com>
Use zerop instead of comparing with zero
---
scroll-on-drag.el | 39 +++++++++++++++++----------------------
1 file changed, 17 insertions(+), 22 deletions(-)
diff --git a/scroll-on-drag.el b/scroll-on-drag.el
index bf63821557..df69e9d294 100644
--- a/scroll-on-drag.el
+++ b/scroll-on-drag.el
@@ -78,9 +78,9 @@ Argument ALSO-MOVE-POINT When non-nil, move the POINT as
well."
(let ((lines-remainder 0))
(when also-move-point
(let ((lines-point-remainder (forward-line lines)))
- (unless (eq 0 lines-point-remainder)
+ (unless (zerop lines-point-remainder)
(setq lines (- lines lines-point-remainder)))))
- (unless (eq 0 lines)
+ (unless (zerop lines)
(set-window-start
window
(save-excursion
@@ -89,7 +89,7 @@ Argument ALSO-MOVE-POINT When non-nil, move the POINT as
well."
(point))
t)
(when also-move-point
- (unless (eq 0 lines-remainder)
+ (unless (zerop lines-remainder)
(forward-line (- lines-remainder)))))
lines-remainder))
@@ -110,9 +110,9 @@ Argument ALSO-MOVE-POINT When non-nil, move the POINT as
well."
(lines (/ scroll-px-next char-height))
(scroll-px (- scroll-px-next (* lines char-height)))
(lines-remainder 0))
- (unless (eq 0 lines)
+ (unless (zerop lines)
(setq lines-remainder (- (scroll-on-drag--scroll-by-lines window (-
lines) also-move-point))) ;; flip
- (unless (eq 0 lines-remainder)
+ (unless (zerop lines-remainder)
(setq scroll-px char-height)))
(set-window-vscroll window (- char-height scroll-px) t)
(- lines-remainder)))
@@ -124,9 +124,9 @@ Argument ALSO-MOVE-POINT When non-nil, move the POINT as
well."
(lines (/ scroll-px-next char-height))
(scroll-px (- scroll-px-next (* lines char-height)))
(lines-remainder 0))
- (unless (eq 0 lines)
+ (unless (zerop lines)
(setq lines-remainder (scroll-on-drag--scroll-by-lines window lines
also-move-point))
- (unless (eq 0 lines-remainder)
+ (unless (zerop lines-remainder)
(setq scroll-px char-height)))
(set-window-vscroll window scroll-px t)
lines-remainder))
@@ -135,9 +135,11 @@ Argument ALSO-MOVE-POINT When non-nil, move the POINT as
well."
;; End generic scrolling functions.
-
-(defun scroll-on-drag-internal ()
- "Main scrolling function."
+;;;###autoload
+(defun scroll-on-drag ()
+ "Interactively scroll (typically on click event).
+Returns true when scrolling took place, otherwise nil."
+ (interactive)
(let*
(
;; Don't run unnecessary logic when scrolling.
@@ -237,11 +239,11 @@ Argument ALSO-MOVE-POINT When non-nil, move the POINT as
well."
(lambda (self-fn)
(let ((lines delta))
- (unless (eq lines 0)
+ (unless (zerop lines)
(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 (eq 0 (- lines lines-remainder))
+ (unless (zerop (- lines lines-remainder))
(let ((inhibit-redisplay nil)) (redisplay))))))
(funcall timer-start-fn self-fn)))
@@ -276,7 +278,7 @@ Argument ALSO-MOVE-POINT When non-nil, move the POINT as
well."
(+ delta-scaled delta-px-accum))
(let ((lines (/ delta-px-accum this-frame-char-height)))
- (unless (eq lines 0)
+ (unless (zerop lines)
(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)))
@@ -350,9 +352,9 @@ Argument ALSO-MOVE-POINT When non-nil, move the POINT as
well."
t)
((mouse-movement-p event)
(setq delta (- (funcall mouse-y-fn) y-init))
- (if (eq delta 0)
+ (if (zerop delta)
(funcall timer-stop-fn)
- (when (eq delta-prev 0)
+ (when (zerop delta-prev)
(unless has-scrolled
;; Clamp point to scroll bounds on first scroll,
;; allow pressing 'Esc' to use unclamped position.
@@ -392,13 +394,6 @@ Argument ALSO-MOVE-POINT When non-nil, move the POINT as
well."
;; allowing a fallback action on 'click'.
has-scrolled-real))
-;;;###autoload
-(defun scroll-on-drag ()
- "Interactively scroll (typically on click event).
-Returns true when scrolling took place, otherwise nil."
- (interactive)
- (scroll-on-drag-internal))
-
;;;###autoload
(defmacro scroll-on-drag-with-fallback (&rest body)
"A macro to scroll and perform a different action on click.
- [nongnu] elpa/scroll-on-drag 823aab7938 27/35: Cleanup: replace 'if' with 'cond', (continued)
- [nongnu] elpa/scroll-on-drag 823aab7938 27/35: Cleanup: replace 'if' with 'cond', ELPA Syncer, 2022/07/07
- [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 <=
- [nongnu] elpa/scroll-on-drag 882dc94bb8 12/35: Cleanup: remove unused variables, ELPA Syncer, 2022/07/07
- [nongnu] elpa/scroll-on-drag cacadcd9bd 20/35: Cleanup: add sections, ELPA Syncer, 2022/07/07
- [nongnu] elpa/scroll-on-drag 271b4aa6b3 11/35: Add redisplay hook, ELPA Syncer, 2022/07/07
- [nongnu] elpa/scroll-on-drag 6d62a239a9 28/35: Cleanup: use defgroup, ELPA Syncer, 2022/07/07
- [nongnu] elpa/scroll-on-drag 6db1380826 25/35: Cleanup: formatting, ELPA Syncer, 2022/07/07
- [nongnu] elpa/scroll-on-drag ba2c1a598e 17/35: Fix for idle timers running during scroll, ELPA Syncer, 2022/07/07
- [nongnu] elpa/scroll-on-drag 157637ba6b 26/35: Remove cursor setting code (resolving #1), ELPA Syncer, 2022/07/07