branch: externals/do-at-point
commit acb156f090724d4d773efb97d3ef8031c4a35c3e
Author: Philip Kaludercic <phil...@posteo.net>
Commit: Philip Kaludercic <phil...@posteo.net>

    Ensure do-at-point-{forward,backward} always moves
---
 do-at-point.el | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/do-at-point.el b/do-at-point.el
index 909bdc139a..25bad6f61e 100644
--- a/do-at-point.el
+++ b/do-at-point.el
@@ -326,13 +326,20 @@ instead."
   "Move focus N things ahead.
 By default, this will move one thing ahead."
   (interactive "p")
-  (forward-thing (overlay-get do-at-point--overlay 'do-at-point-thing) n))
+  (when (and do-at-point--overlay
+             (overlay-end do-at-point--overlay))
+    (goto-char (overlay-end do-at-point--overlay))
+    (forward-thing (overlay-get do-at-point--overlay 'do-at-point-thing) n)))
 
 (defun do-at-point-backward (n)
   "Move focus N things back.
 Refer to the command `do-at-point-forward' for more details."
   (interactive "p")
-  (do-at-point-forward (- (or n 1))))
+  (when (and do-at-point--overlay
+             (overlay-start do-at-point--overlay))
+    (goto-char (overlay-start do-at-point--overlay))
+    (forward-thing (overlay-get do-at-point--overlay 'do-at-point-thing)
+                   (- (or n 1)))))
 
 ;;;###autoload
 (defun do-at-point (&optional thing)

Reply via email to