]> code.delx.au - gnu-emacs/blobdiff - lisp/org/ob-python.el
Update copyright year to 2015
[gnu-emacs] / lisp / org / ob-python.el
index b8f8a6daafae514f65f3407532af9e72f777989f..3d441a3033c7f34594df1a9f447b8c5d526eb35e 100644 (file)
@@ -1,6 +1,6 @@
 ;;; ob-python.el --- org-babel functions for python evaluation
 
-;; Copyright (C) 2009-2013 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2015 Free Software Foundation, Inc.
 
 ;; Authors: Eric Schulte
 ;;      Dan Davison
@@ -54,9 +54,7 @@ This will typically be either 'python or 'python-mode."
   :group 'org-babel
   :version "24.4"
   :package-version '(Org . "8.0")
-  :type 'function)
-
-(defvar org-src-preserve-indentation)
+  :type 'symbol)
 
 (defcustom org-babel-python-hline-to "None"
   "Replace hlines in incoming tables with this when translating to python."
@@ -70,7 +68,7 @@ This will typically be either 'python or 'python-mode."
   :group 'org-babel
   :version "24.4"
   :package-version '(Org . "8.0")
-  :type 'string)
+  :type 'symbol)
 
 (defun org-babel-execute:python (body params)
   "Execute a block of Python code with Babel.
@@ -137,7 +135,7 @@ specifying a variable of the same value."
        org-babel-python-hline-to
       (format
        (if (and (stringp var) (string-match "[\n\r]" var)) "\"\"%S\"\"" "%S")
-       var))))
+       (if (stringp var) (substring-no-properties var) var)))))
 
 (defun org-babel-python-table-or-string (results)
   "Convert RESULTS into an appropriate elisp value.
@@ -156,14 +154,14 @@ Emacs-lisp table, otherwise return the results as a string."
   "Return the buffer associated with SESSION."
   (cdr (assoc session org-babel-python-buffers)))
 
-(defun org-babel-python-with-earmufs (session)
+(defun org-babel-python-with-earmuffs (session)
   (let ((name (if (stringp session) session (format "%s" session))))
     (if (and (string= "*" (substring name 0 1))
             (string= "*" (substring name (- (length name) 1))))
        name
       (format "*%s*" name))))
 
-(defun org-babel-python-without-earmufs (session)
+(defun org-babel-python-without-earmuffs (session)
   (let ((name (if (stringp session) session (format "%s" session))))
     (if (and (string= "*" (substring name 0 1))
             (string= "*" (substring name (- (length name) 1))))
@@ -190,9 +188,9 @@ then create.  Return the initialized session."
        (if (not (version< "24.1" emacs-version))
            (run-python cmd)
          (unless python-buffer
-           (setq python-buffer (org-babel-python-with-earmufs session)))
+           (setq python-buffer (org-babel-python-with-earmuffs session)))
          (let ((python-shell-buffer-name
-                (org-babel-python-without-earmufs python-buffer)))
+                (org-babel-python-without-earmuffs python-buffer)))
            (run-python cmd))))
        ((and (eq 'python-mode org-babel-python-mode)
             (fboundp 'py-shell)) ; python-mode.el
@@ -208,7 +206,7 @@ then create.  Return the initialized session."
                          (concat "Python-" (symbol-name session))))
               (py-which-bufname bufname))
          (py-shell)
-         (setq python-buffer (org-babel-python-with-earmufs bufname))))
+         (setq python-buffer (org-babel-python-with-earmuffs bufname))))
        (t
        (error "No function available for running an inferior Python")))
       (setq org-babel-python-buffers