all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: joaotavora@gmail.com (João Távora)
To: Lele Gaifax <lele@metapensiero.it>
Cc: 28821@debbugs.gnu.org
Subject: bug#28821: [PATCH] Implement Python backend for Flymake
Date: Fri, 13 Oct 2017 21:56:25 +0100	[thread overview]
Message-ID: <87bmlan4w6.fsf@gmail.com> (raw)
In-Reply-To: <87y3of2zbj.fsf@metapensiero.it> (Lele Gaifax's message of "Fri,  13 Oct 2017 11:04:48 +0200")

Hi Lele,

Here are some comments:

Lele Gaifax <lele@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 :-)






  parent reply	other threads:[~2017-10-13 20:56 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-13  9:04 [PATCH] Implement Python backend for Flymake Lele Gaifax
2017-10-13  9:09 ` Clément Pit-Claudel
2017-10-13  9:22   ` Lele Gaifax
2017-10-13  9:50     ` Eli Zaretskii
2017-10-13  9:52       ` Lele Gaifax
2017-10-18 18:06         ` Lele Gaifax
2017-10-13 20:56 ` João Távora [this message]
     [not found]   ` <handler.28821.B.150792820417597.ack@debbugs.gnu.org>
2017-10-13 21:00     ` bug#28821: Acknowledgement ([PATCH] Implement Python backend for Flymake) João Távora
2017-10-13 21:03     ` bug#28808: [PATCH] Implement Python backend for Flymake João Távora
2017-10-14  8:15       ` Lele Gaifax
2017-10-14  9:14         ` João Távora
2017-10-17 21:58           ` Lele Gaifax
2017-10-21  7:15             ` bug#28808: Consider the right python--flymake-proc Lele Gaifax
2017-10-21 13:05               ` João Távora
2017-11-03 12:24                 ` João Távora
2017-11-03 19:16                   ` Lele Gaifax
2017-10-13 21:13   ` bug#28821: Closing this bug created in error João Távora

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

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

  git send-email \
    --in-reply-to=87bmlan4w6.fsf@gmail.com \
    --to=joaotavora@gmail.com \
    --cc=28821@debbugs.gnu.org \
    --cc=lele@metapensiero.it \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.