Function: eca-chat--refresh-code-copy-scopes

eca-chat--refresh-code-copy-scopes is a natively compiled function defined in eca-chat.el.

Signature

(eca-chat--refresh-code-copy-scopes &optional FROM TO)

Documentation

Refresh copy scopes for fenced code blocks between FROM and TO.

Source Code

;; Defined in /nix/store/jklqzw6pzz6j4jrbv8wy0iwgi7jlrbld-emacs-packages-deps/share/emacs/site-lisp/elpa/eca-20260928.1827/eca-chat.el
(defun eca-chat--refresh-code-copy-scopes (&optional from to)
  "Refresh copy scopes for fenced code blocks between FROM and TO."
  (let* ((start (or from (point-min)))
         (end (or to (point-max)))
         (limit (copy-marker end)))
    (remove-overlays start end 'eca-chat--code-copy-scope t)
    (save-excursion
      (goto-char start)
      (while (re-search-forward "^[ \t]*\\(``+\\|~~+\\).*$" limit t)
        (let* ((open-start (line-beginning-position))
               (fence (match-string-no-properties 1))
               (body-start (copy-marker (1+ (line-end-position)) t))
               (close-regexp (eca-chat--code-fence-close-regexp fence)))
          (when (re-search-forward close-regexp limit t)
            (eca-chat--make-copy-scope
             open-start (line-end-position) 'code
             'eca-chat--code-copy-scope
             'eca-chat--copy-start body-start
             'eca-chat--copy-end (copy-marker (match-beginning 0)))))))
    (set-marker limit nil)))