summaryrefslogtreecommitdiff
path: root/cider-browse-spec.el
diff options
context:
space:
mode:
authorTianxiang Xiong <tianxiang.xiong@gmail.com>2017-07-17 21:57:24 -0700
committerBozhidar Batsov <bozhidar.batsov@gmail.com>2017-07-19 07:53:22 +0300
commit9685f8fd34b2ef7034076e39891b3f1efbae98be (patch)
tree1a0d4ce4d9764283bc73cb906025ebb9bec7b04a /cider-browse-spec.el
parent4831a0c10030e754c8fb8df1de51739e1b0508d4 (diff)
Fix spec browser movement commands
Prevent `(wrong-type-argument integer-or-marker-p ...)` errors.
Diffstat (limited to 'cider-browse-spec.el')
-rw-r--r--cider-browse-spec.el16
1 files changed, 10 insertions, 6 deletions
diff --git a/cider-browse-spec.el b/cider-browse-spec.el
index 1bbca13a..5b92fa67 100644
--- a/cider-browse-spec.el
+++ b/cider-browse-spec.el
@@ -289,16 +289,20 @@ a more user friendly representation of SPEC-FORM."
(defun cider-browse-spec--next-spec ()
"Move to the next spec in the buffer."
(interactive)
- (goto-char (next-single-property-change (point) 'spec-name))
- (unless (get-text-property (point) 'spec-name)
- (goto-char (next-single-property-change (point) 'spec-name))))
+ (when-let ((pos (next-single-property-change (point) 'spec-name)))
+ (if (get-text-property (point) 'spec-name)
+ (when-let ((next-pos (next-single-property-change pos 'spec-name)))
+ (goto-char next-pos))
+ (goto-char pos))))
(defun cider-browse-spec--prev-spec ()
"Move to the previous spec in the buffer."
(interactive)
- (goto-char (previous-single-property-change (point) 'spec-name))
- (unless (get-text-property (point) 'spec-name)
- (goto-char (previous-single-property-change (point) 'spec-name))))
+ (when-let ((pos (previous-single-property-change (point) 'spec-name)))
+ (if (get-text-property (point) 'spec-name)
+ (when-let ((prev-pos (previous-single-property-change pos 'spec-name)))
+ (goto-char prev-pos))
+ (goto-char pos))))
(defun cider-browse-spec--print-curr-spec-example ()
"Generate and print an example of the current spec."