Browse Source

ob: avoid error when python session buffer has been killed

* lisp/ob-python.el: Test whether non-nil buffer is #<killed buffer>
Dan Davison 14 years ago
parent
commit
43772d2d9a
1 changed files with 2 additions and 3 deletions
  1. 2 3
      lisp/ob-python.el

+ 2 - 3
lisp/ob-python.el

@@ -146,11 +146,10 @@ then create.  Return the initialized session."
 	;; Make sure that py-which-bufname is initialized, as otherwise
 	;; it will be overwritten the first time a Python buffer is
 	;; created.
-	(when (fboundp 'py-shell)
-	   (py-toggle-shells py-default-interpreter))
+	(py-toggle-shells py-default-interpreter)
 	;; `py-shell' creates a buffer whose name is the value of
 	;; `py-which-bufname' with '*'s at the beginning and end
-	(let* ((bufname (if python-buffer
+	(let* ((bufname (if (and python-buffer (buffer-live-p python-buffer))
 			    (replace-regexp-in-string ;; zap surrounding *
 			     "^\\*\\([^*]+\\)\\*$" "\\1" python-buffer)
 			  (concat "Python-" (symbol-name session))))