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

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

[elpa] master 9152a09 08/34: Separate mark-pushing from blinking


From: Artur Malabarba
Subject: [elpa] master 9152a09 08/34: Separate mark-pushing from blinking
Date: Fri, 16 Oct 2015 09:56:50 +0000

branch: master
commit 9152a09f7ef5cce9199a0dc1253377d40f6857ef
Author: Artur Malabarba <address@hidden>
Commit: Artur Malabarba <address@hidden>

    Separate mark-pushing from blinking
---
 beacon.el |   25 ++++++++++++++++---------
 1 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/beacon.el b/beacon.el
index 34dba38..f081934 100644
--- a/beacon.el
+++ b/beacon.el
@@ -158,10 +158,22 @@ Only returns `beacon-size' elements."
 (defvar beacon--previous-window-start nil)
 (defvar beacon--previous-mark-head nil)
 
+(defun beacon--movement-> (delta)
+  "Return non-nil if latest point movement is > DELTA.
+If DELTA is nil, return nil."
+  (and delta
+       (equal (marker-buffer beacon--previous-place)
+              (current-buffer))
+       (> (abs (- (point) beacon--previous-place))
+          delta)
+       (> (count-screen-lines (min (point) beacon--previous-place)
+                              (max (point) beacon--previous-place))
+          delta)))
+
 (defun beacon--maybe-push-mark ()
   "Push mark if it seems to be safe."
-  (when (and beacon-push-mark
-             (not mark-active))
+  (when (and (not mark-active)
+             (beacon--movement-> beacon-push-mark))
     (let ((head (car mark-ring)))
       (when (and (eq beacon--previous-mark-head head)
                  (not (equal head beacon--previous-place)))
@@ -182,18 +194,13 @@ Only returns `beacon-size' elements."
    ((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--maybe-push-mark)
+   ((beacon--movement-> beacon-blink-when-point-moves)
     (beacon-blink))
    ;; Even if we don't blink, vanish any previous beacon.
    (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))



reply via email to

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