From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Da Zhang Newsgroups: gmane.emacs.bugs Subject: bug#31270: 26.1; Emacs 26.1 RC1 -- flymake-err-info is no longer available Date: Fri, 27 Apr 2018 09:47:31 -0400 Message-ID: <07052f18-8067-575a-fe74-f5afd5245fd1@gmail.com> References: <51aff540-e37b-e590-a125-b9ce87366a14@gmail.com> <87muxq1fq9.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1524836776 19104 195.159.176.226 (27 Apr 2018 13:46:16 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 27 Apr 2018 13:46:16 +0000 (UTC) User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 Cc: Jorgen.Schaefer@gmail.com, 31270@debbugs.gnu.org To: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Apr 27 15:46:11 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fC3hS-0004rq-Pr for geb-bug-gnu-emacs@m.gmane.org; Fri, 27 Apr 2018 15:46:11 +0200 Original-Received: from localhost ([::1]:48215 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fC3jZ-0005XV-Kj for geb-bug-gnu-emacs@m.gmane.org; Fri, 27 Apr 2018 09:48:21 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59818) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fC3jK-0005WC-GA for bug-gnu-emacs@gnu.org; Fri, 27 Apr 2018 09:48:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fC3jG-0007AX-Hc for bug-gnu-emacs@gnu.org; Fri, 27 Apr 2018 09:48:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:33149) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fC3jG-0007AS-D8 for bug-gnu-emacs@gnu.org; Fri, 27 Apr 2018 09:48:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fC3jG-0003OM-68 for bug-gnu-emacs@gnu.org; Fri, 27 Apr 2018 09:48:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Da Zhang Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 27 Apr 2018 13:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 31270 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: notabug Original-Received: via spool by 31270-submit@debbugs.gnu.org id=B31270.152483686013006 (code B ref 31270); Fri, 27 Apr 2018 13:48:02 +0000 Original-Received: (at 31270) by debbugs.gnu.org; 27 Apr 2018 13:47:40 +0000 Original-Received: from localhost ([127.0.0.1]:41046 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fC3iu-0003Ni-6j for submit@debbugs.gnu.org; Fri, 27 Apr 2018 09:47:40 -0400 Original-Received: from mail-qt0-f173.google.com ([209.85.216.173]:34352) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fC3is-0003NU-8p for 31270@debbugs.gnu.org; Fri, 27 Apr 2018 09:47:38 -0400 Original-Received: by mail-qt0-f173.google.com with SMTP id m5-v6so2300213qti.1 for <31270@debbugs.gnu.org>; Fri, 27 Apr 2018 06:47:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=aiMvlrqBSxfgcRy4iDRa0vlg+/yShjMEO/IeYg9DxNE=; b=KjD3/0cosrCoFSflAKwfJ11azQZPJ4Ow768aIOGFT9GHB1Oa62OcCrBWDVzloqlX3x rGTryTSVxZSEry0PSNhsjggOhoiXCoQubDGTQipSQQoYW6zvD0/I/ch2ztWSm2Q0o1cg aTeHpwdsc85p5tpHvbyLq45SD1SCqPEdTqTmuTKfxnExkayXyYN837YLL49yyQvUzaOU LWE/G/GGK+0t5XYupUscXZoAo4G/Q9mwV3a4cV1GtS6BnWCs5rvsKx6bE1tDL2DQT6wO D78FvjnK2Ver+7DMkSzxhDXvXx1aArJMRAAeCLVIzO6S8YG0zbFm7CDxJZKYxbgvFIMM rgew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=aiMvlrqBSxfgcRy4iDRa0vlg+/yShjMEO/IeYg9DxNE=; b=JREWuax5znjoPzg+8hxoTF88Iq76Eqo2Af8Fk08v28jXlm18owye14vJgo42LyMrpF T7YE1RVL5Qn/1Pzn0hsjDqhAOlWeXVuLoGwPwL6V1vHjes0fkoSamg4br88924cgAb9i tA1N7DKiz231upEmACTIy+d2AJrMwJYk+tqSXTJpgzMDe3jTPZzgJnoYdp/wjV7SeicW SEXmzeoAhkIt+dunaXf38l23pP7aROJtlaQpRcolvPRDqkXMSUY6CVh3Sx6MEeUWmm2R QnWIjphZwoAQG8oKv5VuxcgKfyOUMZFRfD6P4S1nE9HiQ75gTWB5XRpsmK4RXnIDcoGm bmkg== X-Gm-Message-State: ALQs6tAowDlQKBH1T5e3KolQ75HQyS0Bm5nyV49cQHW5QATPGu0g0dxr CYDewdPV9UeBds29Rk+jlvRFhg== X-Google-Smtp-Source: AB8JxZogKZv4z9JI55AAGM6mJCoORCwO0OWzVwCJTKvJRPmjmUytKzC8HnjDg4c7lbjW3BWRsPla0A== X-Received: by 2002:aed:356a:: with SMTP id b39-v6mr2040040qte.230.1524836852932; Fri, 27 Apr 2018 06:47:32 -0700 (PDT) Original-Received: from [10.35.157.64] ([134.174.110.14]) by smtp.gmail.com with ESMTPSA id c130sm936655qkg.8.2018.04.27.06.47.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Apr 2018 06:47:32 -0700 (PDT) In-Reply-To: Content-Language: en-US X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:145786 Archived-At:

Thanks!

I used (and (fboundp 'flymake-diagnostics) (fboundp 'flymake-diagnostic-text)) for testing the availability in the following proposed code:

(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
                   ", "))))
  (when (and (fboundp 'flymake-diagnostics) (fboundp 'flymake-diagnostic-text))
    (mapconcat #'flymake-diagnostic-text (flymake-diagnostics (point)) "\n")
    )
  )

Da
On 2018-04-27 9:45 AM, João Távora wrote:
I believe (fboundp 'flymake-diagnostics) is a simple and effective enough check.

Incidentally, I don't know what elpy does in regards to syntax checking, but it might have been completely or partially superseded by the new flymake python backend.

On Fri, Apr 27, 2018, 14:35 Da Zhang <zhangda82@gmail.com> wrote:

Hi Joao,

I tried your suggested solution and it worked beautifully. Is there a way to check if the new mechanism of flymake-diagnostics etc are available?

I am working with the maintainer of elpy to update the function "elpy-flymake-error-at-point", and ideally we want to see if the new mechanism is available.

Thanks in advance!

Da


On 2018-04-26 5:25 AM, João Távora wrote:
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