You should be able to just do:

  (defun flymake-tip-get-diag-text-on-line ()
      "Return list of string of error/warning info on the current line."
      (cl-loop for diag in (flymake-diagnostics (point-at-bol) (point-at-eol))
               collect (flymake-diagnostic-text diag)))

If noone objects I shall push the patch to emacs-26 in a couple of days time.

Thanks Joao, there is no objection from me.
I'll try `flymake-diagnostic-XXX' stuff after you pushed.

Yuta Yamada

On Thu, Oct 19, 2017 at 4:36 AM, João Távora <joaotavora@gmail.com> wrote:
Yuta Yamada <sleepboy.zzz@gmail.com> writes:

> --- code:
> (defun flymake-tip-get-diag-text-on-line ()
>     "Return list of string of error/warning info on the current line."
>     (cl-loop for ov in (flymake--overlays :beg (point-at-bol) :end (point-at-eol))
>              collect (flymake--diag-text (overlay-get ov 'flymake--diagnostic))))
> ---
>
> As you can see, I used 1 (flymake--overlays), 2 (flymake--diag-text), 3 (flymake--diagnostic).
> So, I hope those functions/symbol become public API. (i mean "-"
> instead of "--")

Thanks,

The attached patch augments the API for these purposes (and describes it
in the manual).

You should be able to just do:

  (defun flymake-tip-get-diag-text-on-line ()
      "Return list of string of error/warning info on the current line."
      (cl-loop for diag in (flymake-diagnostics (point-at-bol) (point-at-eol))
               collect (flymake-diagnostic-text diag)))

If noone objects I shall push the patch to emacs-26 in a couple of days time.

João