diff options
-rw-r--r-- | lisp/km-diff.el | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/lisp/km-diff.el b/lisp/km-diff.el index 19afba9..73a2424 100644 --- a/lisp/km-diff.el +++ b/lisp/km-diff.el @@ -188,13 +188,16 @@ If N is negative, move backward instead." (letrec ((move (lambda (n) (let ((bounds (km/diff-review--comment-bounds))) - (when bounds - (goto-char (funcall bound-fn bounds))) - (funcall search-fn "^:" nil t) - (if (= n 0) - (goto-char (car bounds)) - (funcall move - (funcall incr-func n))))))) + (cond ((and (= n 0) bounds) + (goto-char (car bounds))) + ((/= n 0) + (when bounds + (goto-char (funcall bound-fn bounds))) + (and (funcall search-fn "^:" nil t) + (funcall move + (funcall incr-func n)))) + (t + (error "Error in movement logic"))))))) (funcall move n))))) (defun km/diff-review-previous-comment (&optional n) |