branch: externals/objed commit c00014790426af610186a1e10a0b0b9f38358e86 Author: Clemens Radermacher <clem...@posteo.net> Commit: Clemens Radermacher <clem...@posteo.net>
Error when no next/prev object when using next/prev command --- objed-objects.el | 4 ++-- objed.el | 11 ++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/objed-objects.el b/objed-objects.el index 23af8b7..6465df1 100644 --- a/objed-objects.el +++ b/objed-objects.el @@ -2074,7 +2074,7 @@ non-nil the indentation block can contain empty lines." (goto-char (car bds)) (when (or (eq real-this-command #'objed-next-identifier) (eq real-this-command #'objed-goto-next-identifier)) - (run-at-time 0 nil (apply-partially #'message "Last one!")))))))) + (run-at-time 0 nil (apply-partially #'message "No next identifier")))))))) (defun objed--prev-identifier () "Move to previous identifier." @@ -2091,7 +2091,7 @@ non-nil the indentation block can contain empty lines." (goto-char (car bds)) (when (or (eq real-this-command #'objed-prev-identifier) (eq real-this-command #'objed-goto-prev-identifier)) - (run-at-time 0 nil (apply-partially #'message "First one!"))))))))) + (run-at-time 0 nil (apply-partially #'message "No previous identifier"))))))))) diff --git a/objed.el b/objed.el index c84bbb5..7df3b6f 100644 --- a/objed.el +++ b/objed.el @@ -1739,8 +1739,10 @@ postitive prefix argument ARG move to the nth previous object." (interactive "p") (if (objed--basic-p) (objed-context-object) - ;; toggle side if coming from next? - (objed--goto-previous (or arg 1)))) + (let ((pos (point))) + (objed--goto-previous (or arg 1)) + (when (eq pos (point)) + (error "No previous %s" objed--object))))) (defun objed-current-or-next-context (&optional arg) @@ -1756,7 +1758,10 @@ postitive prefix argument ARG move to the nth next object." (when (and (region-active-p) (eq last-command 'objed-extend)) (exchange-point-and-mark)) - (objed--goto-next (or arg 1)))) + (let ((pos (point))) + (objed--goto-next (or arg 1)) + (when (eq pos (point)) + (error "No next %s" objed--object))))) (defun objed-top-object () "Go to first instance of current object type."