Function: cider--display-interactive-eval-result

cider--display-interactive-eval-result is a byte-compiled function defined in cider-overlays.el.

Signature

(cider--display-interactive-eval-result VALUE VALUE-TYPE &optional POINT OVERLAY-FACE)

Documentation

Display the result VALUE of an interactive eval operation.

VALUE is syntax-highlighted and displayed in the echo area. VALUE-TYPE is one of: value, error. OVERLAY-FACE is the face applied to the overlay, which defaults to cider-result-overlay-face if nil. If POINT and cider-use-overlays are non-nil, it is also displayed in an overlay at the end of the line containing POINT. Note that, while POINT can be a number, it's preferable to be a marker, as that will better handle some corner cases where the original buffer is not focused.

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260414.1619/cider-overlays.el
;;; Displaying eval result
(defun cider--display-interactive-eval-result (value value-type &optional point overlay-face)
  "Display the result VALUE of an interactive eval operation.
VALUE is syntax-highlighted and displayed in the echo area.
VALUE-TYPE is one of: `value', `error'.
OVERLAY-FACE is the face applied to the overlay, which defaults to
`cider-result-overlay-face' if nil.
If POINT and `cider-use-overlays' are non-nil, it is also displayed in an
overlay at the end of the line containing POINT.
Note that, while POINT can be a number, it's preferable to be a marker, as
that will better handle some corner cases where the original buffer is not
focused."
  (cl-assert (symbolp value-type)) ;; We assert because for avoiding confusion with the optional args.
  (let* ((value (string-trim-right value))
         (font-value (if cider-result-use-clojure-font-lock
                         (cider-font-lock-as-clojure value)
                       value))
         (used-overlay (when (and point
                                  cider-use-overlays
                                  (if (equal 'error value-type)
                                      t
                                    (not (equal 'errors-only cider-use-overlays))))
                         (cider--make-result-overlay font-value
                           :where point
                           :duration cider-eval-result-duration
                           :prepend-face (or overlay-face 'cider-result-overlay-face))))
         (msg (format "%s%s" cider-eval-result-prefix font-value))
         (max-msg-length (* (floor (* (frame-height) max-mini-window-height))
                            (frame-width)))
         (msg (if (> (string-width msg) max-msg-length)
                  (format "%s..." (substring msg 0 (- max-msg-length 3)))
                msg)))
    (message
     "%s"
     (propertize msg
                 ;; The following hides the message from the echo-area, but
                 ;; displays it in the Messages buffer. We only hide the message
                 ;; if the user wants to AND if the overlay succeeded.
                 'invisible (and used-overlay
                                 (not (eq cider-use-overlays 'both)))))))