Skip to content

Commit 9685f8f

Browse files
xiongtxbbatsov
authored andcommitted
Fix spec browser movement commands
Prevent `(wrong-type-argument integer-or-marker-p ...)` errors.
1 parent 4831a0c commit 9685f8f

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

cider-browse-spec.el

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -289,16 +289,20 @@ a more user friendly representation of SPEC-FORM."
289289
(defun cider-browse-spec--next-spec ()
290290
"Move to the next spec in the buffer."
291291
(interactive)
292-
(goto-char (next-single-property-change (point) 'spec-name))
293-
(unless (get-text-property (point) 'spec-name)
294-
(goto-char (next-single-property-change (point) 'spec-name))))
292+
(when-let ((pos (next-single-property-change (point) 'spec-name)))
293+
(if (get-text-property (point) 'spec-name)
294+
(when-let ((next-pos (next-single-property-change pos 'spec-name)))
295+
(goto-char next-pos))
296+
(goto-char pos))))
295297

296298
(defun cider-browse-spec--prev-spec ()
297299
"Move to the previous spec in the buffer."
298300
(interactive)
299-
(goto-char (previous-single-property-change (point) 'spec-name))
300-
(unless (get-text-property (point) 'spec-name)
301-
(goto-char (previous-single-property-change (point) 'spec-name))))
301+
(when-let ((pos (previous-single-property-change (point) 'spec-name)))
302+
(if (get-text-property (point) 'spec-name)
303+
(when-let ((prev-pos (previous-single-property-change pos 'spec-name)))
304+
(goto-char prev-pos))
305+
(goto-char pos))))
302306

303307
(defun cider-browse-spec--print-curr-spec-example ()
304308
"Generate and print an example of the current spec."

0 commit comments

Comments
 (0)