From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Richard Riley Newsgroups: gmane.emacs.help Subject: Re: Emacs 23, Python, epylint, pylint Date: Thu, 22 Oct 2009 04:10:56 +0200 Organization: aich tea tea pea dicky riley dot net Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1256177543 31692 80.91.229.12 (22 Oct 2009 02:12:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 22 Oct 2009 02:12:23 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Oct 22 04:12:13 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1N0n9i-0007om-C3 for geh-help-gnu-emacs@m.gmane.org; Thu, 22 Oct 2009 04:11:59 +0200 Original-Received: from localhost ([127.0.0.1]:38113 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N0n9h-0006Bt-O9 for geh-help-gnu-emacs@m.gmane.org; Wed, 21 Oct 2009 22:11:57 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N0n9I-00066m-9q for help-gnu-emacs@gnu.org; Wed, 21 Oct 2009 22:11:32 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N0n9D-00063E-Sp for help-gnu-emacs@gnu.org; Wed, 21 Oct 2009 22:11:31 -0400 Original-Received: from [199.232.76.173] (port=41503 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N0n9D-00063B-Jy for help-gnu-emacs@gnu.org; Wed, 21 Oct 2009 22:11:27 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:39970) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1N0n9D-0004Vd-4I for help-gnu-emacs@gnu.org; Wed, 21 Oct 2009 22:11:27 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.50) id 1N0n9B-0007cr-8Z for help-gnu-emacs@gnu.org; Thu, 22 Oct 2009 04:11:25 +0200 Original-Received: from 85.183.18.158 ([85.183.18.158]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 22 Oct 2009 04:11:25 +0200 Original-Received: from rileyrgdev by 85.183.18.158 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 22 Oct 2009 04:11:25 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 111 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 85.183.18.158 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:69148 Archived-At: Richard Riley writes: > Richard Riley 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 :-;)