Skip to content

Commit 33ab642

Browse files
committed
Do nothing on blank lines in cider-browse-ns
When the cursor is on the blank line and we try to operate on point we shouldn't do anything
1 parent d373cb1 commit 33ab642

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

cider-browse-ns.el

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
(defvar cider-browse-ns-mode-map
4646
(let ((map (make-sparse-keymap)))
4747
(set-keymap-parent map cider-popup-buffer-mode-map)
48-
(define-key map [return] #'cider-browse-ns-operate-on-point)
48+
(define-key map [return] #'cider-browse-ns-doc-at-point)
4949
(define-key map "^" #'cider-browse-ns-all)
5050
(define-key map "n" #'next-line)
5151
(define-key map "p" #'previous-line)
@@ -115,22 +115,21 @@
115115
names))
116116
(setq-local cider-browse-ns-current-ns nil))))
117117

118-
(defun cider-browse-ns-operate-on-point ()
118+
(defun cider-browse-ns--var-at-point ()
119+
(let ((line (buffer-substring-no-properties (line-beginning-position) (line-end-position))))
120+
(when (string-match " +\\(.+\\)" line)
121+
(format "%s/%s" cider-browse-ns-current-ns (match-string 1 line)))))
122+
123+
(defun cider-browse-ns-doc-at-point ()
119124
"Expand browser according to thing at current point."
120125
(interactive)
121-
(let ((line (buffer-substring-no-properties (line-beginning-position) (line-end-position))))
122-
(cond
123-
((= 1 (line-number-at-pos))
124-
'nothing-to-do)
125-
((string-match " +\\(.+\\)" line)
126-
(cider-doc-lookup (format "%s/%s" cider-browse-ns-current-ns (match-string 1 line))))
127-
(t
128-
(cider-browse-ns (replace-regexp-in-string " " "" line))))))
126+
(-when-let (var (cider-browse-ns--var-at-point))
127+
(cider-doc-lookup var)))
129128

130129
(defun cider-browse-ns-handle-mouse (event)
131130
"Handle mouse click EVENT."
132131
(interactive "e")
133-
(cider-browse-ns-operate-on-point))
132+
(cider-browse-ns-doc-at-point))
134133

135134
(provide 'cider-browse-ns)
136135

0 commit comments

Comments
 (0)