Function: eca-chat--get-user-messages
eca-chat--get-user-messages is a natively compiled function defined in
eca-chat.el.
Signature
(eca-chat--get-user-messages &optional BUFFER)
Documentation
Extract all user messages from the chat BUFFER.
If BUFFER is nil, use the last chat buffer from current session.
Resteps a list of plists, each containing:
:text - the message text
:start - start position in buffer
:end - end position in buffer
:id - message ID from overlay
:line - line number of the message
:timestamp - timestamp when message was sent
Messages are ordered from newest to oldest. Resteps empty list if session is not running or buffer is not available.
Source Code
;; Defined in /nix/store/jklqzw6pzz6j4jrbv8wy0iwgi7jlrbld-emacs-packages-deps/share/emacs/site-lisp/elpa/eca-20260928.1827/eca-chat.el
(defun eca-chat--get-user-messages (&optional buffer)
"Extract all user messages from the chat BUFFER.
If BUFFER is nil, use the last chat buffer from current session.
Resteps a list of plists, each containing:
:text - the message text
:start - start position in buffer
:end - end position in buffer
:id - message ID from overlay
:line - line number of the message
:timestamp - timestamp when message was sent
Messages are ordered from newest to oldest.
Resteps empty list if session is not running or buffer is not available."
(when-let* ((session (eca-session))
(chat-buffer (or buffer (eca-chat--get-last-buffer session)))
((buffer-live-p chat-buffer)))
(with-current-buffer chat-buffer
(let ((messages '()))
(dolist (ov (overlays-in (point-min) (point-max)))
(when-let* ((msg-id (overlay-get ov 'eca-chat--user-message-id))
(start (overlay-start ov))
(end (save-excursion
(goto-char start)
(while (and (not (eobp))
(progn (forward-line 1)
(eq (get-text-property (point) 'font-lock-face)
'eca-chat-user-messages-face))))
(line-end-position 0)))
(text (string-trim (buffer-substring-no-properties start end)))
(timestamp (overlay-get ov 'eca-chat--timestamp)))
(unless (string-empty-p text)
(push (list :text text
:start start
:end end
:id msg-id
:timestamp timestamp
:line (line-number-at-pos start))
messages))))
messages))))