Function: flymake--tabulated-entries-1

flymake--tabulated-entries-1 is a byte-compiled function defined in flymake.el.gz.

Signature

(flymake--tabulated-entries-1 DIAGS PROJECT-ROOT)

Documentation

Helper for flymake--diagnostics-buffer-entries.

PROJECT-ROOT indicates that each entry should be preceded by the filename of the diagnostic relative to that directory.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/flymake.el.gz
(defun flymake--tabulated-entries-1 (diags project-root)
  "Helper for `flymake--diagnostics-buffer-entries'.
PROJECT-ROOT indicates that each entry should be preceded by the
filename of the diagnostic relative to that directory."
  (cl-loop
   for diag in diags
   for locus = (flymake-diagnostic-buffer diag)
   for file = (if (bufferp locus)
                  (buffer-file-name locus)
                locus)
   for overlay = (flymake--diag-overlay diag)
   for (line . col) =
   (cond (;; has live overlay, use overlay for position
          (and overlay (overlay-buffer overlay))
          (with-current-buffer (overlay-buffer overlay)
            (save-excursion
              (goto-char (overlay-start overlay))
              (cons (line-number-at-pos)
                    (- (point)
                       (line-beginning-position))))))
         (;; diagnostic not annotated, maybe foreign, check for cons
          (consp (flymake--diag-beg diag))
          (flymake--diag-beg diag))
         (;; may still be a valid foreign diagnostic
          (consp (flymake--diag-orig-beg diag))
          (flymake--diag-orig-beg diag))
         (;; somehow dead annotated diagnostic, ignore/give up
          t nil))
   for type = (flymake-diagnostic-type diag)
   for backend = (flymake-diagnostic-backend diag)
   for bname = (or (ignore-errors (symbol-name backend))
                   "(anonymous function)")
   for data-vec = `[,(format "%s" line)
                    ,(format "%s" col)
                    ,(propertize (format "%s"
                                         (flymake--lookup-type-property
                                          type 'flymake-type-name type))
                                 'face (flymake--lookup-type-property
                                        type 'mode-line-face 'flymake-error))
                    ,(propertize
                      (if bname
                          (replace-regexp-in-string "\\(.\\)[^-]+\\(-\\|$\\)"
                                                    "\\1\\2" bname)
                        "(anon)")
                      'help-echo (format "From `%s' backend" backend))
                    (,(flymake-diagnostic-oneliner diag t)
                     mouse-face highlight
                     help-echo "mouse-2: visit this diagnostic"
                     face nil
                     action flymake-goto-diagnostic
                     mouse-action flymake-goto-diagnostic)]
   when (and line col) collect
   (list (list :diagnostic diag
               :line line
               :severity (flymake--lookup-type-property
                          type
                          'severity (warning-numeric-level :error)))
         (if project-root
             (vconcat `[(,(file-name-nondirectory file)
                         help-echo ,(file-relative-name file project-root)
                         face nil
                         mouse-face highlight
                         action flymake-goto-diagnostic
                         mouse-action flymake-goto-diagnostic )]
                      data-vec)
           data-vec))))