Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: Tools/Scripts/webkitpy/thirdparty/pylint/doc/flymake.txt

Issue 18418010: Check in the thirdparty libs needed for webkitpy. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 To enable flymake for python, insert the following into your .emacs ::
2
3 ;; Configure flymake for python
4 (setq pylint "epylint")
5 (when (load "flymake" t)
6 (defun flymake-pylint-init ()
7 (let* ((temp-file (flymake-init-create-temp-buffer-copy
8 'flymake-create-temp-inplace))
9 (local-file (file-relative-name
10 temp-file
11 (file-name-directory buffer-file-name))))
12 (list (expand-file-name pylint "") (list local-file))))
13 (add-to-list 'flymake-allowed-file-name-masks
14 '("\\.py\\'" flymake-pylint-init)))
15
16 ;; Set as a minor mode for python
17 (add-hook 'python-mode-hook '(lambda () (flymake-mode)))
18
19 Above stuff is in pylint/elisp/pylint-flymake.el, which should be automatically
20 installed on debian systems, in which cases you don't have to put it in your .em acs file.
21
22 Other things you may find useful to set ::
23
24 ;; Configure to wait a bit longer after edits before starting
25 (setq-default flymake-no-changes-timeout '3)
26
27 ;; Keymaps to navigate to the errors
28 (add-hook 'python-mode-hook '(lambda () (define-key python-mode-map "\C-cn" 'flymake-goto-next-error)))
29 (add-hook 'python-mode-hook '(lambda () (define-key python-mode-map "\C-cp" 'flymake-goto-prev-error)))
30
31
32 Finally, by default flymake only displays the extra information about the error when you
33 hover the mouse over the highlighted line. The following will use the minibuffer to display
34 messages when you the cursor is on the line.
35
36 ;; To avoid having to mouse hover for the error message, these functions mak e flymake error messages
37 ;; appear in the minibuffer
38 (defun show-fly-err-at-point ()
39 "If the cursor is sitting on a flymake error, display the message in the m inibuffer"
40 (require 'cl)
41 (interactive)
42 (let ((line-no (line-number-at-pos)))
43 (dolist (elem flymake-err-info)
44 (if (eq (car elem) line-no)
45 (let ((err (car (second elem))))
46 (message "%s" (flymake-ler-text err)))))))
47
48 (add-hook 'post-command-hook 'show-fly-err-at-point)
49
50
51 Alternative, if you only wish to pollute the minibuffer after an explicit flymak e-goto-* then use
52 the following instead of a post-command-hook
53
54 (defadvice flymake-goto-next-error (after display-message activate compile)
55 "Display the error in the mini-buffer rather than having to mouse over it"
56 (show-fly-err-at-point))
57
58 (defadvice flymake-goto-prev-error (after display-message activate compile)
59 "Display the error in the mini-buffer rather than having to mouse over it"
60 (show-fly-err-at-point))
OLDNEW
« no previous file with comments | « Tools/Scripts/webkitpy/thirdparty/pylint/doc/features.txt ('k') | Tools/Scripts/webkitpy/thirdparty/pylint/doc/manual.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698