Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
8b3e0e76
Commit
8b3e0e76
authored
May 17, 2012
by
Fabián Ezequiel Gallina
Committed by
Fabián Ezequiel Gallina
May 17, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented python-check
parent
2947016a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
2 deletions
+35
-2
lisp/progmodes/python.el
lisp/progmodes/python.el
+35
-2
No files found.
lisp/progmodes/python.el
View file @
8b3e0e76
...
...
@@ -70,6 +70,9 @@
;; out of the box. This feature needs an inferior python shell
;; running.
;; Code check: Check the current file for errors using
;; `python-check-command'
;; Eldoc: returns documentation for object at point by using the
;; inferior python subprocess to inspect its documentation. As you
;; might guessed you should run `python-shell-send-buffer' from time
...
...
@@ -90,8 +93,6 @@
;; Review code and cleanup
;; (Perhaps) python-check
;; (Perhaps) some skeletons (I never use them because of yasnippet)
;;; Code:
...
...
@@ -133,6 +134,8 @@
(
define-key
map
"\C-c\C-c"
'python-shell-send-buffer
)
(
define-key
map
"\C-c\C-l"
'python-shell-send-file
)
(
define-key
map
"\C-c\C-z"
'python-shell-switch-to-shell
)
;; Some util commands
(
define-key
map
"\C-c\C-v"
'python-check
)
;; Utilities
(
substitute-key-definition
'complete-symbol
'completion-at-point
map
global-map
)
...
...
@@ -170,6 +173,8 @@
:help
"Eval file in inferior Python session"
]
[
"Debugger"
pdb
:help
"Run pdb under GUD"
]
"-"
[
"Check file"
python-check
:help
"Check file for errors"
]
[
"Complete symbol"
completion-at-point
:help
"Complete symbol before point"
]
))
map
)
...
...
@@ -1486,6 +1491,34 @@ It is specially designed to be added to the
(
add-hook
'inferior-python-mode-hook
#'
python-ffap-setup
)
;;; Code check
(
defvar
python-check-command
"pychecker --stdlib"
"Command used to check a Python file."
)
(
defvar
python-check-custom-command
nil
"Internal use."
)
(
defun
python-check
(
command
)
"Check a Python file (default current buffer's file).
Runs COMMAND, a shell command, as if by `compile'. See
`python-check-command' for the default."
(
interactive
(
list
(
read-string
"Check command: "
(
or
python-check-custom-command
(
concat
python-check-command
" "
(
shell-quote-argument
(
or
(
let
((
name
(
buffer-file-name
)))
(
and
name
(
file-name-nondirectory
name
)))
""
)))))))
(
setq
python-check-custom-command
command
)
(
save-some-buffers
(
not
compilation-ask-about-save
)
nil
)
(
compilation-start
command
))
;;; Eldoc
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment