Kaydet (Commit) 7a73ef85 authored tarafından Barry Warsaw's avatar Barry Warsaw

(py-process-filter): Make sure current-buffer is restored, even in the

event of error.  Can't use new Emacs primitive save-current-buffer, so
use unwind-protect instead.
üst 24611f80
...@@ -932,42 +932,47 @@ See the `\\[py-shell]' docs for additional warnings." ...@@ -932,42 +932,47 @@ See the `\\[py-shell]' docs for additional warnings."
;; read_process_output has update_mode_lines++ for a similar ;; read_process_output has update_mode_lines++ for a similar
;; reason? beats me ... ;; reason? beats me ...
;; BAW - we want to check to see if this still applies (unwind-protect
(if (eq curbuf pbuf) ; mysterious ugly hack ;; make sure current buffer is restored
(set-buffer (get-buffer-create "*scratch*"))) ;; BAW - we want to check to see if this still applies
(progn
(set-buffer pbuf) ;; mysterious ugly hack
(let* ((start (point)) (if (eq curbuf pbuf)
(goback (< start pmark)) (set-buffer (get-buffer-create "*scratch*")))
(goend (and (not goback) (= start (point-max))))
(buffer-read-only nil)) (set-buffer pbuf)
(goto-char pmark) (let* ((start (point))
(insert string) (goback (< start pmark))
(move-marker pmark (point)) (goend (and (not goback) (= start (point-max))))
(setq file-finished (buffer-read-only nil))
(and py-file-queue (goto-char pmark)
(equal ">>> " (insert string)
(buffer-substring (move-marker pmark (point))
(prog2 (beginning-of-line) (point) (setq file-finished
(goto-char pmark)) (and py-file-queue
(point))))) (equal ">>> "
(if goback (goto-char start) (buffer-substring
;; else (prog2 (beginning-of-line) (point)
(if py-scroll-process-buffer (goto-char pmark))
(let* ((pop-up-windows t) (point)))))
(pwin (display-buffer pbuf))) (if goback (goto-char start)
(set-window-point pwin (point))))) ;; else
(set-buffer curbuf) (if py-scroll-process-buffer
(if file-finished (let* ((pop-up-windows t)
(progn (pwin (display-buffer pbuf)))
(py-delete-file-silently (car py-file-queue)) (set-window-point pwin (point)))))
(setq py-file-queue (cdr py-file-queue)) (set-buffer curbuf)
(if py-file-queue (if file-finished
(py-execute-file pyproc (car py-file-queue))))) (progn
(and goend (py-delete-file-silently (car py-file-queue))
(progn (set-buffer pbuf) (setq py-file-queue (cdr py-file-queue))
(goto-char (point-max)))) (if py-file-queue
))) (py-execute-file pyproc (car py-file-queue)))))
(and goend
(progn (set-buffer pbuf)
(goto-char (point-max))))
))
(set-buffer curbuf))))
(defun py-execute-buffer () (defun py-execute-buffer ()
"Send the contents of the buffer to a Python interpreter. "Send the contents of the buffer to a Python interpreter.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment