Mercurial > emacs
comparison lisp/progmodes/python.el @ 90601:a1a25ac6c88a
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 427-436)
- Update from CVS
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 134-136)
- Merge from emacs--devo--0
- Update from CVS
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-110
| author | Miles Bader <miles@gnu.org> |
|---|---|
| date | Thu, 14 Sep 2006 09:24:00 +0000 |
| parents | c358d0861b16 298499495f06 |
| children | b5c13d1564a9 |
comparison
equal
deleted
inserted
replaced
| 90600:84dd84b43e1b | 90601:a1a25ac6c88a |
|---|---|
| 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." |
| 93 (or "and" "assert" "break" "continue" "del" "elif" "else" | 94 (or "and" "assert" "break" "continue" "del" "elif" "else" |
| 94 "except" "exec" "finally" "for" "from" "global" "if" | 95 "except" "exec" "finally" "for" "from" "global" "if" |
| 95 "import" "in" "is" "lambda" "not" "or" "pass" "print" | 96 "import" "in" "is" "lambda" "not" "or" "pass" "print" |
| 96 "raise" "return" "try" "while" "yield" | 97 "raise" "return" "try" "while" "yield" |
| 97 ;; Future keywords | 98 ;; Future keywords |
| 98 "as" "None") | 99 "as" "None" |
| 100 ;; Not real keywords, but close enough to be fontified as such | |
| 101 "self" "True" "False") | |
| 99 symbol-end) | 102 symbol-end) |
| 100 ;; Definitions | 103 ;; Definitions |
| 101 (,(rx symbol-start (group "class") (1+ space) (group (1+ (or word ?_)))) | 104 (,(rx symbol-start (group "class") (1+ space) (group (1+ (or word ?_)))) |
| 102 (1 font-lock-keyword-face) (2 font-lock-type-face)) | 105 (1 font-lock-keyword-face) (2 font-lock-type-face)) |
| 103 (,(rx symbol-start (group "def") (1+ space) (group (1+ (or word ?_)))) | 106 (,(rx symbol-start (group "def") (1+ space) (group (1+ (or word ?_)))) |
| 1422 | 1425 |
| 1423 (defun python-send-string (string) | 1426 (defun python-send-string (string) |
| 1424 "Evaluate STRING in inferior Python process." | 1427 "Evaluate STRING in inferior Python process." |
| 1425 (interactive "sPython command: ") | 1428 (interactive "sPython command: ") |
| 1426 (comint-send-string (python-proc) string) | 1429 (comint-send-string (python-proc) string) |
| 1427 (comint-send-string (python-proc) | 1430 (unless (string-match "\n\\'" string) |
| 1428 ;; If the string is single-line or if it ends with \n, | 1431 ;; Make sure the text is properly LF-terminated. |
| 1429 ;; only add a single \n, otherwise add 2, so as to | 1432 (comint-send-string (python-proc) "\n")) |
| 1430 ;; make sure we terminate the multiline instruction. | 1433 (when (string-match "\n[ \t].*\n?\\'" string) |
| 1431 (if (string-match "\n.+\\'" string) "\n\n" "\n"))) | 1434 ;; If the string contains a final indented line, add a second newline so |
| 1435 ;; as to make sure we terminate the multiline instruction. | |
| 1436 (comint-send-string (python-proc) "\n"))) | |
| 1432 | 1437 |
| 1433 (defun python-send-buffer () | 1438 (defun python-send-buffer () |
| 1434 "Send the current buffer to the inferior Python process." | 1439 "Send the current buffer to the inferior Python process." |
| 1435 (interactive) | 1440 (interactive) |
| 1436 (python-send-region (point-min) (point-max))) | 1441 (python-send-region (point-min) (point-max))) |
