unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: joaotavora@gmail.com (João Távora)
To: Da Zhang <zhangda82@gmail.com>
Cc: 31270@debbugs.gnu.org
Subject: bug#31270: 26.1; Emacs 26.1 RC1 -- flymake-err-info is no longer available
Date: Thu, 26 Apr 2018 10:25:50 +0100	[thread overview]
Message-ID: <87muxq1fq9.fsf@gmail.com> (raw)
In-Reply-To: <51aff540-e37b-e590-a125-b9ce87366a14@gmail.com> (Da Zhang's message of "Thu, 26 Apr 2018 01:35:15 -0400")

Da Zhang <zhangda82@gmail.com> writes:

> Hello --
>
> I am a long term Emacs user and I use flymake together with flymake-cursor on a daily basis.
>
> Starting Emacs 26.1, I noticed that flyamke was redesigned and no
> longer has the var flymake-err-info that contains the error info
> reported by the backend syntax checker.
>
> This makes flymake-cursor and code like the following not work:
>
> (defun elpy-flymake-error-at-point ()
>   "Return the flymake error at point, or nil if there is none."
>   (when (boundp 'flymake-err-info)
>     (let* ((lineno (line-number-at-pos))
>            (err-info (car (flymake-find-err-info flymake-err-info
>                                                  lineno))))
>       (when err-info
>         (mapconcat #'flymake-ler-text
>                    err-info
>                    ", ")))))
>
> I believe this is a potential issue and wonder if someone could direct
> me to any alternatives to flymake-err-info in the newly designed
> flyamke.

Hi Da Zhang,

I'm the responsible for the redesign. Although I tried to keep *some*
backward compatibility to old flymake.el's API, the truth is that *all*
of it was an API.

The bad news is that this variable is gone: it couldn't be
backward-adapted. The good news is that it should be much easier to
write your function:

(defun elpy-flymake-error-at-point ()
  "Return the flymake error at point, or nil if there is none."
  (mapconcat #'flymake-diagnostic-text (flymake-diagnostics (point)) "\n"))

Notice that, to keep with the protocol, this returns a concatenation of
the text strings of all the errors at point. You might be better served
by returning and manipulating the objects returned by
flymake-diagnostics instead.

See section "2.2.1 Flymake utility functions" of the Flymake manual
bundled with Emacs for more information.

I don't know what flymake-cursor does, but I suspect it can be fixed
accordingly.

Hope this helps,
João













  reply	other threads:[~2018-04-26  9:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-26  5:35 bug#31270: 26.1; Emacs 26.1 RC1 -- flymake-err-info is no longer available Da Zhang
2018-04-26  9:25 ` João Távora [this message]
2018-04-26 15:14   ` Da Zhang
2018-04-26 16:26     ` João Távora
2018-04-27 13:35   ` Da Zhang
2018-04-27 13:45     ` João Távora
2018-04-27 13:47       ` Da Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87muxq1fq9.fsf@gmail.com \
    --to=joaotavora@gmail.com \
    --cc=31270@debbugs.gnu.org \
    --cc=zhangda82@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).