[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 19096a6 10/34: Initial (failed) impl for beacon at end of
From: |
Artur Malabarba |
Subject: |
[elpa] master 19096a6 10/34: Initial (failed) impl for beacon at end of line |
Date: |
Fri, 16 Oct 2015 09:56:51 +0000 |
branch: master
commit 19096a62529a75ea8999c3ee31babe097e3219b1
Author: Artur Malabarba <address@hidden>
Commit: Artur Malabarba <address@hidden>
Initial (failed) impl for beacon at end of line
---
beacon.el | 28 ++++++++++++++++++++++++++--
1 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/beacon.el b/beacon.el
index 18d4819..dd1976d 100644
--- a/beacon.el
+++ b/beacon.el
@@ -94,6 +94,25 @@ e.g. \"#666600\"."
(overlay-put ov 'beacon t)
(push ov beacon--ovs)))
+(defun beacon--ov-put-after-string (overlay colors)
+ "Add an after-string property to OVERLAY.
+The property's value is a string of spaces with background
+COLORS applied to each one."
+ (overlay-put overlay 'beacon-colors colors)
+ (overlay-put overlay 'after-string
+ (mapconcat (lambda (c) (propertize " " 'face (list :background
c)))
+ colors
+ "")))
+
+(defun beacon--after-string-overlay (colors)
+ "Put an overlay at point with an after-string property.
+The property's value is a string of spaces with background
+COLORS applied to each one."
+ (let ((ov (make-overlay (point) (point))))
+ (beacon--ov-put-after-string ov colors)
+ (overlay-put ov 'beacon t)
+ (push ov beacon--ovs)))
+
(defun beacon--ov-at-point ()
(car (cl-member-if (lambda (o) (overlay-get o 'beacon))
(overlays-at (point)))))
@@ -138,7 +157,7 @@ Only returns `beacon-size' elements."
(while colors
(if (looking-at "$")
(progn
- ;; (beacon--after-string)
+ (beacon--after-string-overlay colors)
(setq colors nil))
(beacon--colored-overlay (pop colors))
(forward-char 1))))))
@@ -152,7 +171,12 @@ Only returns `beacon-size' elements."
(save-excursion
(while (progn (forward-char 1)
(setq o (beacon--ov-at-point)))
- (move-overlay o (1- (point)) (point)))))))
+ (let ((colors (overlay-get o 'beacon-colors)))
+ (if (not colors)
+ (move-overlay o (1- (point)) (point))
+ (forward-char -1)
+ (beacon--colored-overlay (pop colors))
+ (beacon--ov-put-after-string o colors))))))))
(defun beacon-blink ()
"Blink the beacon at the position of the cursor."
- [elpa] master updated (6578236 -> 2eb4c54), Artur Malabarba, 2015/10/16
- [elpa] master b509d63 04/34: [Fix #1], Artur Malabarba, 2015/10/16
- [elpa] master 3022997 02/34: Rename to beacon, Artur Malabarba, 2015/10/16
- [elpa] master 36be965 09/34: Make beacon color customizable, Artur Malabarba, 2015/10/16
- [elpa] master 43cbfd4 15/34: Merge pull request #3 from tsdh/master, Artur Malabarba, 2015/10/16
- [elpa] master 8abbedc 05/34: Default to blinking on window scroll instead of point movement, Artur Malabarba, 2015/10/16
- [elpa] master fbcf9fc 16/34: Drop cl-lib dep, Artur Malabarba, 2015/10/16
- [elpa] master 19096a6 10/34: Initial (failed) impl for beacon at end of line,
Artur Malabarba <=
- [elpa] master e533e04 11/34: Fix an error, Artur Malabarba, 2015/10/16
- [elpa] master 03d12b4 03/34: Rename file, Artur Malabarba, 2015/10/16
- [elpa] master 8941740 07/34: Fix docs, Artur Malabarba, 2015/10/16
- [elpa] master c82095a 06/34: Add url, Artur Malabarba, 2015/10/16
- [elpa] master 9152a09 08/34: Separate mark-pushing from blinking, Artur Malabarba, 2015/10/16
- [elpa] master b60416c 01/34: First commit, Artur Malabarba, 2015/10/16
- [elpa] master ca3ec24 14/34: Fix temporary line breaks due to too long after-strings, Artur Malabarba, 2015/10/16
- [elpa] master c507480 13/34: Fix after-string overlays, Artur Malabarba, 2015/10/16
- [elpa] master 02112fa 12/34: Fix lighter, Artur Malabarba, 2015/10/16
- [elpa] master f1bb231 20/34: Fix scrolling outside command loop, Artur Malabarba, 2015/10/16