[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 59b6c94 04/11: [Fix #21 Fix #17] Add beacon-blink-when-poi
From: |
Artur Malabarba |
Subject: |
[elpa] master 59b6c94 04/11: [Fix #21 Fix #17] Add beacon-blink-when-point-moves-horizontally |
Date: |
Fri, 30 Oct 2015 09:54:02 +0000 |
branch: master
commit 59b6c94d1a15d3ab76dbf5f56f21ed460563a6e8
Author: Artur Malabarba <address@hidden>
Commit: Artur Malabarba <address@hidden>
[Fix #21 Fix #17] Add beacon-blink-when-point-moves-horizontally
---
beacon.el | 52 ++++++++++++++++++++++++++++++++++------------------
1 files changed, 34 insertions(+), 18 deletions(-)
diff --git a/beacon.el b/beacon.el
index 6163305..97bef0c 100644
--- a/beacon.el
+++ b/beacon.el
@@ -53,13 +53,20 @@ Otherwise this should be a number, and `beacon' will push
the
mark whenever point moves more than that many lines."
:type '(choice integer (const nil)))
-(defcustom beacon-blink-when-point-moves nil
- "Should the beacon blink when moving a long distance?
-If nil, don't blink due to plain movement.
+(defcustom beacon-blink-when-point-moves-vertically nil
+ "Should the beacon blink when moving a long distance vertically?
+If nil, don't blink due to vertical 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-point-moves-horizontally nil
+ "Should the beacon blink when moving a long distance horizontally?
+If nil, don't blink due to horizontal movement.
+If non-nil, this should be an integer, which is the minimum
+movement distance (in columns) 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)
@@ -294,26 +301,34 @@ Only returns `beacon-size' elements."
;;; Movement detection
-(defun beacon--movement-> (delta)
- "Return non-nil if latest point movement is > DELTA.
-If DELTA is nil, return nil."
- (and delta
+(defun beacon--movement-> (delta-y &optional delta-x)
+ "Return non-nil if latest vertical movement is > DELTA-Y.
+If DELTA-Y is nil, return nil.
+The same is true for DELTA-X and horizonta movement."
+ (and delta-y
(markerp beacon--previous-place)
(equal (marker-buffer beacon--previous-place)
(current-buffer))
;; Quick check that prevents running the code below in very
;; short movements (like typing).
(> (abs (- (point) beacon--previous-place))
- delta)
- ;; Check if the movement was >= DELTA lines by moving DELTA
- ;; lines. `count-screen-lines' is too slow if the movement had
- ;; thousands of lines.
- (save-excursion
- (let ((p (point)))
- (goto-char (min beacon--previous-place p))
- (vertical-motion delta)
- (> (max p beacon--previous-place)
- (line-beginning-position))))))
+ delta-y)
+ ;; Col movement.
+ (or (and delta-x
+ (> (abs (- (current-column)
+ (save-excursion
+ (goto-char beacon--previous-place)
+ (current-column))))
+ delta-x))
+ ;; Check if the movement was >= DELTA lines by moving DELTA
+ ;; lines. `count-screen-lines' is too slow if the movement had
+ ;; thousands of lines.
+ (save-excursion
+ (let ((p (point)))
+ (goto-char (min beacon--previous-place p))
+ (vertical-motion delta-y)
+ (> (max p beacon--previous-place)
+ (line-beginning-position)))))))
(defun beacon--maybe-push-mark ()
"Push mark if it seems to be safe."
@@ -338,7 +353,8 @@ If DELTA is nil, return nil."
(equal beacon--window-scrolled (selected-window)))
(beacon-blink))
;; Blink for movement
- ((beacon--movement-> beacon-blink-when-point-moves)
+ ((beacon--movement-> beacon-blink-when-point-moves-vertically
+ beacon-blink-when-point-moves-horizontally)
(beacon-blink))
;; Even if we don't blink, vanish any previous beacon.
(t (beacon--vanish)))
- [elpa] master updated (988e91c -> af1503e), Artur Malabarba, 2015/10/30
- [elpa] master e2d9843 01/11: [#26] Fix when default background is unspecified-fg or unspecified-bg, Artur Malabarba, 2015/10/30
- [elpa] master 57b1edc 03/11: [Fix #25] blink-when-window-scroll not being used, Artur Malabarba, 2015/10/30
- [elpa] master 59b6c94 04/11: [Fix #21 Fix #17] Add beacon-blink-when-point-moves-horizontally,
Artur Malabarba <=
- [elpa] master 6f493ee 08/11: Merge pull request #29 from syohex/cl-lib, Artur Malabarba, 2015/10/30
- [elpa] master 1a6fcaf 07/11: Load cl-lib for using cl-mapcar, Artur Malabarba, 2015/10/30
- [elpa] master 0092045 10/11: Be silent when pushing mark, Artur Malabarba, 2015/10/30
- [elpa] master e3ab5c3 02/11: Improve documentation, Artur Malabarba, 2015/10/30
- [elpa] master da3d7bc 09/11: Ditch cl-lib again in lieu of seq-mapn, Artur Malabarba, 2015/10/30
- [elpa] master 4c4af24 05/11: * COPYING: New file, fix #27., Artur Malabarba, 2015/10/30
- [elpa] master d0b7011 06/11: Merge pull request #28 from NicolasPetton/master, Artur Malabarba, 2015/10/30
- [elpa] master af1503e 11/11: Merge commit '00920450d83ffe7a02bbe98997e266726819efc2', Artur Malabarba, 2015/10/30