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
commit8a23d031eeb1e2b79832dcc8bef14db468dba8b3 (patch)
tree8e1801b0e1992fc0b976d4d4016c475716cc0d99 /elisp
parent48ec0e8f37913c4d29f9a1897a9b97b6f69941df (diff)
downloadpylint-git-8a23d031eeb1e2b79832dcc8bef14db468dba8b3.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 df4686711..6313ba545 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 a9b22b174..01d15f125 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)