[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/scroll-on-drag 81623ccc59 10/35: Add pre/post hooks
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/scroll-on-drag 81623ccc59 10/35: Add pre/post hooks |
Date: |
Thu, 7 Jul 2022 12:02:48 -0400 (EDT) |
branch: elpa/scroll-on-drag
commit 81623ccc5965de021dd202681d373f638f82cc68
Author: Campbell Barton <ideasman42@gmail.com>
Commit: Campbell Barton <ideasman42@gmail.com>
Add pre/post hooks
Useful for having functionality run during scroll
which won't run if scroll isn't initiated.
---
scroll-on-drag.el | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/scroll-on-drag.el b/scroll-on-drag.el
index 74433b2daa..0ab08d8207 100644
--- a/scroll-on-drag.el
+++ b/scroll-on-drag.el
@@ -61,6 +61,16 @@
:group 'scroll-on-drag
:type 'boolean)
+(defcustom scroll-on-drag-pre-hook nil
+ "List of functions to be called when scroll-on-drag starts."
+ :group 'scroll-on-drag
+ :type 'hook)
+
+(defcustom scroll-on-drag-post-hook nil
+ "List of functions to be called when scroll-on-drag finishes."
+ :group 'scroll-on-drag
+ :type 'hook)
+
;; Generic scrolling functions.
;;
@@ -361,6 +371,10 @@ Returns true when scrolling took place, otherwise nil."
(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)))
@@ -390,6 +404,11 @@ Returns true when scrolling took place, otherwise nil."
(setq x-pointer-shape restore-x-pointer-shape)
(set-mouse-color nil))
+ (when has-scrolled-real
+ (let
+ ((inhibit-redisplay nil))
+ (run-hooks 'scroll-on-drag-post-hook)))
+
;; Result so we know if any scrolling occurred,
;; allowing a fallback action on 'click'.
has-scrolled-real))
- [nongnu] elpa/scroll-on-drag d93b69eed6 33/35: Cleanup: use brief SPDX license, (continued)
- [nongnu] elpa/scroll-on-drag d93b69eed6 33/35: Cleanup: use brief SPDX license, ELPA Syncer, 2022/07/07
- [nongnu] elpa/scroll-on-drag 64445dd96f 15/35: Apply auto-formatting, ELPA Syncer, 2022/07/07
- [nongnu] elpa/scroll-on-drag a717d58f31 01/35: Add license file, ELPA Syncer, 2022/07/07
- [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 <=
- [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, 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