Variable: cider-form-targeting

cider-form-targeting is a customizable variable defined in cider-util.el.

Value

smart

Documentation

How commands locate the form they operate on.

smart (the default) resolves the intended form from the cursor position: on an opening delimiter it targets the form it opens, on a closing delimiter the form it closes, inside an atom or string that atom, and otherwise the sexp preceding point.

preceding is the classic behavior shared with Emacs Lisp's eval-last-sexp and SLIME: the target is strictly the sexp before point, so point must sit right after the form. smart agrees with it at every position where the preceding sexp is well-defined and only differs where the classic answer was surprising (e.g. point sitting on a delimiter), but if your muscle memory says otherwise, this setting restores the old rules exactly.

Consulted by cider-eval-form, cider-macroexpand-1 and the rest of the commands that operate on the preceding sexp.

This variable was added, or its default value changed, in cider version 2.1.0.

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260822.1520/cider-util.el
(defcustom cider-form-targeting 'smart
  "How commands locate the form they operate on.

`smart' (the default) resolves the intended form from the cursor
position: on an opening delimiter it targets the form it opens, on a
closing delimiter the form it closes, inside an atom or string that
atom, and otherwise the sexp preceding point.

`preceding' is the classic behavior shared with Emacs Lisp's
`eval-last-sexp' and SLIME: the target is strictly the sexp before
point, so point must sit right after the form.  `smart' agrees with it
at every position where the preceding sexp is well-defined and only
differs where the classic answer was surprising (e.g. point sitting on
a delimiter), but if your muscle memory says otherwise, this setting
restores the old rules exactly.

Consulted by `cider-eval-form', `cider-macroexpand-1' and the rest
of the commands that operate on the preceding sexp."
  :group 'cider
  :type '(choice (const :tag "Smart: infer the form from the cursor position" smart)
                 (const :tag "Classic: the sexp preceding point" preceding))
  :package-version '(cider . "2.1.0"))