This fixed a number of problems:

pylint.el
---------

1. py-mode-map is not defined in python.el that comes with emacs22 and
23. Now pylint.el detects which is defined and sets the right mode map
correctly.

2. Enable by default a more sensible key bindings like ropemacs for
pylint, previous and next error in python-mode.

pylint.flymake.el
-----------------

1. (expand-file-name "epylint" "") makes no sense as this would expand
to wherever you open Emacs from. The old behavior to simply invoke
"epylint" as the user has been restored.


Jimmy Yuen Ho Wong

--- elisp/pylint-flymake.el     2009-08-27 05:37:52.000000000 -0400
+++ /Users/wyuenho/.emacs.d/pylint-flymake.el   2009-08-29 16:06:22.000000000 
-0400
@@ -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)))
 
--- elisp/pylint.el     2009-06-26 16:40:00.000000000 -0400
+++ /Users/wyuenho/.emacs.d/pylint.el   2009-08-29 20:15:24.000000000 -0400
@@ -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
@@ -28,31 +30,36 @@
     
     (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))))
+
+    ;; more sensible 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)
_______________________________________________
Python-Projects mailing list
Python-Projects@lists.logilab.org
http://lists.logilab.org/mailman/listinfo/python-projects

Reply via email to