Function: def-cider-selector-method
def-cider-selector-method is a macro defined in cider-selector.el.
Signature
(def-cider-selector-method KEY DESCRIPTION &rest BODY)
Documentation
Define a new cider-select buffer selection method.
KEY is the key the user will enter to choose this method.
DESCRIPTION is a one-line sentence describing how the method selects a buffer.
BODY is a series of forms which are evaluated when the selector
is chosen. The returned buffer is selected with
switch-to-buffer.
Source Code
;; Defined in ~/.emacs.d/elpa/cider-20260414.1619/cider-selector.el
(defmacro def-cider-selector-method (key description &rest body)
"Define a new `cider-select' buffer selection method.
KEY is the key the user will enter to choose this method.
DESCRIPTION is a one-line sentence describing how the method
selects a buffer.
BODY is a series of forms which are evaluated when the selector
is chosen. The returned buffer is selected with
`switch-to-buffer'."
(declare (indent 1))
(let ((method `(lambda ()
(let ((buffer (progn ,@body)))
(cond ((not (and buffer (get-buffer buffer)))
(message "No such buffer: %S" buffer)
(ding))
((get-buffer-window buffer)
(select-window (get-buffer-window buffer)))
(cider-selector-other-window
(switch-to-buffer-other-window buffer))
(t
(switch-to-buffer buffer)))))))
`(setq cider-selector-methods
(sort (cons (list ,key ,description ,method)
(seq-remove (lambda (m) (eql ,key (car m))) cider-selector-methods))
(lambda (a b) (< (car a) (car b)))))))