Mercurial > emacs
comparison lisp/progmodes/python.el @ 72761:a15622a85c05
Quieten the compiler about hippie-expand vars.
(python-send-string): Be slightly more careful about adding \n.
| author | Stefan Monnier <monnier@iro.umontreal.ca> |
|---|---|
| date | Sat, 09 Sep 2006 19:42:35 +0000 |
| parents | a9874901ba07 |
| children | 298499495f06 |
comparison
equal
deleted
inserted
replaced
| 72760:06f1e0aa1de0 | 72761:a15622a85c05 |
|---|---|
| 65 ;;; Code: | 65 ;;; Code: |
| 66 | 66 |
| 67 (eval-when-compile | 67 (eval-when-compile |
| 68 (require 'cl) | 68 (require 'cl) |
| 69 (require 'compile) | 69 (require 'compile) |
| 70 (require 'comint)) | 70 (require 'comint) |
| 71 (require 'hippie-exp)) | |
| 71 | 72 |
| 72 (autoload 'comint-mode "comint") | 73 (autoload 'comint-mode "comint") |
| 73 | 74 |
| 74 (defgroup python nil | 75 (defgroup python nil |
| 75 "Silly walks in the Python language." | 76 "Silly walks in the Python language." |
| 1422 | 1423 |
| 1423 (defun python-send-string (string) | 1424 (defun python-send-string (string) |
| 1424 "Evaluate STRING in inferior Python process." | 1425 "Evaluate STRING in inferior Python process." |
| 1425 (interactive "sPython command: ") | 1426 (interactive "sPython command: ") |
| 1426 (comint-send-string (python-proc) string) | 1427 (comint-send-string (python-proc) string) |
| 1427 (comint-send-string (python-proc) | 1428 (unless (string-match "\n\\'" string) |
| 1428 ;; If the string is single-line or if it ends with \n, | 1429 ;; Make sure the text is properly LF-terminated. |
| 1429 ;; only add a single \n, otherwise add 2, so as to | 1430 (comint-send-string (python-proc) "\n")) |
| 1430 ;; make sure we terminate the multiline instruction. | 1431 (when (string-match "\n[ \t].*\n?\\'" string) |
| 1431 (if (string-match "\n.+\\'" string) "\n\n" "\n"))) | 1432 ;; If the string contains a final indented line, add a second newline so |
| 1433 ;; as to make sure we terminate the multiline instruction. | |
| 1434 (comint-send-string (python-proc) "\n"))) | |
| 1432 | 1435 |
| 1433 (defun python-send-buffer () | 1436 (defun python-send-buffer () |
| 1434 "Send the current buffer to the inferior Python process." | 1437 "Send the current buffer to the inferior Python process." |
| 1435 (interactive) | 1438 (interactive) |
| 1436 (python-send-region (point-min) (point-max))) | 1439 (python-send-region (point-min) (point-max))) |
