diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2006-09-09 19:42:35 +0000 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2006-09-09 19:42:35 +0000 |
commit | d8ca7d34751c7602f50e8ad4860a026f26f3f24a (patch) | |
tree | 9226b9c3e84174fe55bf8e43cdbc11885d834a32 /lisp/progmodes/python.el | |
parent | 46d6e6920075af484a606821ab5d5cc2404e19bb (diff) | |
download | emacs-d8ca7d34751c7602f50e8ad4860a026f26f3f24a.tar.gz |
Quieten the compiler about hippie-expand vars.
(python-send-string): Be slightly more careful about adding \n.
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r-- | lisp/progmodes/python.el | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 66d8cd4714f..1299ff368d9 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -67,7 +67,8 @@ (eval-when-compile (require 'cl) (require 'compile) - (require 'comint)) + (require 'comint) + (require 'hippie-exp)) (autoload 'comint-mode "comint") @@ -1424,11 +1425,13 @@ COMMAND should be a single statement." "Evaluate STRING in inferior Python process." (interactive "sPython command: ") (comint-send-string (python-proc) string) - (comint-send-string (python-proc) - ;; If the string is single-line or if it ends with \n, - ;; only add a single \n, otherwise add 2, so as to - ;; make sure we terminate the multiline instruction. - (if (string-match "\n.+\\'" string) "\n\n" "\n"))) + (unless (string-match "\n\\'" string) + ;; Make sure the text is properly LF-terminated. + (comint-send-string (python-proc) "\n")) + (when (string-match "\n[ \t].*\n?\\'" string) + ;; If the string contains a final indented line, add a second newline so + ;; as to make sure we terminate the multiline instruction. + (comint-send-string (python-proc) "\n"))) (defun python-send-buffer () "Send the current buffer to the inferior Python process." |