Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions Readme.org
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#+TITLE: Beacon --- Never lose your cursor again

I forked and updated this as multiple functionalities of the package were not
working out of the box. I fixed issues on for running on M1 macs where the
cursor wouldn't blink for vertical movements or window changes. This repository
is not in ELPA or MELPA and would require installing this locally.

This is a global minor-mode. Turn it on everywhere with:
#+BEGIN_SRC emacs-lisp
(beacon-mode 1)
Expand Down Expand Up @@ -35,7 +40,8 @@ That’s it.
distance. For this, configure ~beacon-push-mark~.

** Contributors

- [[https://github.com/tsdh][Tassilo Horn]]
- [[https://www.github.com/antonhibl][Anton Hibl]]

If you’d like to help too, just open a PR.
If you’d like to help too, just open a PR or a fork.
24 changes: 18 additions & 6 deletions beacon.el
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,10 @@ The same is true for DELTA-X and horizonta movement."
(push-mark beacon--previous-place 'silent)))))

(defun beacon--post-command ()
"Blink if point moved very far."
"Check if point has moved far and call `beacon-blink-automated'.

The distance is determined by values of `beacon-blink-when-buffer-changes',
`beacon-blink-when-window-changes', `beacon-blink-when-point-moves-vertically'"
(cond
;; Sanity check.
((not (markerp beacon--previous-place)))
Expand All @@ -431,12 +434,22 @@ The same is true for DELTA-X and horizonta movement."
(equal beacon--window-scrolled (selected-window)))
(beacon-blink-automated))
;; Blink for movement
((beacon--movement-> beacon-blink-when-point-moves-vertically
beacon-blink-when-point-moves-horizontally)
((or (beacon--movement-> beacon-blink-when-point-moves-vertically
beacon-blink-when-point-moves-horizontally)
(and beacon-blink-when-point-moves-vertically
(beacon--vertical-movement->)))
(beacon-blink-automated)))
(beacon--maybe-push-mark)
(setq beacon--window-scrolled nil))

(defun beacon--vertical-movement-> ()
"Check if point has moved vertically.

Compares line numbers of previous and current position."
(let ((previous-line (line-number-at-pos beacon--previous-place))
(current-line (line-number-at-pos (point))))
(not (equal previous-line current-line))))

(defun beacon--window-scroll-function (window start-pos)
"Blink the beacon or record that WINDOW has been scrolled.
If invoked during the command loop, record the current window so
Expand All @@ -459,12 +472,11 @@ unreliable, so just blink immediately."
(when beacon-blink-when-focused
(beacon-blink-automated)))


;;; Minor-mode
(defcustom beacon-lighter
(cond
;; ((char-displayable-p ?💡) " 💡")
;; ((char-displayable-p ?Λ) " Λ")
;;((char-displayable-p ?💡) " 💡")
;;((char-displayable-p ?Λ) " Λ")
(t " (*)"))
"Lighter string used on the mode-line."
:type 'string)
Expand Down