summaryrefslogtreecommitdiff
path: root/elisp
diff options
context:
space:
mode:
authorAdrien Di Mascio <Adrien.DiMascio@logilab.fr>2009-08-31 07:59:47 +0200
committerAdrien Di Mascio <Adrien.DiMascio@logilab.fr>2009-08-31 07:59:47 +0200
commit1db471176ad6afaad42dd5a6f05a3786d71ff5f8 (patch)
treef89b2469f35f01c0dff30d4e80a1e343c3b67362 /elisp
parentef65b534beaf280fac2a44d7f4b9c3336c965fd6 (diff)
downloadpylint-1db471176ad6afaad42dd5a6f05a3786d71ff5f8.tar.gz
[elisp] integration of Yuen Ho Wong's patches
Diffstat (limited to 'elisp')
-rw-r--r--elisp/pylint-flymake.el5
-rw-r--r--elisp/pylint.el58
2 files changed, 34 insertions, 29 deletions
diff --git a/elisp/pylint-flymake.el b/elisp/pylint-flymake.el
index df46867..6313ba5 100644
--- a/elisp/pylint-flymake.el
+++ b/elisp/pylint-flymake.el
@@ -1,6 +1,4 @@
-
;; Configure flymake for python
-(setq pylint "epylint")
(when (load "flymake" t)
(defun flymake-pylint-init ()
(let* ((temp-file (flymake-init-create-temp-buffer-copy
@@ -8,7 +6,8 @@
(local-file (file-relative-name
temp-file
(file-name-directory buffer-file-name))))
- (list (expand-file-name pylint "") (list local-file))))
+ (list "epylint" (list local-file))))
+
(add-to-list 'flymake-allowed-file-name-masks
'("\\.py\\'" flymake-pylint-init)))
diff --git a/elisp/pylint.el b/elisp/pylint.el
index a9b22b1..01d15f1 100644
--- a/elisp/pylint.el
+++ b/elisp/pylint.el
@@ -1,3 +1,5 @@
+;; Fixed bug where py-mode-map is undefined in Gnu Emacs 22 and 23
+;; Yuen Ho Wong (2009)
;;
;; Modifications done by Yarosav O. Halchenko (2008):
;; - enable user-visible variables
@@ -25,34 +27,38 @@
(defun pylint ()
"Run pylint against the file behind the current buffer after
checking if unsaved buffers should be saved."
-
+
(interactive)
(let* ((file (buffer-file-name (current-buffer)))
- (command (concat "pylint " pylint-options " \"" file "\"")))
+ (command (concat "pylint " pylint-options " \"" file "\"")))
(save-some-buffers (not compilation-ask-about-save) nil) ; save files.
- (compile-internal command "No more errors or warnings" "pylint")))
-;; (local-set-key [f1] 'pylint)
-;; (local-set-key [f2] 'previous-error)
-;; (local-set-key [f3] 'next-error)
-
- (define-key
- py-mode-map
- [menu-bar Python pylint-separator]
- '("--" . pylint-seperator))
-
- (define-key
- py-mode-map
- [menu-bar Python next-error]
- '("Next error" . next-error))
- (define-key
- py-mode-map
- [menu-bar Python prev-error]
- '("Previous error" . previous-error))
- (define-key
- py-mode-map
- [menu-bar Python lint]
- '("Pylint" . pylint))
-
- )
+ (compilation-start command)))
+
+ (let ((python-mode-map (cond ((boundp 'py-mode-map) py-mode-map)
+ ((boundp 'python-mode-map) python-mode-map))))
+
+ ;; shortcuts in the tradition of python-mode and ropemacs
+ (define-key python-mode-map (kbd "C-c m l") 'pylint)
+ (define-key python-mode-map (kbd "C-c m p") 'previous-error)
+ (define-key python-mode-map (kbd "C-c m n") 'next-error)
+
+ (define-key
+ python-mode-map
+ [menu-bar Python pylint-separator]
+ '("--" . pylint-seperator))
+
+ (define-key
+ python-mode-map
+ [menu-bar Python next-error]
+ '("Next error" . next-error))
+ (define-key
+ python-mode-map
+ [menu-bar Python prev-error]
+ '("Previous error" . previous-error))
+ (define-key
+ python-mode-map
+ [menu-bar Python lint]
+ '("Pylint" . pylint))
+ ))
(add-hook 'python-mode-hook 'pylint-python-hook)