aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabián Ezequiel Gallina2012-05-17 00:03:00 -0300
committerFabián Ezequiel Gallina2012-05-17 00:03:00 -0300
commit8b3e0e76ee48f73c33d0d6af67fdc7be10497dae (patch)
treee4f3d62487f849099de978521f48a94b4a8bd5e8
parent2947016aa73340d27552601deb112a78d61993d4 (diff)
downloademacs-8b3e0e76ee48f73c33d0d6af67fdc7be10497dae.tar.gz
emacs-8b3e0e76ee48f73c33d0d6af67fdc7be10497dae.zip
Implemented python-check
-rw-r--r--lisp/progmodes/python.el37
1 files changed, 35 insertions, 2 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 6284e64be8e..211978f15dd 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -70,6 +70,9 @@
70;; out of the box. This feature needs an inferior python shell 70;; out of the box. This feature needs an inferior python shell
71;; running. 71;; running.
72 72
73;; Code check: Check the current file for errors using
74;; `python-check-command'
75
73;; Eldoc: returns documentation for object at point by using the 76;; Eldoc: returns documentation for object at point by using the
74;; inferior python subprocess to inspect its documentation. As you 77;; inferior python subprocess to inspect its documentation. As you
75;; might guessed you should run `python-shell-send-buffer' from time 78;; might guessed you should run `python-shell-send-buffer' from time
@@ -90,8 +93,6 @@
90 93
91;; Review code and cleanup 94;; Review code and cleanup
92 95
93;; (Perhaps) python-check
94
95;; (Perhaps) some skeletons (I never use them because of yasnippet) 96;; (Perhaps) some skeletons (I never use them because of yasnippet)
96 97
97;;; Code: 98;;; Code:
@@ -133,6 +134,8 @@
133 (define-key map "\C-c\C-c" 'python-shell-send-buffer) 134 (define-key map "\C-c\C-c" 'python-shell-send-buffer)
134 (define-key map "\C-c\C-l" 'python-shell-send-file) 135 (define-key map "\C-c\C-l" 'python-shell-send-file)
135 (define-key map "\C-c\C-z" 'python-shell-switch-to-shell) 136 (define-key map "\C-c\C-z" 'python-shell-switch-to-shell)
137 ;; Some util commands
138 (define-key map "\C-c\C-v" 'python-check)
136 ;; Utilities 139 ;; Utilities
137 (substitute-key-definition 'complete-symbol 'completion-at-point 140 (substitute-key-definition 'complete-symbol 'completion-at-point
138 map global-map) 141 map global-map)
@@ -170,6 +173,8 @@
170 :help "Eval file in inferior Python session"] 173 :help "Eval file in inferior Python session"]
171 ["Debugger" pdb :help "Run pdb under GUD"] 174 ["Debugger" pdb :help "Run pdb under GUD"]
172 "-" 175 "-"
176 ["Check file" python-check
177 :help "Check file for errors"]
173 ["Complete symbol" completion-at-point 178 ["Complete symbol" completion-at-point
174 :help "Complete symbol before point"])) 179 :help "Complete symbol before point"]))
175 map) 180 map)
@@ -1487,6 +1492,34 @@ It is specially designed to be added to the
1487 #'python-ffap-setup) 1492 #'python-ffap-setup)
1488 1493
1489 1494
1495;;; Code check
1496
1497(defvar python-check-command
1498 "pychecker --stdlib"
1499 "Command used to check a Python file.")
1500
1501(defvar python-check-custom-command nil
1502 "Internal use.")
1503
1504(defun python-check (command)
1505 "Check a Python file (default current buffer's file).
1506Runs COMMAND, a shell command, as if by `compile'. See
1507`python-check-command' for the default."
1508 (interactive
1509 (list (read-string "Check command: "
1510 (or python-check-custom-command
1511 (concat python-check-command " "
1512 (shell-quote-argument
1513 (or
1514 (let ((name (buffer-file-name)))
1515 (and name
1516 (file-name-nondirectory name)))
1517 "")))))))
1518 (setq python-check-custom-command command)
1519 (save-some-buffers (not compilation-ask-about-save) nil)
1520 (compilation-start command))
1521
1522
1490;;; Eldoc 1523;;; Eldoc
1491 1524
1492(defvar python-eldoc-setup-code 1525(defvar python-eldoc-setup-code