[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/focus ef5f7fc892 45/82: Cleaned up `focus-next-thing' and
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/focus ef5f7fc892 45/82: Cleaned up `focus-next-thing' and `focus-prev-thing' |
Date: |
Tue, 6 Sep 2022 04:58:57 -0400 (EDT) |
branch: elpa/focus
commit ef5f7fc892f47c83812cdc3f7970991c260f7176
Author: Lars Tveito <larstvei@ifi.uio.no>
Commit: Lars Tveito <larstvei@ifi.uio.no>
Cleaned up `focus-next-thing' and `focus-prev-thing'
---
focus.el | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/focus.el b/focus.el
index 31e4b2b53c..daae08220d 100644
--- a/focus.el
+++ b/focus.el
@@ -162,19 +162,26 @@ deleted, and `focus-move-focus' is removed from
`post-command-hook'."
(progn (mapc 'delete-overlay (list focus-pre-overlay focus-post-overlay))
(remove-hook 'post-command-hook 'focus-move-focus t)))
+(defun focus-goto-thing (bounds)
+ "Move point to the middle of BOUNDS."
+ (when bounds
+ (goto-char (/ (+ (car bounds) (cdr bounds)) 2))
+ (recenter nil)))
+
(defun focus-next-thing (&optional n)
"Moves the point to the middle of the Nth next thing."
(interactive "p")
- (forward-thing (focus-get-thing) (+ 1 n))
- (let ((bounds (focus-bounds)))
- (when bounds
- (goto-char (/ (+ (car bounds) (cdr bounds)) 2))
- (recenter nil))))
+ (let ((current-bounds (focus-bounds))
+ (thing (focus-get-thing)))
+ (forward-thing thing n)
+ (when (equal current-bounds (focus-bounds))
+ (forward-thing thing (signum n)))
+ (focus-goto-thing (focus-bounds))))
(defun focus-prev-thing (&optional n)
"Moves the point to the middle of the Nth previous thing."
(interactive "p")
- (focus-next-thing (- (+ 2 n))))
+ (focus-next-thing (- n)))
(defun focus-read-only-hide-cursor (&optional buffer)
"Hide the cursor.
@@ -182,8 +189,8 @@ This function is triggered by the
`focus-read-only-blink-timer',
when `focus-read-only-mode' is activated."
(with-current-buffer (or buffer (current-buffer))
(when (and focus-read-only-mode (not (null focus-read-only-blink-timer)))
- (setq focus-read-only-blink-timer nil)
- (setq cursor-type nil))))
+ (setq focus-read-only-blink-timer nil)
+ (setq cursor-type nil))))
(defun focus-read-only-cursor-blink ()
"Make the cursor visible for `focus-read-only-blink-seconds'.
- [nongnu] elpa/focus 5bddbbb7d3 22/82: Remove newline, (continued)
- [nongnu] elpa/focus 5bddbbb7d3 22/82: Remove newline, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus cfb1672fca 76/82: Merge pull request #22 from larstvei/focus-face, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus ffd97a5a36 56/82: Fix bug related to `post-command-hook`, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 045ee6175e 63/82: Remove focus-any and simply apply derived-mode-p, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 0f2a9945e9 66/82: Fixed some flycheck warnings., ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 1423efbd25 42/82: Don't assume bounds are found, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 19b3c7b348 70/82: Just use a face for customizing the unfocused region, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus bfb6aaf8ad 57/82: Don't persist focus mode across major mode change, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus a84ade00a2 61/82: Addresses #13, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus f193014150 15/82: Did not work, back to static width, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus ef5f7fc892 45/82: Cleaned up `focus-next-thing' and `focus-prev-thing',
ELPA Syncer <=
- [nongnu] elpa/focus e9e841aed4 78/82: Remove sentence, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus f058bd163d 64/82: Fixed compile warnings., ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 5f3f20e7f2 80/82: Bump version, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 155da77a32 60/82: Fixes #14, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus cbba87b062 74/82: Trim candidate list of *things*, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 0a6e9624ea 49/82: Allow for changing the current thing interactively, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 90806dc7ea 18/82: Added custom variable for setting dimness, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 704db49988 82/82: Merge pull request #24 from phikal/master, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus c89d08f510 24/82: Applied purcell's recommendations, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 94ed8ab68b 36/82: Defined variables to help hide the cursor, ELPA Syncer, 2022/09/06