fixed (hopefully) error in compiled form of org-babel-map-src-blocks

* lisp/ob.el (org-babel-map-src-blocks): Ensure that the file argument
  is only evaluated once.
This commit is contained in:
Eric Schulte 2010-11-17 17:03:22 -07:00
parent 88947588bc
commit 97f4c3f9a1
1 changed files with 30 additions and 28 deletions

View File

@ -780,34 +780,36 @@ body ------------- string holding the body of the code block
beg-body --------- point at the beginning of the body
end-body --------- point at the end of the body"
(declare (indent 1))
`(let ((visited-p (or (null ,file)
(get-file-buffer (expand-file-name ,file))))
(point (point)) to-be-removed)
(save-window-excursion
(when ,file (find-file ,file))
(setq to-be-removed (current-buffer))
(goto-char (point-min))
(while (re-search-forward org-babel-src-block-regexp nil t)
(goto-char (match-beginning 0))
(let ((full-block (match-string 0))
(beg-block (match-beginning 0))
(end-block (match-end 0))
(lang (match-string 2))
(beg-lang (match-beginning 2))
(end-lang (match-end 2))
(switches (match-string 3))
(beg-switches (match-beginning 3))
(end-switches (match-end 3))
(header-args (match-string 4))
(beg-header-args (match-beginning 4))
(end-header-args (match-end 4))
(body (match-string 5))
(beg-body (match-beginning 5))
(end-body (match-end 5)))
,@body
(goto-char end-block))))
(unless visited-p (kill-buffer to-be-removed))
(goto-char point)))
(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-src-block-regexp nil t)
(goto-char (match-beginning 0))
(let ((full-block (match-string 0))
(beg-block (match-beginning 0))
(end-block (match-end 0))
(lang (match-string 2))
(beg-lang (match-beginning 2))
(end-lang (match-end 2))
(switches (match-string 3))
(beg-switches (match-beginning 3))
(end-switches (match-end 3))
(header-args (match-string 4))
(beg-header-args (match-beginning 4))
(end-header-args (match-end 4))
(body (match-string 5))
(beg-body (match-beginning 5))
(end-body (match-end 5)))
,@body
(goto-char end-block))))
(unless visited-p (kill-buffer to-be-removed))
(goto-char point))))
(defvar org-file-properties)
(defun org-babel-params-from-properties (&optional lang)