Function: eca-chat--get-expandable-content

eca-chat--get-expandable-content is a natively compiled function defined in eca-chat-expandable.el.

Signature

(eca-chat--get-expandable-content ID)

Documentation

Return the overlay if there is a expandable content for ID.

Uses eca-chat-expandable--id->ov for an O(1) hit; on miss or stale entry, falls back to the historical linear scan and refills the cache.

Source Code

;; Defined in /nix/store/jklqzw6pzz6j4jrbv8wy0iwgi7jlrbld-emacs-packages-deps/share/emacs/site-lisp/elpa/eca-20260928.1827/eca-chat-expandable.el
(defun eca-chat--get-expandable-content (id)
  "Return the overlay if there is a expandable content for ID.
Uses `eca-chat-expandable--id->ov' for an O(1) hit; on miss or
stale entry, falls back to the historical linear scan and
refills the cache."
  (or (let ((ov (gethash id eca-chat-expandable--id->ov)))
        (when (and (overlayp ov)
                   (overlay-buffer ov)
                   (eq (overlay-buffer ov) (current-buffer))
                   (equal id (overlay-get ov 'eca-chat--expandable-content-id)))
          ov))
      (when-let* ((ov (-first (-lambda (ov)
                                (string= id (overlay-get ov 'eca-chat--expandable-content-id)))
                              (overlays-in (point-min) (point-max)))))
        (puthash id ov eca-chat-expandable--id->ov)
        ov)))