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

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

[elpa] master 8abbedc 05/34: Default to blinking on window scroll instea


From: Artur Malabarba
Subject: [elpa] master 8abbedc 05/34: Default to blinking on window scroll instead of point movement
Date: Fri, 16 Oct 2015 09:56:49 +0000

branch: master
commit 8abbedcc63e7e3d6efd1c0bbbdfd678b88592d21
Author: Artur Malabarba <address@hidden>
Commit: Artur Malabarba <address@hidden>

    Default to blinking on window scroll instead of point movement
---
 beacon.el |   35 +++++++++++++++++++++++++----------
 1 files changed, 25 insertions(+), 10 deletions(-)

diff --git a/beacon.el b/beacon.el
index cf3868b..0628dad 100644
--- a/beacon.el
+++ b/beacon.el
@@ -36,18 +36,25 @@
 
 (defvar beacon--timer nil)
 
-(defcustom beacon-minimum-distance 15
-  "Minimum movement distance in lines to blink the beacon."
-  :type 'integer)
-
 (defcustom beacon-push-mark nil
   "Should the mark be pushed before long movements?"
   :type 'boolean)
 
+(defcustom beacon-blink-when-point-moves nil
+  "Should the beacon blink when changing buffer?
+If nil, don't blink due to plain movement.
+If non-nil, this should be an integer, which is the minimum
+movement distance (in lines) that triggers a beacon blink."
+  :type '(choice integer (const nil)))
+
 (defcustom beacon-blink-when-buffer-changes t
   "Should the beacon blink when changing buffer?"
   :type 'boolean)
 
+(defcustom beacon-blink-when-window-scrolls t
+  "Should the beacon blink when the window scrolls?"
+  :type 'boolean)
+
 (defcustom beacon-blink-duration 0.3
   "Time, in seconds, that the blink should last."
   :type 'number)
@@ -60,7 +67,7 @@
   "Size of the beacon in characters."
   :type 'number)
 
-(defcustom beacon-brightness 0.5
+(defcustom beacon-brightness 0.4
   "Brightness as a float between 0 and 1."
   :type 'number)
 
@@ -144,6 +151,7 @@ Only returns `beacon-size' elements."
 
 ;;; Movement detection
 (defvar beacon--previous-place nil)
+(defvar beacon--previous-window-start nil)
 (defvar beacon--previous-mark-head nil)
 
 (defun beacon--maybe-push-mark ()
@@ -166,17 +174,24 @@ Only returns `beacon-size' elements."
     (when beacon-blink-when-buffer-changes
       (unless (window-minibuffer-p)
         (beacon-blink))))
-   ;; Blink for distance movement
-   ((and (> (abs (- (point) beacon--previous-place))
-            beacon-minimum-distance)
+   ;; Blink for scrolling.
+   ((and beacon-blink-when-window-scrolls
+         (progn (redisplay)
+                (not (equal beacon--previous-window-start (window-start)))))
+    (beacon--maybe-push-mark)
+    (beacon-blink))
+   ;; Blink for movement
+   ((and beacon-blink-when-point-moves
+         (> (abs (- (point) beacon--previous-place))
+            beacon-blink-when-point-moves)
          (> (count-screen-lines (min (point) beacon--previous-place)
-                                (max (point) beacon--previous-place))
-            beacon-minimum-distance))
+                                (max (point) beacon--previous-place))))
     (beacon--maybe-push-mark)
     (beacon-blink))
    ;; Even if we don't blink, vanish any previous beacon.
    (t (beacon--vanish)))
   (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))))
 



reply via email to

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