Skip to content

Commit ce05c1a

Browse files
gerdintbbatsov
authored andcommitted
Add mouse bindings and document them
1 parent e5d332e commit ce05c1a

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

cider-mode.el

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,11 +440,20 @@ If invoked with a prefix ARG eval the expression after inserting it."
440440
(declare-function cider-find-resource "cider-find")
441441
(declare-function cider-find-keyword "cider-find")
442442
(declare-function cider-find-var "cider-find")
443+
(declare-function cider-find-dwim-at-mouse "cider-find")
444+
445+
(defconst cider--has-many-mouse-buttons (not (memq window-system '(mac ns)))
446+
"Non-nil if system binds forward and back buttons to <mouse-8> and <mouse-9>.
447+
448+
As it stands Emacs fires these events on <mouse-8> and <mouse-9> on 'x' and
449+
'w32'systems while on macOS it presents them on <mouse-4> and <mouse-5>.")
443450

444451
(defconst cider-mode-map
445452
(let ((map (make-sparse-keymap)))
446453
(define-key map (kbd "C-c C-d") 'cider-doc-map)
447454
(define-key map (kbd "M-.") #'cider-find-var)
455+
(define-key map (kbd (if cider--has-many-mouse-buttons "<mouse-8>" "<mouse-4>")) #'xref-pop-marker-stack)
456+
(define-key map (kbd (if cider--has-many-mouse-buttons "<mouse-9>" "<mouse-5>")) #'cider-find-dwim-at-mouse)
448457
(define-key map (kbd "C-c C-.") #'cider-find-ns)
449458
(define-key map (kbd "C-c C-:") #'cider-find-keyword)
450459
(define-key map (kbd "M-,") #'cider-pop-back)

doc/interactive_programming.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ Here's a list of `cider-mode`'s keybindings:
6262
`cider-test-rerun-failed-tests` |<kbd>C-c C-t r</kbd> <br/> <kbd>C-c C-t C-r</kbd> | Re-run test failures/errors.
6363
`cider-test-show-report` |<kbd>C-c C-t b</kbd> <br/> <kbd>C-c C-t C-b</kbd> | Show the test report buffer.
6464
`cider-find-var` |<kbd>M-.</kbd> | Jump to the definition of a symbol. If invoked with a prefix argument, or no symbol is found at point, prompt for a symbol.
65+
`cider-find-dwim-at-mouse` |<kbd>mouse-5</kbd> or <kbd>mouse-9</kbd> | Jump to the definition of a symbol using mouse.
66+
`xref-pop-marker-stack` |<kbd>mouse-4</kbd> or <kbd>mouse-8</kbd> | Jump back to where `cider-find-dwim-at-mouse` was invoked.
6567
`cider-find-resource` |<kbd>C-c M-.</kbd> | Jump to the resource referenced by the string at point.
6668
`cider-find-ns` |<kbd>C-c C-.</kbd> | Jump to some namespace on the classpath.
6769
`cider-pop-back` |<kbd>M-,</kbd> | Return to your pre-jump location.

0 commit comments

Comments
 (0)