GNU bug report logs - #28821
[PATCH] Implement Python backend for Flymake

Previous Next

Package: emacs;

Reported by: joaotavora <at> gmail.com (João Távora)

Date: Fri, 13 Oct 2017 20:57:01 UTC

Severity: normal

Tags: patch

Done: joaotavora <at> gmail.com (João Távora)

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 28821 in the body.
You can then email your comments to 28821 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#28821; Package emacs. (Fri, 13 Oct 2017 20:57:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to joaotavora <at> gmail.com (João Távora):
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 13 Oct 2017 20:57:04 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: joaotavora <at> gmail.com (João Távora)
To: Lele Gaifax <lele <at> metapensiero.it>
Cc: bug-gnu-emacs <at> gnu.org
Subject: Re: [PATCH] Implement Python backend for Flymake
Date: Fri, 13 Oct 2017 21:56:25 +0100
Hi Lele,

Here are some comments:

Lele Gaifax <lele <at> metapensiero.it> writes:

> +(defgroup python-flymake nil
> +  "Integration between Python and Flymake."
> +  :group 'python
> +  :link '(custom-group-link :tag "Flymake" flymake)
> +  :version "26.1")
> +
> +(defcustom python-flymake-command '("pyflakes")
> +  "The external tool that will be used to perform the syntax check.
> +This is a non empty list of strings, the checker tool possibly followed by
> +required arguments: to use `flake8' you would set this to (\"flake8\" \"-\")."
>
I wonder if you shouldn't mention here that the command produced should,
once invoked, check (a file? a chunk?) of python source code passed to
it via its standard input.

> +  :group 'python-flymake
> +  :type '(repeat string))
> +
> +;; The default regexp accomodates for older pyflakes, which did not
> +;; report the column number
> +(defcustom python-flymake-command-output-regexp
> +  "^\\(?:<stdin>\\):\\(?1:[0-9]+\\):\\(?:\\(?2:[0-9]+\\):\\)? \\(?3:.*\\)$"
> +  "The regexp used to parse the output of the specified tool.
> +It must contain two or three groups: group 1 is the line number, group 2 the
> +optional column number and the third is the actual message."

A common trick here that old flymake (and also compile.el) use is to
define the variable's value as list (REGEXP LINE COLUMN TYPE
MESSAGE). REGEXP is mandatory. LINE, COLUMN, TYPE and MESSAGE are
non-negative integer numbers designating regexp groups, or nil. In the
latter case it means the regexp cannot capture that entity.

So in your case it would become

(defcustom python-flymake-command-output-regexp
  (list
    "^\\(?:<stdin>\\):\\(?1:[0-9]+\\):\\(?:\\(?2:[0-9]+\\):\\)? \\(?3:.*\\)$"
    1 2 nil 3)
  "docstring" :group 'python-flymake
  :type '(list string (choice integer symbol)
                      (choice integer symbol)
                      (choice integer symbol)
                      (choice integer symbol)))

Perhaps TYPE does not make much sense currently. But it would match
slightly better with compilation-error-regexp-alist in the future (which
you should see).

> +  (unless (derived-mode-p 'python-mode)
> +    (error "Can only work on `python-mode' buffers"))

Stefan and I arrived at the conclusion that this is cruft and isn't
needed. 

> +(defun python-flymake-activate ()

Rename this to python--flymake-setup, because "activation" is actually
enabling flymake-mode. Also, I think you should add an autoload cookie
to python--flymake-setup and then call that function from the end of
python-mode. The

> +  "Activate the Flymake syntax check on all python-mode buffers."
> +  (add-hook 'flymake-diagnostic-functions #'python-flymake nil t))

I'd use 'python-flymake instead of #'python-flymake in add-hook, but I
can't offer a sound reason why :-)





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28821; Package emacs. (Fri, 13 Oct 2017 21:01:02 GMT) Full text and rfc822 format available.

Message #8 received at 28821 <at> debbugs.gnu.org (full text, mbox):

From: joaotavora <at> gmail.com (João Távora)
To: 28821 <at> debbugs.gnu.org
Subject: Re: bug#28821: Acknowledgement ([PATCH] Implement Python backend for
 Flymake)
Date: Fri, 13 Oct 2017 22:00:45 +0100
Sorry,

This is not at all what I meant to do, I've created a new bug but I
merely meant to reply to Lele's bug report 28808. I'll try to archive or
close 28821, since it is useless.

João








Reply sent to joaotavora <at> gmail.com (João Távora):
You have taken responsibility. (Fri, 13 Oct 2017 21:14:01 GMT) Full text and rfc822 format available.

Notification sent to joaotavora <at> gmail.com (João Távora):
bug acknowledged by developer. (Fri, 13 Oct 2017 21:14:02 GMT) Full text and rfc822 format available.

Message #13 received at 28821-done <at> debbugs.gnu.org (full text, mbox):

From: joaotavora <at> gmail.com (João Távora)
To: 28821-done <at> debbugs.gnu.org
Subject: Closing this bug created in error
Date: Fri, 13 Oct 2017 22:13:38 +0100
This bug was created in error by cc'ing bug-gnu-emacs <at> gnu.org.

The relevant bug is 28808. Sorry.





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 11 Nov 2017 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years and 215 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.