forked from mirrors/org-mode
Merge branch 'master' of orgmode.org:org-mode
This commit is contained in:
commit
8899e596f9
26
lisp/ob.el
26
lisp/ob.el
|
@ -653,6 +653,28 @@ end-body --------- point at the end of the body"
|
||||||
(unless visited-p (kill-buffer to-be-removed))
|
(unless visited-p (kill-buffer to-be-removed))
|
||||||
(goto-char point))))
|
(goto-char point))))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defmacro org-babel-map-inline-src-blocks (file &rest body)
|
||||||
|
"Evaluate BODY forms on each inline source-block in FILE.
|
||||||
|
If FILE is nil evaluate BODY forms on source blocks in current
|
||||||
|
buffer."
|
||||||
|
(declare (indent 1))
|
||||||
|
(let ((tempvar (make-symbol "file")))
|
||||||
|
`(let* ((,tempvar ,file)
|
||||||
|
(visited-p (or (null ,tempvar)
|
||||||
|
(get-file-buffer (expand-file-name ,tempvar))))
|
||||||
|
(point (point)) to-be-removed)
|
||||||
|
(save-window-excursion
|
||||||
|
(when ,tempvar (find-file ,tempvar))
|
||||||
|
(setq to-be-removed (current-buffer))
|
||||||
|
(goto-char (point-min))
|
||||||
|
(while (re-search-forward org-babel-inline-src-block-regexp nil t)
|
||||||
|
(goto-char (match-beginning 1))
|
||||||
|
(save-match-data ,@body)
|
||||||
|
(goto-char (match-end 0))))
|
||||||
|
(unless visited-p (kill-buffer to-be-removed))
|
||||||
|
(goto-char point))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun org-babel-execute-buffer (&optional arg)
|
(defun org-babel-execute-buffer (&optional arg)
|
||||||
"Execute source code blocks in a buffer.
|
"Execute source code blocks in a buffer.
|
||||||
|
@ -662,6 +684,8 @@ the current buffer."
|
||||||
(org-babel-eval-wipe-error-buffer)
|
(org-babel-eval-wipe-error-buffer)
|
||||||
(org-save-outline-visibility t
|
(org-save-outline-visibility t
|
||||||
(org-babel-map-src-blocks nil
|
(org-babel-map-src-blocks nil
|
||||||
|
(org-babel-execute-src-block arg))
|
||||||
|
(org-babel-map-inline-src-blocks nil
|
||||||
(org-babel-execute-src-block arg))))
|
(org-babel-execute-src-block arg))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
|
@ -1547,7 +1571,7 @@ code ---- the results are extracted in the syntax of the source
|
||||||
(t
|
(t
|
||||||
(let ((case-fold-search t)
|
(let ((case-fold-search t)
|
||||||
(blocks-re (regexp-opt
|
(blocks-re (regexp-opt
|
||||||
(list "latex" "html" "example" "src" "result"))))
|
(list "latex" "html" "example" "src" "result" "org"))))
|
||||||
(if (looking-at (concat "[ \t]*#\\+begin_" blocks-re))
|
(if (looking-at (concat "[ \t]*#\\+begin_" blocks-re))
|
||||||
(progn (re-search-forward (concat "[ \t]*#\\+end_" blocks-re) nil t)
|
(progn (re-search-forward (concat "[ \t]*#\\+end_" blocks-re) nil t)
|
||||||
(forward-char 1))
|
(forward-char 1))
|
||||||
|
|
Loading…
Reference in a new issue