Skip to content

Commit

Permalink
Don't move to bob/eob if wrapping enabled and no matches
Browse files Browse the repository at this point in the history
Closes #67.
  • Loading branch information
tarsius committed Mar 23, 2022
1 parent e0ba3e1 commit c0f0555
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions hl-todo.el
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,12 @@ A negative argument means move backward that many keywords."
(user-error "No more matches")))))
(cl-decf arg))
(when (> arg 0)
(goto-char (point-min))
(let ((hl-todo-wrap-movement nil))
(hl-todo-next arg)))))
(let ((pos (save-excursion
(goto-char (point-min))
(let ((hl-todo-wrap-movement nil))
(hl-todo-next arg))
(point))))
(goto-char pos)))))

;;;###autoload
(defun hl-todo-previous (arg)
Expand All @@ -320,9 +323,12 @@ A negative argument means move forward that many keywords."
(goto-char (match-end 0))
(cl-decf arg))
(when (> arg 0)
(goto-char (point-max))
(let ((hl-todo-wrap-movement nil))
(hl-todo-previous arg)))))
(let ((pos (save-excursion
(goto-char (point-max))
(let ((hl-todo-wrap-movement nil))
(hl-todo-previous arg))
(point))))
(goto-char pos)))))

;;;###autoload
(defun hl-todo-occur ()
Expand Down

0 comments on commit c0f0555

Please sign in to comment.