emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/focus 497d13d758 32/82: Added functions for jumping betwee


From: ELPA Syncer
Subject: [nongnu] elpa/focus 497d13d758 32/82: Added functions for jumping between things
Date: Tue, 6 Sep 2022 04:58:56 -0400 (EDT)

branch: elpa/focus
commit 497d13d758c428c06499e681e83b71aac81aead8
Author: Lars Tveito <larstvei@ifi.uio.no>
Commit: Lars Tveito <larstvei@ifi.uio.no>

    Added functions for jumping between things
---
 focus.el | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/focus.el b/focus.el
index 1d31acccea..32d409389a 100644
--- a/focus.el
+++ b/focus.el
@@ -145,6 +145,18 @@ 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-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)))
+    (goto-char (/ (+ (car bounds) (cdr bounds)) 2)))
+  (recenter nil))
+
+(defun focus-prev-thing (&optional n)
+  "Moves the point to the middle of the Nth previous thing."
+  (interactive "p")
+  (focus-next-thing (- (+ 2 n))))
 ;;;###autoload
 (define-minor-mode focus-mode
   "Dim the font color of text in surrounding sections."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]