[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/progmodes/python.el
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/progmodes/python.el |
Date: |
Mon, 28 Mar 2005 09:36:28 -0500 |
Index: emacs/lisp/progmodes/python.el
diff -c emacs/lisp/progmodes/python.el:1.25 emacs/lisp/progmodes/python.el:1.26
*** emacs/lisp/progmodes/python.el:1.25 Fri Mar 25 14:36:08 2005
--- emacs/lisp/progmodes/python.el Mon Mar 28 14:36:24 2005
***************
*** 1098,1125 ****
(defvar python-preoutput-continuation nil
"If non-nil, funcall this when `python-preoutput-filter' sees `_emacs_ok'.")
;; Using this stops us getting lines in the buffer like
;; >>> ... ... >>>
;; Also look for (and delete) an `_emacs_ok' string and call
;; `python-preoutput-continuation' if we get it.
(defun python-preoutput-filter (s)
"`comint-preoutput-filter-functions' function: ignore prompts not at bol."
(cond ((and (string-match (rx (and string-start (repeat 3 (any ".>"))
! " " string-end))
! s)
! (/= (let ((inhibit-field-text-motion t))
! (line-beginning-position))
! (point)))
! "")
! ((string= s "_emacs_ok\n")
! (when python-preoutput-continuation
! (funcall python-preoutput-continuation)
! (setq python-preoutput-continuation nil))
! "")
! ((string-match "_emacs_out \\(.*\\)\n" s)
! (setq python-preoutput-result (match-string 1 s))
"")
! (t s)))
;;;###autoload
(defun run-python (&optional cmd noshow)
--- 1098,1137 ----
(defvar python-preoutput-continuation nil
"If non-nil, funcall this when `python-preoutput-filter' sees `_emacs_ok'.")
+ (defvar python-preoutput-leftover nil)
+
;; Using this stops us getting lines in the buffer like
;; >>> ... ... >>>
;; Also look for (and delete) an `_emacs_ok' string and call
;; `python-preoutput-continuation' if we get it.
(defun python-preoutput-filter (s)
"`comint-preoutput-filter-functions' function: ignore prompts not at bol."
+ (when python-preoutput-leftover
+ (setq s (concat python-preoutput-leftover s))
+ (setq python-preoutput-leftover nil))
(cond ((and (string-match (rx (and string-start (repeat 3 (any ".>"))
! " " string-end))
! s)
! (/= (let ((inhibit-field-text-motion t))
! (line-beginning-position))
! (point)))
! "")
! ((string= s "_emacs_ok\n")
! (when python-preoutput-continuation
! (funcall python-preoutput-continuation)
! (setq python-preoutput-continuation nil))
! "")
! ((string-match "_emacs_out \\(.*\\)\n" s)
! (setq python-preoutput-result (match-string 1 s))
! "")
! ((string-match ".*\n" s)
! s)
! ((or (eq t (compare-strings s nil nil "_emacs_ok\n" nil (length s)))
! (eq t (compare-strings s nil nil "_emacs_out " nil
! (min (length "_emacs_out ") (length s)))))
! (setq python-preoutput-leftover s)
"")
! (t s)))
;;;###autoload
(defun run-python (&optional cmd noshow)
***************
*** 1359,1365 ****
(let ((proc (python-proc)))
(python-send-string string)
(setq python-preoutput-result nil)
! (accept-process-output proc 5)
python-preoutput-result))
;; Fixme: try to make it work with point in the arglist. Also, is
--- 1371,1379 ----
(let ((proc (python-proc)))
(python-send-string string)
(setq python-preoutput-result nil)
! (while (progn
! (accept-process-output proc 5)
! python-preoutput-leftover))
python-preoutput-result))
;; Fixme: try to make it work with point in the arglist. Also, is