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 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 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 > > > > > > > > > > >