Function: cider--update-locals-for-region
cider--update-locals-for-region is a byte-compiled function defined in
cider-mode.el.
Signature
(cider--update-locals-for-region BEG END)
Documentation
Update the cider-locals text property for region from BEG to END.
Source Code
;; Defined in ~/.emacs.d/elpa/cider-20260414.1619/cider-mode.el
(defun cider--update-locals-for-region (beg end)
"Update the `cider-locals' text property for region from BEG to END."
(save-excursion
(goto-char beg)
;; If the inside of a `ns' form changed, reparse it from the start.
(when (and (not (bobp))
(get-text-property (1- (point)) 'cider-block-dynamic-font-lock))
(ignore-errors (beginning-of-defun-raw)))
(save-excursion
;; Move up until we reach a sexp that encloses the entire region (or
;; a top-level sexp), and set that as the new BEG.
(goto-char end)
(while (and (or (> (point) beg)
(not (eq (char-after) ?\()))
(condition-case nil
(progn (backward-up-list) t)
(scan-error nil)
;; In `clojure-ts-mode', when `backward-up-list' is used,
;; `user-error' is signaled instead of `scan-error' because
;; the operation is delegated to the `treesit-up-list'
;; function.
(user-error nil))))
(setq beg (min beg (point)))
;; If there are locals above the current sexp, reapply them to the
;; current sexp.
(let ((locals-above (when (> beg (point-min))
(get-text-property (1- beg) 'cider-locals))))
(condition-case nil
(clojure-forward-logical-sexp 1)
(error (goto-char end)))
(add-text-properties beg (point) `(cider-locals ,locals-above))
;; Extend the region being font-locked to include whole sexps.
(setq end (max end (point)))
(goto-char beg)
(ignore-errors
(cider--parse-and-apply-locals end locals-above))))))