;ELC   
;;; Compiled by was@form.fas.harvard.edu on Wed Apr 13 08:05:28 2005
;;; from file /home/was/sage/src/emacs/sage.el
;;; in Emacs version 21.4.1
;;; with bytecomp version 2.85.4.1
;;; with all optimizations.

;;; This file uses dynamic docstrings, first added in Emacs 19.29.
(if (and (boundp 'emacs-version)
	 (< (aref emacs-version (1- (length emacs-version))) ?A)
	 (or (and (boundp 'epoch::version) epoch::version)
	     (string-lessp emacs-version "19.29")))
    (error "`sage.el' was compiled for Emacs 19.29 or later"))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


#@20 VC version number.
(defconst ipython-version "$Revision: 1.2 $" (#$ . 604))
(byte-code "\300\301!\210\300\302!\210\300\303!\210\300\304!\207" [require cl shell executable ansi-color] 2)
#@39 *Shell command used to start ipython.
(custom-declare-variable 'ipython-command '"ipython" '(#$ . -796) :type 'string :group 'python)
#@80 If nil, don't switch to the *Python* buffer on the first call to
  `py-shell'.
(defvar py-shell-initial-switch-buffers t (#$ . 936))
#@6 HACK
(defvar ipython-backup-of-py-python-command nil (#$ . 1074))
#@221 A regular expression to match the IPython input prompt and the python
command after it. The first match group is for a command that is rewritten,
the second for a 'normal' command, and the third for a multiline command.
(defvar ipython-de-input-prompt-regexp "\\(?:\nIn \\[[0-9]+\\]: .*\n----+> \\(.*\n\\)[\n]?\\)\\|\\(?:\nIn \\[[0-9]+\\]: \\(.*\n\\)\\)\\|^[ ]\\{3\\}[.]\\{3,\\}: \\(.*\n\\)" (#$ . 1147))
#@61 A regular expression to match the output prompt of IPython.
(defvar ipython-de-output-prompt-regexp "^Out\\[[0-9]+\\]: " (#$ . 1558))
#@221 A regular expression to match the IPython input prompt and the python
command after it. The first match group is for a command that is rewritten,
the second for a 'normal' command, and the third for a multiline command.
(defvar ipython-de-input-prompt-regexp "\\(?:\nsage: .*\n----+> \\(.*\n\\)[\n]?\\)\\|\\(?:\nsage: \\(.*\n\\)\\)\\|^[ ]\\{3\\}[.]\\{3,\\}: \\(.*\n\\)" (#$ . 1699))
#@61 A regular expression to match the output prompt of IPython.
(defvar ipython-de-output-prompt-regexp " " (#$ . 2088))
(byte-code "\306!\204 \307\310\311\"!\210\202J \312\313!\210\314\315M\210\316\317\314\"\210\320\321\322\323\f\235\204C \f\323\324=\2035 \325\202@ \326=\203? \327\202@ \327D\244!\"\330!\331\332\333\334\335$\210\336\332!\210\331\337\340\334\335$\210\336\337!\207" [ipython-command py-traceback-line-re py-shell-input-prompt-1-regexp py-shell-input-prompt-2-regexp py-python-command-args frame-background-mode executable-find message format "Can't find executable %s - ipython.el *NOT* activated!!!" require python-mode ipython-shell-hook #[nil "\305\300!\210\306\305\301!\210\306\305\302!\210\307\310\311\312\306\307$\210\313 \210\314\315\316#\210\314\f\317\316#\207" [shell-dirstack shell-last-dir shell-dirtrackp py-shell-map py-mode-map make-local-variable nil t add-hook comint-input-filter-functions shell-directory-tracker ansi-color-for-comint-mode-on define-key [tab] ipython-complete [(meta tab)]] 5] add-hook py-shell-hook "\\(^[^	 ].+?\\.py\\).*\n   +[0-9]+[^ ]*?\n-+> \\([0-9]+\\) +" "^In \\[[0-9]+\\]: " "^   [.][.][.]+: " "-colors" dark "DarkBG" light "LightBG" "sage" ad-add-advice py-shell (py-shell-with-history nil t (advice lambda nil "Add persistent command-history support (in\n$PYTHONHISTORY (or \"~/.ipython/history\", if we use IPython)). Also, if\n`py-shell-initial-switch-buffers' is nil, it only switches to *Python* if that\nbuffer already exists." (if (comint-check-proc "*Python*") ad-do-it (setq comint-input-ring-file-name (if (string-equal py-python-command "ipython") (concat (or (getenv "IPYTHONDIR") "~/.ipython") "/history") (or (getenv "PYTHONHISTORY") "~/.python-history.py"))) (comint-read-input-ring t) (let ((buf (current-buffer))) ad-do-it (unless py-shell-initial-switch-buffers (switch-to-buffer-other-window buf)))))) around nil ad-activate py-execute-region (py-execute-buffer-ensure-process nil t (advice lambda nil "HACK: if `py-shell' is not active or ASYNC is explicitly desired, fall back\n  to python instead of ipython." (let ((py-python-command (if (or (comint-check-proc "*Python*") async) py-python-command ipython-backup-of-py-python-command))) ad-do-it))) py-python-command ipython-backup-of-py-python-command] 5)
#@439 Transform a cut-and-pasted bit from an IPython session into something that
looks like it came from a normal interactive python session, so that it can
be used in doctests. Example:


    In [1]: import sys
    
    In [2]: sys.stdout.write 'Hi!
'
    ------> sys.stdout.write ('Hi!
')
    Hi!
    
    In [3]: 3 + 4
    Out[3]: 7
    
gets converted to:

    >>> import sys
    >>> sys.stdout.write ('Hi!
')
    Hi!
    >>> 3 + 4
    7


(defalias 'ipython-to-doctest #[(start end) "\212\305 \306\216	b\210\307\n\310#\203) \311\312!\203  \313\314\310\315#\210\202	 \313\316\310\315#\210\202	 	b\210\307\f\310#\205= \313\317\310\315#\210\202, +\207" [save-match-data-internal start ipython-de-input-prompt-regexp end ipython-de-output-prompt-regexp match-data ((set-match-data save-match-data-internal)) re-search-forward t match-string 3 replace-match "... \\3" nil ">>> \\1\\2" ""] 4 (#$ . 4399) "*r\n"])
#@66 The string send to ipython to query for all possible completions
(defvar ipython-completion-command-string "print ';'.join(__IP.Completer.all_completions('%s')) #PYTHON-MODE SILENT\n" (#$ . 5314))
(byte-code "\300\301!\203 \302\303M\210\202 \302\304M\210\305\306!\207" [featurep xemacs ipython-complete #[nil "\306\307\212\310\311 x\210`)`\312\n\"\306\306!\306\"\313#\314\"#\315\316p!\206. \317$!\320%\f\"\"\210\321\316p!!\210\322\323\324\325\"O	\"\211&\306'\306(&:\203k &@\211'\306D(B(&A\211&\202Q (\237+!\326\f!\"\211\"\327=\206\261 \"\204\215 \330\331\f\"\210\332 \202\261 \f\"\230\204\236 \n|\210\"c\202\261 \330\333!\210\334\220\335\336\f!\"!\221\210\330\337\340\".	\207" [ugly-return sep beg end pattern completions nil ";" "a-z0-9A-Z_." point-at-bol buffer-substring-no-properties append (ansi-color-filter-apply (lambda (string) (setq ugly-return (concat ugly-return string)) (delete-region comint-last-output-start (process-mark (get-buffer-process (current-buffer)))))) process-send-string get-buffer-process get-process format accept-process-output split-string 0 position 10 try-completion t message "Can't find completion for \"%s\"" ding "Making completion list..." "*Python Completions*" display-completion-list all-completions "Making completion list...%s" "done" completion-table completion comint-output-filter-functions py-which-bufname ipython-completion-command-string #:G63800 str #:G63801] 7 "Try to complete the python symbol before point. Only knows about the stuff\nin the current *Python* session." nil] #[nil "\306\307\212\310\311 x\210`)`\312\n\"\306\306!\306\"\313#\314\"#\315\316p!\206. \317$!\320%\f\"\"\210\321\316p!!\210\322\323\324\325\"O	\"\211&\306'\306(&:\203k &@\211'\306D(B(&A\211&\202Q (\237+!\326\f!\"\211\"\327=\206\261 \"\204\215 \330\331\f\"\210\332 \202\261 \f\"\230\204\236 \n|\210\"c\202\261 \330\333!\210\334\220\335\336\f!\"!\221\210\330\337\340\".	\207" [ugly-return sep beg end pattern completions nil ";" "a-z0-9A-Z_." point-at-bol buffer-substring-no-properties append (ansi-color-filter-apply (lambda (string) (setq ugly-return (concat ugly-return string)) "")) process-send-string get-buffer-process get-process format accept-process-output split-string 0 position 10 try-completion t message "Can't find completion for \"%s\"" ding "Making completion list..." "*IPython Completions*" display-completion-list all-completions "Making completion list...%s" "done" completion-table completion comint-preoutput-filter-functions py-which-bufname ipython-completion-command-string #:G63802 str #:G63803] 7 "Try to complete the python symbol before point. Only knows about the stuff\nin the current *Python* session." nil] provide ipython] 2)
