diff --git a/Readme.org b/Readme.org index 50631c8..6d5658a 100644 --- a/Readme.org +++ b/Readme.org @@ -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) @@ -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. diff --git a/beacon.el b/beacon.el index 16b70f3..5b423a0 100644 --- a/beacon.el +++ b/beacon.el @@ -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))) @@ -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 @@ -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)