* Emacs 23, Python, epylint, pylint
@ 2009-10-22 1:30 Richard Riley
2009-10-22 1:48 ` Richard Riley
[not found] ` <mailman.9250.1256176158.2239.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 9+ messages in thread
From: Richard Riley @ 2009-10-22 1:30 UTC (permalink / raw)
To: help-gnu-emacs
I have followed the advice here:
http://stackoverflow.com/questions/1259873/how-can-i-use-emacs-flymake-mode-for-python-with-pyflakes-and-pylint-checking-cod
or
http://tinyurl.com/yfshb5b
And successfully have pylint and emacs highlighting errors in my .py
files courtesy of flymake. The problem is that I can't see anywhere the
actually error description. Can anyone help please?
The epylint script I have is this:
,----
| #!/usr/bin/env python
|
| import re
| import sys
|
| from subprocess import *
|
| p = Popen(
| "pylint -f parseable -r n %s"%
| sys.argv[1], shell = True, stdout = PIPE).stdout
|
| for line in p:
| match = re.search("\\[([WECR])(, (.+?))?\\]", line)
| if match:
| kind = match.group(1)
| func = match.group(3)
|
| if kind in ["W","C","R"]:
| msg = "Warning"
| else:
| msg = "Error"
|
| if func:
| line = re.sub("\\[([WECR])(, (.+?))?\\]",
| "%s (%s):" % (msg, func), line)
| else:
| line = re.sub("\\[([WECR])?\\]", "%s:" % msg, line)
| print line,
|
| p.close()
`----
regards
r.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Emacs 23, Python, epylint, pylint
2009-10-22 1:30 Richard Riley
@ 2009-10-22 1:48 ` Richard Riley
2009-10-22 2:10 ` Richard Riley
[not found] ` <mailman.9250.1256176158.2239.help-gnu-emacs@gnu.org>
1 sibling, 1 reply; 9+ messages in thread
From: Richard Riley @ 2009-10-22 1:48 UTC (permalink / raw)
To: help-gnu-emacs
Richard Riley <rileyrgdev@gmail.com> writes:
> I have followed the advice here:
>
> http://stackoverflow.com/questions/1259873/how-can-i-use-emacs-flymake-mode-for-python-with-pyflakes-and-pylint-checking-cod
>
> or
>
> http://tinyurl.com/yfshb5b
>
> And successfully have pylint and emacs highlighting errors in my .py
> files courtesy of flymake. The problem is that I can't see anywhere the
> actually error description. Can anyone help please?
>
> The epylint script I have is this:
>
> ,----
> | #!/usr/bin/env python
> |
> | import re
> | import sys
> |
> | from subprocess import *
> |
> | p = Popen(
> | "pylint -f parseable -r n %s"%
> | sys.argv[1], shell = True, stdout = PIPE).stdout
> |
> | for line in p:
> | match = re.search("\\[([WECR])(, (.+?))?\\]", line)
> | if match:
> | kind = match.group(1)
> | func = match.group(3)
> |
> | if kind in ["W","C","R"]:
> | msg = "Warning"
> | else:
> | msg = "Error"
> |
> | if func:
> | line = re.sub("\\[([WECR])(, (.+?))?\\]",
> | "%s (%s):" % (msg, func), line)
> | else:
> | line = re.sub("\\[([WECR])?\\]", "%s:" % msg, line)
> | print line,
> |
> | p.close()
> `----
>
OK, its done so that you need to (yuck!) hover your mouse over the
hilited error. Kind of in the face of keyboard driven emacs, but at
least one can see the error. If anyone has a patch/fix/advice on how to
change this to show the errors in a buffer and maybe next error/previous
error then that would be great. In fact pylint.el does something like
that but it would be nice in conjunction with the flymake dynamic code
checking and error hiliting.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Emacs 23, Python, epylint, pylint
2009-10-22 1:48 ` Richard Riley
@ 2009-10-22 2:10 ` Richard Riley
0 siblings, 0 replies; 9+ messages in thread
From: Richard Riley @ 2009-10-22 2:10 UTC (permalink / raw)
To: help-gnu-emacs
Richard Riley <rileyrgdev@gmail.com> writes:
> Richard Riley <rileyrgdev@gmail.com> writes:
>
>> I have followed the advice here:
>>
>> http://stackoverflow.com/questions/1259873/how-can-i-use-emacs-flymake-mode-for-python-with-pyflakes-and-pylint-checking-cod
>>
>> or
>>
>> http://tinyurl.com/yfshb5b
>>
>> And successfully have pylint and emacs highlighting errors in my .py
>> files courtesy of flymake. The problem is that I can't see anywhere the
>> actually error description. Can anyone help please?
>>
>> The epylint script I have is this:
>>
>> ,----
>> | #!/usr/bin/env python
>> |
>> | import re
>> | import sys
>> |
>> | from subprocess import *
>> |
>> | p = Popen(
>> | "pylint -f parseable -r n %s"%
>> | sys.argv[1], shell = True, stdout = PIPE).stdout
>> |
>> | for line in p:
>> | match = re.search("\\[([WECR])(, (.+?))?\\]", line)
>> | if match:
>> | kind = match.group(1)
>> | func = match.group(3)
>> |
>> | if kind in ["W","C","R"]:
>> | msg = "Warning"
>> | else:
>> | msg = "Error"
>> |
>> | if func:
>> | line = re.sub("\\[([WECR])(, (.+?))?\\]",
>> | "%s (%s):" % (msg, func), line)
>> | else:
>> | line = re.sub("\\[([WECR])?\\]", "%s:" % msg, line)
>> | print line,
>> |
>> | p.close()
>> `----
>>
>
> OK, its done so that you need to (yuck!) hover your mouse over the
> hilited error. Kind of in the face of keyboard driven emacs, but at
> least one can see the error. If anyone has a patch/fix/advice on how to
> change this to show the errors in a buffer and maybe next error/previous
> error then that would be great. In fact pylint.el does something like
> that but it would be nice in conjunction with the flymake dynamic code
> checking and error hiliting.
>
A more careful read of the flymake wiki page
http://www.emacswiki.org/emacs/FlyMake
provided the answer:
http://paste.lisp.org/display/60617
,----
| (defun show-fly-err-at-point ()
| "If the cursor is sitting on a flymake error, display the
| message in the minibuffer"
| (interactive)
| (let ((line-no (line-number-at-pos)))
| (dolist (elem flymake-err-info)
| (if (eq (car elem) line-no)
| (let ((err (car (second elem))))
| (message "%s" (fly-pyflake-determine-message err)))))))
|
| (defun fly-pyflake-determine-message (err)
| "pyflake is flakey if it has compile problems, this adjusts the
| message to display, so there is one ;)"
| (cond ((not (or (eq major-mode 'Python) (eq major-mode 'python-mode) t)))
| ((null (flymake-ler-file err))
| ;; normal message do your thing
| (flymake-ler-text err))
| (t ;; could not compile err
| (format "compile error, problem on line %s" (flymake-ler-line err)))))
|
| (defadvice flymake-goto-next-error (after display-message activate compile)
| "Display the error in the mini-buffer rather than having to mouse over it"
| (show-fly-err-at-point))
|
| (defadvice flymake-goto-prev-error (after display-message activate compile)
| "Display the error in the mini-buffer rather than having to mouse over it"
| (show-fly-err-at-point))
|
| (defadvice flymake-mode (before post-command-stuff activate compile)
| "Add functionality to the post command hook so that if the
| cursor is sitting on a flymake error the error information is
| displayed in the minibuffer (rather than having to mouse over
| it)"
| (set (make-local-variable 'post-command-hook)
| (cons 'show-fly-err-at-point post-command-hook)))
`----
(I think this should be default behaviour as most Emacs users balk from
using the mouse :-;)
^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <mailman.9250.1256176158.2239.help-gnu-emacs@gnu.org>]
* Re: Emacs 23, Python, epylint, pylint
[not found] ` <mailman.9250.1256176158.2239.help-gnu-emacs@gnu.org>
@ 2009-10-23 11:50 ` Anselm Helbig
2009-10-23 13:35 ` Richard Riley
[not found] ` <mailman.9306.1256304994.2239.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 9+ messages in thread
From: Anselm Helbig @ 2009-10-23 11:50 UTC (permalink / raw)
To: help-gnu-emacs
At Thu, 22 Oct 2009 03:48:39 +0200,
Richard Riley <rileyrgdev@gmail.com> wrote:
>
> Richard Riley <rileyrgdev@gmail.com> writes:
>
> > [...]
> >
> > And successfully have pylint and emacs highlighting errors in my .py
> > files courtesy of flymake. The problem is that I can't see anywhere the
> > actually error description. Can anyone help please?
> >
> > [...]
>
> OK, its done so that you need to (yuck!) hover your mouse over the
> hilited error. Kind of in the face of keyboard driven emacs, but at
> least one can see the error. If anyone has a patch/fix/advice on how to
> change this to show the errors in a buffer and maybe next error/previous
> error then that would be great. In fact pylint.el does something like
> that but it would be nice in conjunction with the flymake dynamic code
> checking and error hiliting.
While looking for a solution to this very problem I found out about
display-local-help, bound to `C-h .' here. Good enough for me, and no
configuration necessary. 8-)
HTH,
Anselm
--
Anselm Helbig
mailto:anselm.helbig+news2009@googlemail.com
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Emacs 23, Python, epylint, pylint
2009-10-23 11:50 ` Anselm Helbig
@ 2009-10-23 13:35 ` Richard Riley
[not found] ` <mailman.9306.1256304994.2239.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 9+ messages in thread
From: Richard Riley @ 2009-10-23 13:35 UTC (permalink / raw)
To: help-gnu-emacs
Anselm Helbig <anselm.helbig+news2009@googlemail.com> writes:
> At Thu, 22 Oct 2009 03:48:39 +0200,
> Richard Riley <rileyrgdev@gmail.com> wrote:
>>
>> Richard Riley <rileyrgdev@gmail.com> writes:
>>
>> > [...]
>> >
>> > And successfully have pylint and emacs highlighting errors in my .py
>> > files courtesy of flymake. The problem is that I can't see anywhere the
>> > actually error description. Can anyone help please?
>> >
>> > [...]
>>
>> OK, its done so that you need to (yuck!) hover your mouse over the
>> hilited error. Kind of in the face of keyboard driven emacs, but at
>> least one can see the error. If anyone has a patch/fix/advice on how to
>> change this to show the errors in a buffer and maybe next error/previous
>> error then that would be great. In fact pylint.el does something like
>> that but it would be nice in conjunction with the flymake dynamic code
>> checking and error hiliting.
>
> While looking for a solution to this very problem I found out about
> display-local-help, bound to `C-h .' here. Good enough for me, and no
> configuration necessary. 8-)
>
> HTH,
>
> Anselm
The flymake-cursor extension is the best! I'm still wondering about the
design decision to only show the error if you hover the mouse however
:-; Since it only appears in a lisp paste bucket at the moment, I
duplicated it here
http://tinyurl.com/yj6cf3x
^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <mailman.9306.1256304994.2239.help-gnu-emacs@gnu.org>]
* Re: Emacs 23, Python, epylint, pylint
[not found] ` <mailman.9306.1256304994.2239.help-gnu-emacs@gnu.org>
@ 2009-11-01 19:23 ` Dave Love
2009-11-02 13:02 ` Richard Riley
2009-11-02 13:29 ` Richard Riley
0 siblings, 2 replies; 9+ messages in thread
From: Dave Love @ 2009-11-01 19:23 UTC (permalink / raw)
To: help-gnu-emacs
Richard Riley <rileyrgdev@gmail.com> writes:
> A more careful read of the flymake wiki page
>
> Http://www.emacswiki.org/emacs/FlyMake
>
> Provided the answer:
>
> http://paste.lisp.org/display/60617
[Gross code elided.]
What's wrong with just adding this to `post-command-hook'?
(defun my-flymake-show-help ()
(when (get-char-property (point) 'flymake-overlay)
(let ((help (get-char-property (point) 'help-echo)))
(if help (message "%s" help)))))
(It would be better if overlays supported the `point-entered' property.)
> (I think this should be default behaviour as most Emacs users balk from
> using the mouse :-;)
[I'm surprised if that's the case and if anyone actually knows.]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Emacs 23, Python, epylint, pylint
2009-11-01 19:23 ` Dave Love
@ 2009-11-02 13:02 ` Richard Riley
2009-11-02 13:29 ` Richard Riley
1 sibling, 0 replies; 9+ messages in thread
From: Richard Riley @ 2009-11-02 13:02 UTC (permalink / raw)
To: help-gnu-emacs
Dave Love <fx@domain.invalid> writes:
> Richard Riley <rileyrgdev@gmail.com> writes:
>
>> A more careful read of the flymake wiki page
>>
>> Http://www.emacswiki.org/emacs/FlyMake
>>
>> Provided the answer:
>>
>> http://paste.lisp.org/display/60617
>
> [Gross code elided.]
>
> What's wrong with just adding this to `post-command-hook'?
>
> (defun my-flymake-show-help ()
> (when (get-char-property (point) 'flymake-overlay)
> (let ((help (get-char-property (point) 'help-echo)))
> (if help (message "%s" help)))))
I have no idea. The other code works and was linked on the wiki. Maybe your
code could replace it?
> (It would be better if overlays supported the `point-entered' property.)
>
>> (I think this should be default behaviour as most Emacs users balk from
>> using the mouse :-;)
>
> [I'm surprised if that's the case and if anyone actually knows.]
>
Well, the mouse usage being mandatory was the default and is not
really "emacs" thinking IMO : hence the wiki had the fix/workaround.
FWIW, I would hazard a guess that most emacs users tend not to be mouse
wielders in the main .. too many of our hands are already required :-;
Thanks for the reply and I will try code above : it certainly looks to
be short and sweet. If it does the job I'll add it to the wiki if thats
ok.
regards
r.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Emacs 23, Python, epylint, pylint
2009-11-01 19:23 ` Dave Love
2009-11-02 13:02 ` Richard Riley
@ 2009-11-02 13:29 ` Richard Riley
1 sibling, 0 replies; 9+ messages in thread
From: Richard Riley @ 2009-11-02 13:29 UTC (permalink / raw)
To: help-gnu-emacs
Dave Love <fx@domain.invalid> writes:
> Richard Riley <rileyrgdev@gmail.com> writes:
>
>> A more careful read of the flymake wiki page
>>
>> Http://www.emacswiki.org/emacs/FlyMake
>>
>> Provided the answer:
>>
>> http://paste.lisp.org/display/60617
>
> [Gross code elided.]
>
> What's wrong with just adding this to `post-command-hook'?
>
> (defun my-flymake-show-help ()
> (when (get-char-property (point) 'flymake-overlay)
> (let ((help (get-char-property (point) 'help-echo)))
> (if help (message "%s" help)))))
>
Yes, adding that as a post-command-hook worked well. There was similar
code on the wiki but rather using wrappers for
flymake-goto-next-error. I like the errors to appear when I cursor over
the error in "live editing" mode so your solution is better for me. Wiki
updated.
thanks
r.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2009-11-02 13:29 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <mailman.9249.1256175078.2239.help-gnu-emacs@gnu.org>
2009-11-01 19:22 ` Emacs 23, Python, epylint, pylint Dave Love
2009-10-22 1:30 Richard Riley
2009-10-22 1:48 ` Richard Riley
2009-10-22 2:10 ` Richard Riley
[not found] ` <mailman.9250.1256176158.2239.help-gnu-emacs@gnu.org>
2009-10-23 11:50 ` Anselm Helbig
2009-10-23 13:35 ` Richard Riley
[not found] ` <mailman.9306.1256304994.2239.help-gnu-emacs@gnu.org>
2009-11-01 19:23 ` Dave Love
2009-11-02 13:02 ` Richard Riley
2009-11-02 13:29 ` Richard Riley
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.