Browse Source

Merge branch 'master' of orgmode.org:org-mode

Carsten Dominik 14 years ago
parent
commit
e860e08e58
8 changed files with 60 additions and 35 deletions
  1. 13 5
      doc/org.texi
  2. 13 6
      lisp/ob-emacs-lisp.el
  3. 5 3
      lisp/ob-python.el
  4. 1 1
      lisp/org-agenda.el
  5. 17 14
      lisp/org-list.el
  6. 1 1
      lisp/org-table.el
  7. 1 1
      lisp/org-wl.el
  8. 9 4
      lisp/org.el

+ 13 - 5
doc/org.texi

@@ -12789,11 +12789,19 @@ future work.)
 
 @subsection Session
 @subsubsection @code{:results value}
-The code is passed to the interpreter running as an interactive Emacs
-inferior process. The result returned is the result of the last evaluation
-performed by the interpreter. (This is obtained in a language-specific
-manner: the value of the variable @code{_} in Python and Ruby, and the value
-of @code{.Last.value} in R).
+The code is passed to an interpreter running as an interactive Emacs inferior
+process. Only languages which provide tools for interactive evaluation of
+code have session support, so some language (e.g., C and ditaa) do not
+support the @code{:session} header argument, and in other languages (e.g.,
+Python and Haskell) which have limitations on the code which may be entered
+into interactive sessions, those limitations apply to the code in code blocks
+using the @code{:session} header argument as well.
+
+Unless the @code{:results output} option is supplied (see below) the result
+returned is the result of the last evaluation performed by the
+interpreter. (This is obtained in a language-specific manner: the value of
+the variable @code{_} in Python and Ruby, and the value of @code{.Last.value}
+in R).
 
 @subsubsection @code{:results output}
 The code is passed to the interpreter running as an interactive Emacs

+ 13 - 6
lisp/ob-emacs-lisp.el

