[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 849bc39 18/34: Rely on window-scroll-functions for scroll
From: |
Artur Malabarba |
Subject: |
[elpa] master 849bc39 18/34: Rely on window-scroll-functions for scroll blinks |
Date: |
Fri, 16 Oct 2015 09:56:54 +0000 |
branch: master
commit 849bc3984f2d02586b4f83988a71d00fb01264d5
Author: Tassilo Horn <address@hidden>
Commit: Artur Malabarba <address@hidden>
Rely on window-scroll-functions for scroll blinks
window-scroll-functions are run before the window actually scrolls. So
just set a flag that it did so which is then picked up and cleared by
beacon--post-command. Then the redisplay isn't needed there, although
seldomly it seems post-command-hook is run before
window-scroll-functions. However, the redisplay in beacon--post-command
caused extreme slowdowns when repeatedly deleting text by pressing and
holding DEL in AUCTeX because (I think) every deleted char caused
fontification.
Also fix a problem where the blink occured in the current window whereas
some other window was scrolled, e.g., with the mouse or
scroll-other-window.
---
beacon.el | 18 ++++++++++++------
1 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/beacon.el b/beacon.el
index 8a997a1..acca24d 100644
--- a/beacon.el
+++ b/beacon.el
@@ -204,8 +204,8 @@ Only returns `beacon-size' elements."
;;; Movement detection
+(defvar beacon--window-scrolled nil)
(defvar beacon--previous-place nil)
-(defvar beacon--previous-window-start nil)
(defvar beacon--previous-mark-head nil)
(defun beacon--movement-> (delta)
@@ -243,9 +243,10 @@ If DELTA is nil, return nil."
(beacon-blink))))
;; Blink for scrolling.
((and beacon-blink-when-window-scrolls
- (progn (redisplay)
- (not (equal beacon--previous-window-start (window-start)))))
- (beacon-blink))
+ beacon--window-scrolled)
+ (with-selected-window beacon--window-scrolled
+ (beacon-blink))
+ (setq beacon--window-scrolled nil))
;; Blink for movement
((beacon--movement-> beacon-blink-when-point-moves)
(beacon-blink))
@@ -253,10 +254,12 @@ If DELTA is nil, return nil."
(t (beacon--vanish)))
(beacon--maybe-push-mark)
(unless (window-minibuffer-p)
- (setq beacon--previous-window-start (window-start))
(setq beacon--previous-mark-head (car mark-ring))
(setq beacon--previous-place (point-marker))))
+(defun beacon--window-scroll-function (win _start-pos)
+ (setq beacon--window-scrolled win))
+
;;; Minor-mode
(defcustom beacon-lighter (cond
@@ -271,7 +274,10 @@ If DELTA is nil, return nil."
nil nil beacon-lighter nil
:global t
(if beacon-mode
- (add-hook 'post-command-hook #'beacon--post-command)
+ (progn
+ (add-hook 'window-scroll-functions #'beacon--window-scroll-function)
+ (add-hook 'post-command-hook #'beacon--post-command))
+ (remove-hook 'window-scroll-functions #'beacon--window-scroll-function)
(remove-hook 'post-command-hook #'beacon--post-command)))
(provide 'beacon)
- [elpa] master d1f0728 26/34: Extend doc, (continued)
- [elpa] master d1f0728 26/34: Extend doc, Artur Malabarba, 2015/10/16
- [elpa] master 4a7079e 17/34: Improve readme, Artur Malabarba, 2015/10/16
- [elpa] master f439a41 27/34: Fix double blink when switching buffer, Artur Malabarba, 2015/10/16
- [elpa] master d66b206 28/34: Refactor overlay creation, Artur Malabarba, 2015/10/16
- [elpa] master b033c63 30/34: Merge pull request #6 from tsdh/master, Artur Malabarba, 2015/10/16
- [elpa] master 7294729 24/34: Don't blink on the minibuffer, Artur Malabarba, 2015/10/16
- [elpa] master 3e1defb 32/34: Don't blink in magit status buffers, Artur Malabarba, 2015/10/16
- [elpa] master d48f296 31/34: Doc, Artur Malabarba, 2015/10/16
- [elpa] master 0bdebed 29/34: Blink only in selected window; blink when switching windows, Artur Malabarba, 2015/10/16
- [elpa] master 441ebfe 19/34: Indentation, Artur Malabarba, 2015/10/16
- [elpa] master 849bc39 18/34: Rely on window-scroll-functions for scroll blinks,
Artur Malabarba <=
- [elpa] master 2eb4c54 34/34: Add 'packages/beacon/' from commit 'bccd3de53787c996f9a90bcb5d541252deda01e1', Artur Malabarba, 2015/10/16