|
code@171
|
1 |
;; -*- emacs-lisp -*-
|
|
code@171
|
2 |
;; License: Gnu Public License
|
|
code@171
|
3 |
;;
|
|
code@171
|
4 |
;; Additional functionality that makes flymake error messages appear
|
|
code@171
|
5 |
;; in the minibuffer when point is on a line containing a flymake
|
|
code@171
|
6 |
;; error. This saves having to mouse over the error, which is a
|
|
code@171
|
7 |
;; keyboard user's annoyance
|
|
code@171
|
8 |
|
|
code@171
|
9 |
(defun show-fly-err-at-point ()
|
|
code@171
|
10 |
"If the cursor is sitting on a flymake error, display the
|
|
code@171
|
11 |
message in the minibuffer"
|
|
code@171
|
12 |
(interactive)
|
|
code@171
|
13 |
(let ((line-no (line-number-at-pos)))
|
|
code@171
|
14 |
(dolist (elem flymake-err-info)
|
|
code@171
|
15 |
(if (eq (car elem) line-no)
|
|
code@171
|
16 |
(let ((err (car (nth 1 elem))))
|
|
code@171
|
17 |
(message "%s" (fly-pyflake-determine-message err)))))))
|
|
code@171
|
18 |
|
|
code@171
|
19 |
(defun fly-pyflake-determine-message (err)
|
|
code@171
|
20 |
"pyflake is flakey if it has compile problems, this adjusts the
|
|
code@171
|
21 |
message to display, so there is one ;)"
|
|
code@171
|
22 |
(cond ((not (or (eq major-mode 'Python) (eq major-mode 'python-mode) t)))
|
|
code@171
|
23 |
((null (flymake-ler-file err))
|
|
code@171
|
24 |
;; normal message do your thing
|
|
code@171
|
25 |
(flymake-ler-text err))
|
|
code@171
|
26 |
(t ;; could not compile err
|
|
code@171
|
27 |
(format "compile error, problem on line %s" (flymake-ler-line err)))))
|
|
code@171
|
28 |
|
|
code@171
|
29 |
(defadvice flymake-goto-next-error (after display-message activate compile)
|
|
code@171
|
30 |
"Display the error in the mini-buffer rather than having to mouse over it"
|
|
code@171
|
31 |
(show-fly-err-at-point))
|
|
code@171
|
32 |
|
|
code@171
|
33 |
(defadvice flymake-goto-prev-error (after display-message activate compile)
|
|
code@171
|
34 |
"Display the error in the mini-buffer rather than having to mouse over it"
|
|
code@171
|
35 |
(show-fly-err-at-point))
|
|
code@171
|
36 |
|
|
code@171
|
37 |
(defadvice flymake-mode (before post-command-stuff activate compile)
|
|
code@171
|
38 |
"Add functionality to the post command hook so that if the
|
|
code@171
|
39 |
cursor is sitting on a flymake error the error information is
|
|
code@171
|
40 |
displayed in the minibuffer (rather than having to mouse over
|
|
code@171
|
41 |
it)"
|
|
code@171
|
42 |
(set (make-local-variable 'post-command-hook)
|
|
code@171
|
43 |
(cons 'show-fly-err-at-point post-command-hook)))
|
|
code@171
|
44 |
|
|
code@171
|
45 |
(provide 'flymake-point)
|