Added functions for jumping between things

This commit is contained in:
Lars Tveito 2015-05-24 01:56:36 +02:00
parent cd2aad5590
commit 497d13d758

View File

@ -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."