Function: cider--find-last-error-location

cider--find-last-error-location is a byte-compiled function defined in cider-eval.el.

Signature

(cider--find-last-error-location ERROR-INFO)

Documentation

Return the location (begin end buffer) from the parsed ERROR-INFO.

If location could not be found, return nil.

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260414.1619/cider-eval.el
(defun cider--find-last-error-location (error-info)
  "Return the location (begin end buffer) from the parsed ERROR-INFO.
If location could not be found, return nil."
  (save-excursion
    (when error-info
      (let ((file (nth 0 error-info))
            (line (nth 1 error-info))
            (col (nth 2 error-info)))
        (unless (or (not (stringp file))
                    (cider--tooling-file-p file))
          (when-let* ((buffer (cider-find-file file)))
            (with-current-buffer buffer
              (save-excursion
                (save-restriction
                  (widen)
                  (goto-char (point-min))
                  (forward-line (1- line))
                  (move-to-column (or col 0))
                  ;; if this condition is false, it means that `col` was a spuriously large value,
                  ;; therefore the whole calculation should be discarded:
                  (when (or (not col) ;; if there's no col info, we cannot judge if it's spurious/not
                            ;; (current-column) never goes past the last column in the actual line,
                            ;; so if it's <, then the message had spurious info:
                            (>= (1+ (current-column))
                                col))
                    (let ((begin (progn (if col (cider--goto-expression-start) (back-to-indentation))
                                        (point)))
                          (end (progn (if col (forward-list) (move-end-of-line nil))
                                      (point))))
                      (list begin end buffer))))))))))))