Function: eca-chat-eldoc-function

eca-chat-eldoc-function is a natively compiled function defined in eca-chat-context.el.

Signature

(eca-chat-eldoc-function CB &rest IGNORED)

Documentation

Eldoc function to show details of context and prompt in eldoc.

Calls CB with the resulting message.

Source Code

;; Defined in /nix/store/jklqzw6pzz6j4jrbv8wy0iwgi7jlrbld-emacs-packages-deps/share/emacs/site-lisp/elpa/eca-20260928.1827/eca-chat-context.el
;;;; Eldoc function

(defun eca-chat-eldoc-function (cb &rest _ignored)
  "Eldoc function to show details of context and prompt in eldoc.
Calls CB with the resulting message."
  (cond
   ;; Task eldoc: show description and blocked-by
   ((when-let* ((task (get-text-property (point) 'eca-chat-task)))
      (let* ((subject (plist-get task :subject))
             (description (plist-get task :description))
             (blocked-by (append (plist-get task :blockedBy) nil))
             (blocked-subjects
              (when blocked-by
                (mapcar (lambda (id)
                          (if-let* ((tk (eca-chat--task-find-by-id id)))
                              (plist-get tk :subject)
                            (format "#%s" id)))
                        blocked-by)))
             (doc (concat
                   (propertize subject 'face 'bold)
                   (when description
                     (concat "\n" description))
                   (when blocked-subjects
                     (concat "\n"
                             (propertize "Blocked by: " 'face 'font-lock-keyword-face)
                             (string-join blocked-subjects ", "))))))
        (funcall cb doc)
        t)))
   ;; Context/filepath eldoc
   ((when-let ((item-type (get-text-property (point) 'eca-chat-item-type)))
      (when-let ((item-str (get-text-property (point) 'eca-chat-expanded-item-str)))
        (when-let ((face (get-text-property (point) 'font-lock-face)))
          (funcall cb (concat (format "%s: %s"
                                      (pcase item-type
                                        ('context "Context")
                                        ('filepath "Filepath"))
                                      (propertize item-str 'face face))
                              (when (get-text-property (point) 'eca-chat-image-path)
                                " (RET: toggle thumbnail)")))
          t))))
   ;; Image mentions of sent messages
   ((when-let* ((path (get-text-property (point) 'eca-chat-image-path)))
      (funcall cb (concat "Image: " (abbreviate-file-name path)
                          " (RET: toggle thumbnail)"))
      t))))