@@ -56,16 +56,23 @@
 (defun org-babel-execute:emacs-lisp (body params)
   "Execute a block of emacs-lisp code with Babel."
   (save-window-excursion
-    (org-babel-reassemble-table
+    ((lambda (result)
+       (if (or (member "scalar" (cdr (assoc :result-params params)))
+	       (member "verbatim" (cdr (assoc :result-params params))))
+	   (let ((print-level nil)
+		 (print-length nil))
+	     (format "%S" result))
+	 (org-babel-reassemble-table
+	  result
+	  (org-babel-pick-name (cdr (assoc :colname-names params))
+			       (cdr (assoc :colnames params)))
+	  (org-babel-pick-name (cdr (assoc :rowname-names params))
+			       (cdr (assoc :rownames params))))))
      (eval (read (format (if (member "output"
 				     (cdr (assoc :result-params params)))
 			     "(with-output-to-string %s)"
 			   "(progn %s)")
-			 (org-babel-expand-body:emacs-lisp body params))))
-     (org-babel-pick-name (cdr (assoc :colname-names params))
-			  (cdr (assoc :colnames params)))
-       (org-babel-pick-name (cdr (assoc :rowname-names params))
-			    (cdr (assoc :rownames params))))))
+			 (org-babel-expand-body:emacs-lisp body params)))))))
 
 (provide 'ob-emacs-lisp)
 

+ 5 - 3
lisp/ob-python.el

@@ -267,9 +267,11 @@ last statement in BODY, as elisp."
 	  (org-babel-comint-with-output
 	      (session org-babel-python-eoe-indicator t body)
 	    (let ((comint-process-echoes nil))
-	      (input-body body)
-	      (insert org-babel-python-eoe-indicator)
-	      (comint-send-input))) 2) "\n"))
+	      (mapc
+	       (lambda (line)
+		 (insert line) (comint-send-input nil t))
+	       (append (split-string body "[\n\r]") (list org-babel-python-eoe-indicator)))))
+	  2) "\n"))
        (value
 	(let ((tmp-file (org-babel-temp-file "python-")))
 	  (org-babel-comint-with-output

+ 1 - 1
lisp/org-agenda.el

@@ -3489,7 +3489,7 @@ By default, all four types are turned on.
 
 Never set this variable globally using `setq', because then it
 will apply to all future agenda commands.  Instead, bind it with
-`let' to scope it dynamically into the the agenda-constructing
+`let' to scope it dynamically into the agenda-constructing
 command.  A good way to set it is through options in
 `org-agenda-custom-commands'.  For a more flexible (though
 somewhat less efficient) way of determining what is included in

+ 17 - 14
lisp/org-list.el

@@ -2176,17 +2176,19 @@ in subtree, ignoring drawers."
 (defun org-reset-checkbox-state-subtree ()
   "Reset all checkboxes in an entry subtree."
   (interactive "*")
-  (save-restriction
-    (save-excursion
-      (org-narrow-to-subtree)
-      (org-show-subtree)
-      (goto-char (point-min))
-      (let ((end (point-max)))
-	(while (< (point) end)
-	  (when (org-at-item-checkbox-p)
-	    (replace-match "[ ]" t t nil 1))
-	  (beginning-of-line 2))))
-    (org-update-checkbox-count-maybe)))
+  (if (org-before-first-heading-p)
+      (error "Not inside a tree")
+    (save-restriction
+      (save-excursion
+	(org-narrow-to-subtree)
+	(org-show-subtree)
+	(goto-char (point-min))
+	(let ((end (point-max)))
+	  (while (< (point) end)
+	    (when (org-at-item-checkbox-p)
+	      (replace-match "[ ]" t t nil 1))
+	    (beginning-of-line 2)))
+	(org-update-checkbox-count-maybe 'all)))))
 
 (defun org-update-checkbox-count (&optional all)
   "Update the checkbox statistics in the current section.
@@ -2272,7 +2274,8 @@ With optional prefix argument ALL, do this for the whole buffer."
 	       ;; next headline, and save them in STRUCTS-BAK.
 	       ((org-on-heading-p)
 		(setq backup-end (save-excursion
-				   (outline-next-heading) (point)))
+				   (outline-next-heading) (point))
+		      structs-bak nil)
 		(while (org-list-search-forward box-re backup-end 'move)
 		  (let* ((struct (org-list-struct))
 			 (bottom (org-list-get-bottom-point struct)))
@@ -2327,10 +2330,10 @@ Otherwise it will be `org-todo'."
 	'org-checkbox-statistics-done
       'org-checkbox-statistics-todo)))
 
-(defun org-update-checkbox-count-maybe ()
+(defun org-update-checkbox-count-maybe (&optional all)
   "Update checkbox statistics unless turned off by user."
   (when (cdr (assq 'checkbox org-list-automatic-rules))
-    (org-update-checkbox-count))
+    (org-update-checkbox-count all))
   (run-hooks 'org-checkbox-statistics-hook))
 
 (defvar org-last-indent-begin-marker (make-marker))

+ 1 - 1
lisp/org-table.el

@@ -4580,7 +4580,7 @@ a \"#+TBLNAME:\" directive.  The first table following this line
 will then be used.  Alternatively, it may be an ID referring to
 any entry, also in a different file.  In this case, the first table
 in that entry will be referenced.
-FORM is a field or range descriptor like \"@2$3\" or or \"B3\" or
+FORM is a field or range descriptor like \"@2$3\" or \"B3\" or
 \"@I$2..@II$2\".  All the references must be absolute, not relative.
 
 The return value is either a single string for a single field, or a

+ 1 - 1
lisp/org-wl.el

@@ -119,7 +119,7 @@ googlegroups otherwise."
 (defun org-wl-folder-type (folder)
   "Return symbol that indicates the type of FOLDER.
 FOLDER is the wanderlust folder name.  The first character of the
-folder name determines the the folder type."
+folder name determines the folder type."
   (let* ((indicator (substring folder 0 1))
 	 (type (cdr (assoc indicator org-wl-folder-types))))
     ;; maybe access or file folder

+ 9 - 4
lisp/org.el

@@ -5157,6 +5157,11 @@ will be prompted for."
   :group 'org-babel)
 
 (defun org-fontify-meta-lines-and-blocks (limit)
+  (condition-case nil
+      (org-fontify-meta-lines-and-blocks-1 limit)
+    (error (message "org-mode fontification error"))))
+
+(defun org-fontify-meta-lines-and-blocks-1 (limit)
   "Fontify #+ lines and blocks, in the correct ways."
   (let ((case-fold-search t))
     (if (re-search-forward
@@ -6586,8 +6591,8 @@ in an indirect buffer, in overview mode.  You can dive into the tree in
 that copy, use org-occur and incremental search to find a location.
 When pressing RET or `Q', the command returns to the original buffer in
 which the visibility is still unchanged.  After RET is will also jump to
-the location selected in the indirect buffer and expose the
-the headline hierarchy above."
+the location selected in the indirect buffer and expose the headline 
+hierarchy above."
   (interactive "P")
   (let* ((org-refile-targets `((nil . (:maxlevel . ,org-goto-max-level))))
 	 (org-refile-use-outline-path t)
@@ -16115,8 +16120,8 @@ sequence appearing also before point.
 Even though the matchers for math are configurable, this function assumes
 that \\begin, \\(, \\[, and $$ are always used.  Only the single dollar
 delimiters are skipped when they have been removed by customization.
-The return value is nil, or a cons cell with the delimiter and
-and the position of this delimiter.
+The return value is nil, or a cons cell with the delimiter and the 
+position of this delimiter.
 
 This function does a reasonably good job, but can locally be fooled by
 for example currency specifications.  For example it will assume being in