diff options
| author | Christoph Scholtes | 2011-03-30 16:44:07 -0600 |
|---|---|---|
| committer | Christoph Scholtes | 2011-03-30 16:44:07 -0600 |
| commit | 6d0f1c9e5556d61958ac3369c0668dc1a0b2084f (patch) | |
| tree | 255dddba9c1c6bb7d609dcda288306a95391e353 /lisp/progmodes/python.el | |
| parent | 3e2d70fd422a9814e2e181a9bc3bcd856101bc83 (diff) | |
| download | emacs-6d0f1c9e5556d61958ac3369c0668dc1a0b2084f.tar.gz emacs-6d0f1c9e5556d61958ac3369c0668dc1a0b2084f.zip | |
* progmodes/python.el (python-default-interpreter)
(python-python-command-args, python-jython-command-args)
(python-which-shell, python-which-args, python-which-bufname)
(python-file-queue, python-comint-output-filter-function)
(python-toggle-shells, python-shell): Remove obsolete defcustoms,
variables and functions.
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 161 |
1 files changed, 0 insertions, 161 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 4246177495c..0cbb8c186cc 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -499,44 +499,6 @@ statement." | |||
| 499 | :type 'integer) | 499 | :type 'integer) |
| 500 | 500 | ||
| 501 | 501 | ||
| 502 | (defcustom python-default-interpreter 'cpython | ||
| 503 | "*Which Python interpreter is used by default. | ||
| 504 | The value for this variable can be either `cpython' or `jpython'. | ||
| 505 | |||
| 506 | When the value is `cpython', the variables `python-python-command' and | ||
| 507 | `python-python-command-args' are consulted to determine the interpreter | ||
| 508 | and arguments to use. | ||
| 509 | |||
| 510 | When the value is `jpython', the variables `python-jpython-command' and | ||
| 511 | `python-jpython-command-args' are consulted to determine the interpreter | ||
| 512 | and arguments to use. | ||
| 513 | |||
| 514 | Note that this variable is consulted only the first time that a Python | ||
| 515 | mode buffer is visited during an Emacs session. After that, use | ||
| 516 | \\[python-toggle-shells] to change the interpreter shell." | ||
| 517 | :type '(choice (const :tag "Python (a.k.a. CPython)" cpython) | ||
| 518 | (const :tag "JPython" jpython)) | ||
| 519 | :group 'python) | ||
| 520 | |||
| 521 | (defcustom python-python-command-args '("-i") | ||
| 522 | "*List of string arguments to be used when starting a Python shell." | ||
| 523 | :type '(repeat string) | ||
| 524 | :group 'python) | ||
| 525 | |||
| 526 | (defcustom python-jython-command-args '("-i") | ||
| 527 | "*List of string arguments to be used when starting a Jython shell." | ||
| 528 | :type '(repeat string) | ||
| 529 | :group 'python | ||
| 530 | :tag "JPython Command Args") | ||
| 531 | |||
| 532 | ;; for toggling between CPython and JPython | ||
| 533 | (defvar python-which-shell nil) | ||
| 534 | (defvar python-which-args python-python-command-args) | ||
| 535 | (defvar python-which-bufname "Python") | ||
| 536 | (make-variable-buffer-local 'python-which-shell) | ||
| 537 | (make-variable-buffer-local 'python-which-args) | ||
| 538 | (make-variable-buffer-local 'python-which-bufname) | ||
| 539 | |||
| 540 | (defcustom python-pdbtrack-do-tracking-p t | 502 | (defcustom python-pdbtrack-do-tracking-p t |
| 541 | "*Controls whether the pdbtrack feature is enabled or not. | 503 | "*Controls whether the pdbtrack feature is enabled or not. |
| 542 | 504 | ||
| @@ -562,11 +524,6 @@ having to restart the program." | |||
| 562 | (push '(python-pdbtrack-is-tracking-p python-pdbtrack-minor-mode-string) | 524 | (push '(python-pdbtrack-is-tracking-p python-pdbtrack-minor-mode-string) |
| 563 | minor-mode-alist)) | 525 | minor-mode-alist)) |
| 564 | 526 | ||
| 565 | ;; Bind python-file-queue before installing the kill-emacs-hook. | ||
| 566 | (defvar python-file-queue nil | ||
| 567 | "Queue of Python temp files awaiting execution. | ||
| 568 | Currently-active file is at the head of the list.") | ||
| 569 | |||
| 570 | (defcustom python-shell-prompt-alist | 527 | (defcustom python-shell-prompt-alist |
| 571 | '(("ipython" . "^In \\[[0-9]+\\]: *") | 528 | '(("ipython" . "^In \\[[0-9]+\\]: *") |
| 572 | (t . "^>>> ")) | 529 | (t . "^>>> ")) |
| @@ -2584,20 +2541,6 @@ Runs `jython-mode-hook' after `python-mode-hook'." | |||
| 2584 | 2541 | ||
| 2585 | ;; pdbtrack features | 2542 | ;; pdbtrack features |
| 2586 | 2543 | ||
| 2587 | (defun python-comint-output-filter-function (string) | ||
| 2588 | "Watch output for Python prompt and exec next file waiting in queue. | ||
| 2589 | This function is appropriate for `comint-output-filter-functions'." | ||
| 2590 | ;; TBD: this should probably use split-string | ||
| 2591 | (when (and (string-match python--prompt-regexp string) | ||
| 2592 | python-file-queue) | ||
| 2593 | (condition-case nil | ||
| 2594 | (delete-file (car python-file-queue)) | ||
| 2595 | (error nil)) | ||
| 2596 | (setq python-file-queue (cdr python-file-queue)) | ||
| 2597 | (if python-file-queue | ||
| 2598 | (let ((pyproc (get-buffer-process (current-buffer)))) | ||
| 2599 | (python-execute-file pyproc (car python-file-queue)))))) | ||
| 2600 | |||
| 2601 | (defun python-pdbtrack-overlay-arrow (activation) | 2544 | (defun python-pdbtrack-overlay-arrow (activation) |
| 2602 | "Activate or deactivate arrow at beginning-of-line in current buffer." | 2545 | "Activate or deactivate arrow at beginning-of-line in current buffer." |
| 2603 | (if activation | 2546 | (if activation |
| @@ -2742,45 +2685,6 @@ problem." | |||
| 2742 | (setq got buf))) | 2685 | (setq got buf))) |
| 2743 | got)) | 2686 | got)) |
| 2744 | 2687 | ||
| 2745 | (defun python-toggle-shells (arg) | ||
| 2746 | "Toggles between the CPython and JPython shells. | ||
| 2747 | |||
| 2748 | With positive argument ARG (interactively \\[universal-argument]), | ||
| 2749 | uses the CPython shell, with negative ARG uses the JPython shell, and | ||
| 2750 | with a zero argument, toggles the shell. | ||
| 2751 | |||
| 2752 | Programmatically, ARG can also be one of the symbols `cpython' or | ||
| 2753 | `jpython', equivalent to positive arg and negative arg respectively." | ||
| 2754 | (interactive "P") | ||
| 2755 | ;; default is to toggle | ||
| 2756 | (if (null arg) | ||
| 2757 | (setq arg 0)) | ||
| 2758 | ;; preprocess arg | ||
| 2759 | (cond | ||
| 2760 | ((equal arg 0) | ||
| 2761 | ;; toggle | ||
| 2762 | (if (string-equal python-which-bufname "Python") | ||
| 2763 | (setq arg -1) | ||
| 2764 | (setq arg 1))) | ||
| 2765 | ((equal arg 'cpython) (setq arg 1)) | ||
| 2766 | ((equal arg 'jpython) (setq arg -1))) | ||
| 2767 | (let (msg) | ||
| 2768 | (cond | ||
| 2769 | ((< 0 arg) | ||
| 2770 | ;; set to CPython | ||
| 2771 | (setq python-which-shell python-python-command | ||
| 2772 | python-which-args python-python-command-args | ||
| 2773 | python-which-bufname "Python" | ||
| 2774 | msg "CPython" | ||
| 2775 | mode-name "Python")) | ||
| 2776 | ((> 0 arg) | ||
| 2777 | (setq python-which-shell python-jython-command | ||
| 2778 | python-which-args python-jython-command-args | ||
| 2779 | python-which-bufname "JPython" | ||
| 2780 | msg "JPython" | ||
| 2781 | mode-name "JPython"))) | ||
| 2782 | (message "Using the %s shell" msg))) | ||
| 2783 | |||
| 2784 | ;; Python subprocess utilities and filters | 2688 | ;; Python subprocess utilities and filters |
| 2785 | (defun python-execute-file (proc filename) | 2689 | (defun python-execute-file (proc filename) |
| 2786 | "Send to Python interpreter process PROC \"execfile('FILENAME')\". | 2690 | "Send to Python interpreter process PROC \"execfile('FILENAME')\". |
| @@ -2801,71 +2705,6 @@ comint believe the user typed this string so that | |||
| 2801 | (set-buffer curbuf)) | 2705 | (set-buffer curbuf)) |
| 2802 | (process-send-string proc cmd))) | 2706 | (process-send-string proc cmd))) |
| 2803 | 2707 | ||
| 2804 | ;;;###autoload | ||
| 2805 | (defun python-shell (&optional argprompt) | ||
| 2806 | "Start an interactive Python interpreter in another window. | ||
| 2807 | This is like Shell mode, except that Python is running in the window | ||
| 2808 | instead of a shell. See the `Interactive Shell' and `Shell Mode' | ||
| 2809 | sections of the Emacs manual for details, especially for the key | ||
| 2810 | bindings active in the `*Python*' buffer. | ||
| 2811 | |||
| 2812 | With optional \\[universal-argument], the user is prompted for the | ||
| 2813 | flags to pass to the Python interpreter. This has no effect when this | ||
| 2814 | command is used to switch to an existing process, only when a new | ||
| 2815 | process is started. If you use this, you will probably want to ensure | ||
| 2816 | that the current arguments are retained (they will be included in the | ||
| 2817 | prompt). This argument is ignored when this function is called | ||
| 2818 | programmatically. | ||
| 2819 | |||
| 2820 | Note: You can toggle between using the CPython interpreter and the | ||
| 2821 | JPython interpreter by hitting \\[python-toggle-shells]. This toggles | ||
| 2822 | buffer local variables which control whether all your subshell | ||
| 2823 | interactions happen to the `*JPython*' or `*Python*' buffers (the | ||
| 2824 | latter is the name used for the CPython buffer). | ||
| 2825 | |||
| 2826 | Warning: Don't use an interactive Python if you change sys.ps1 or | ||
| 2827 | sys.ps2 from their default values, or if you're running code that | ||
| 2828 | prints `>>> ' or `... ' at the start of a line. `python-mode' can't | ||
| 2829 | distinguish your output from Python's output, and assumes that `>>> ' | ||
| 2830 | at the start of a line is a prompt from Python. Similarly, the Emacs | ||
| 2831 | Shell mode code assumes that both `>>> ' and `... ' at the start of a | ||
| 2832 | line are Python prompts. Bad things can happen if you fool either | ||
| 2833 | mode. | ||
| 2834 | |||
| 2835 | Warning: If you do any editing *in* the process buffer *while* the | ||
| 2836 | buffer is accepting output from Python, do NOT attempt to `undo' the | ||
| 2837 | changes. Some of the output (nowhere near the parts you changed!) may | ||
| 2838 | be lost if you do. This appears to be an Emacs bug, an unfortunate | ||
| 2839 | interaction between undo and process filters; the same problem exists in | ||
| 2840 | non-Python process buffers using the default (Emacs-supplied) process | ||
| 2841 | filter." | ||
| 2842 | (interactive "P") | ||
| 2843 | (require 'ansi-color) ; For ipython | ||
| 2844 | ;; Set the default shell if not already set | ||
| 2845 | (when (null python-which-shell) | ||
| 2846 | (python-toggle-shells python-default-interpreter)) | ||
| 2847 | (let ((args python-which-args)) | ||
| 2848 | (when (and argprompt | ||
| 2849 | (called-interactively-p 'interactive) | ||
| 2850 | (fboundp 'split-string)) | ||
| 2851 | ;; TBD: Perhaps force "-i" in the final list? | ||
| 2852 | (setq args (split-string | ||
| 2853 | (read-string (concat python-which-bufname | ||
| 2854 | " arguments: ") | ||
| 2855 | (concat | ||
| 2856 | (mapconcat 'identity python-which-args " ") " ") | ||
| 2857 | )))) | ||
| 2858 | (switch-to-buffer-other-window | ||
| 2859 | (apply 'make-comint python-which-bufname python-which-shell nil args)) | ||
| 2860 | (set-process-sentinel (get-buffer-process (current-buffer)) | ||
| 2861 | 'python-sentinel) | ||
| 2862 | (python--set-prompt-regexp) | ||
| 2863 | (add-hook 'comint-output-filter-functions | ||
| 2864 | 'python-comint-output-filter-function nil t) | ||
| 2865 | ;; pdbtrack | ||
| 2866 | (set-syntax-table python-mode-syntax-table) | ||
| 2867 | (use-local-map python-shell-map))) | ||
| 2868 | |||
| 2869 | (defun python-pdbtrack-toggle-stack-tracking (arg) | 2708 | (defun python-pdbtrack-toggle-stack-tracking (arg) |
| 2870 | (interactive "P") | 2709 | (interactive "P") |
| 2871 | (if (not (get-buffer-process (current-buffer))) | 2710 | (if (not (get-buffer-process (current-buffer))) |