0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-08-25 01:32:52 +00:00

Merge branch 'master' of git+ssh://repo.or.cz/srv/git/org-mode

This commit is contained in:
Carsten Dominik 2010-07-07 08:37:27 +02:00
commit ad12713afd
10 changed files with 53 additions and 64 deletions

View file

@ -87,45 +87,35 @@ or `org-babel-execute:c++'."
(let* ((processed-params (org-babel-process-params params))
(tmp-src-file (make-temp-file "org-babel-C-src" nil
(cond
((equal org-babel-c-variant 'c) ".c")
((equal org-babel-c-variant 'cpp) ".cpp"))))
((equal org-babel-c-variant 'c) ".c")
((equal org-babel-c-variant 'cpp) ".cpp"))))
(tmp-bin-file (make-temp-file "org-babel-C-bin"))
(tmp-out-file (make-temp-file "org-babel-C-out"))
(cmdline (cdr (assoc :cmdline params)))
(flags (cdr (assoc :flags params)))
(full-body (org-babel-C-expand body params))
(error-buf (get-buffer-create "*Org-Babel Error Output*"))
(compile
(progn
(with-temp-file tmp-src-file (insert full-body))
(with-temp-buffer
(org-babel-shell-command-on-region
(point-min) (point-max)
(format "%s -o %s %s %s"
(cond
((equal org-babel-c-variant 'c) org-babel-C-compiler)
((equal org-babel-c-variant 'cpp) org-babel-c++-compiler))
tmp-bin-file
(mapconcat 'identity
(if (listp flags) flags (list flags)) " ")
tmp-src-file)
(current-buffer) 'replace error-buf)))))
(if (= compile 0)
(org-babel-reassemble-table
(org-babel-read
(org-babel-trim
(org-babel-eval
(concat tmp-bin-file (if cmdline (concat " " cmdline) "")) "")))
(org-babel-pick-name
(nth 4 processed-params) (cdr (assoc :colnames params)))
(org-babel-pick-name
(nth 5 processed-params) (cdr (assoc :rownames params))))
(progn
(with-current-buffer error-buf
(goto-char (point-max))
(insert (concat "\n\n--body--\n" full-body))
(goto-char (point-min)))
(display-buffer error-buf) nil))))
(progn
(with-temp-file tmp-src-file (insert full-body))
(org-babel-eval
(format "%s -o %s %s %s"
(cond
((equal org-babel-c-variant 'c) org-babel-C-compiler)
((equal org-babel-c-variant 'cpp) org-babel-c++-compiler))
tmp-bin-file
(mapconcat 'identity
(if (listp flags) flags (list flags)) " ")
tmp-src-file) ""))))
(org-babel-reassemble-table
(org-babel-read
(org-babel-trim
(org-babel-eval
(concat tmp-bin-file (if cmdline (concat " " cmdline) "")) "")))
(org-babel-pick-name
(nth 4 processed-params) (cdr (assoc :colnames params)))
(org-babel-pick-name
(nth 5 processed-params) (cdr (assoc :rownames params))))))
(defun org-babel-C-expand (body params &optional processed-params)
"Expand a block of C or C++ code with org-babel according to

View file

@ -93,8 +93,8 @@
(defun org-babel-clojure-babel-clojure-cmd ()
"Create the command to start clojure according to current settings."
(if (and (not swank-clojure-binary) (not swank-clojure-classpath))
(error (concat "You must specifiy either a `swank-clojure-binary' "
"or a `swank-clojure-jar-path'"))
(error "%s" (concat "You must specifiy either a `swank-clojure-binary' "
"or a `swank-clojure-jar-path'"))
(if swank-clojure-binary
(if (listp swank-clojure-binary)
swank-clojure-binary
@ -269,8 +269,7 @@ repl buffer."
(require 'slime) (require 'swank-clojure)
(let ((raw nil)
(results nil))
(save-window-excursion
(set-buffer buffer)
(with-current-buffer buffer
(setq raw (org-babel-clojure-slime-eval-sync body))
(setq results (reverse (mapcar #'org-babel-trim raw)))
(cond

View file

@ -48,7 +48,7 @@ body inside the protection of `save-window-excursion' and
`(save-excursion
(save-match-data
(unless (org-babel-comint-buffer-livep ,buffer)
(error (format "buffer %s doesn't exist or has no process" ,buffer)))
(error "buffer %s doesn't exist or has no process" ,buffer))
(set-buffer ,buffer)
,@body)))

View file

@ -56,7 +56,7 @@ called by `org-babel-execute-src-block'."
(cmdline (cdr (assoc :cmdline params)))
(in-file (make-temp-file "org-babel-ditaa")))
(unless (file-exists-p org-ditaa-jar-path)
(error (format "Could not find ditaa.jar at %s" org-ditaa-jar-path)))
(error "Could not find ditaa.jar at %s" org-ditaa-jar-path))
(with-temp-file in-file (insert body))
(message (concat "java -jar " org-ditaa-jar-path " " cmdline " " in-file " " out-file))
(shell-command (concat "java -jar " org-ditaa-jar-path " " cmdline " " in-file " " out-file))

View file

@ -187,8 +187,7 @@ specifies the value of ERROR-BUFFER."
;; Clear the output buffer, then run the command with
;; output there.
(let ((directory default-directory))
(save-current-buffer
(set-buffer buffer)
(with-current-buffer buffer
(setq buffer-read-only nil)
(if (not output-buffer)
(setq default-directory directory))

View file

@ -80,9 +80,8 @@ called by `org-babel-execute-src-block'."
(when (file-exists-p out-file) (delete-file out-file))
(rename-file (org-babel-latex-tex-to-pdf tex-file) out-file))
((string-match "\\.\\([^\\.]+\\)$" out-file)
(error
(message "can not create %s files, please specify a .png or .pdf file"
(match-string 1 out-file)))))
(error "can not create %s files, please specify a .png or .pdf file"
(match-string 1 out-file))))
out-file)
body))

View file

@ -74,9 +74,8 @@ formats."
(let* ((out-file (or (cdr (assoc :file params)) "output.png" ))
(filetype (or (cdr (assoc :filetype params)) "png" )))
(unless (cdr (assoc :file params))
(error (concat
"\nERROR: no output file specified. "
"Add \":file some_name.png\" to the src header")))
(error "
ERROR: no output file specified. Add \":file name.png\" to the src header"))
(org-babel-eval (concat "mscgen -T " filetype " -o " out-file) body)
out-file))

View file

@ -150,8 +150,7 @@ return nil."
;; buffer (marker-buffer id-loc)
;; loc (marker-position id-loc))
;; (move-marker id-loc nil)
(progn (message (format "reference '%s' not found in this buffer" ref))
(error (format "reference '%s' not found in this buffer" ref))))
(error "reference '%s' not found in this buffer" ref))
(if lob-info
(setq type 'lob)
(while (not (setq type (org-babel-ref-at-ref-p)))

View file

@ -66,11 +66,13 @@ function is called by `org-babel-execute-src-block'."
(session (org-babel-sh-initiate-session (nth 0 processed-params)))
(result-params (nth 2 processed-params))
(full-body (org-babel-expand-body:sh
body params processed-params))) ;; then the source block body
body params processed-params)))
(org-babel-reassemble-table
(org-babel-sh-evaluate session full-body result-params)
(org-babel-pick-name (nth 4 processed-params) (cdr (assoc :colnames params)))
(org-babel-pick-name (nth 5 processed-params) (cdr (assoc :rownames params))))))
(org-babel-pick-name
(nth 4 processed-params) (cdr (assoc :colnames params)))
(org-babel-pick-name
(nth 5 processed-params) (cdr (assoc :rownames params))))))
(defun org-babel-prep-session:sh (session params)
"Prepare SESSION according to the header arguments specified in PARAMS."
@ -107,9 +109,10 @@ specifying a var of the same value."
(flet ((deep-string (el)
(if (listp el)
(mapcar #'deep-string el)
(org-babel-sh-var-to-sh el sep))))
(format "$(cat <<BABEL_TABLE\n%s\nBABEL_TABLE\n)"
(orgtbl-to-generic (deep-string var) (list :sep (or sep "\t")))))
(org-babel-sh-var-to-sh el sep))))
(format "$(cat <<BABEL_TABLE\n%s\nBABEL_TABLE\n)"
(orgtbl-to-generic
(deep-string var) (list :sep (or sep "\t")))))
(if (stringp var) (format "%s" var) (format "%S" var))))
(defun org-babel-sh-table-or-results (results)
@ -146,7 +149,7 @@ last statement in BODY."
((lambda (results)
(if (or (member "scalar" result-params)
(member "output" result-params))
(buffer-string)
results
(let ((tmp-file (make-temp-file "org-babel-sh")))
(with-temp-file tmp-file (insert results))
(org-babel-import-elisp-from-file tmp-file))))

View file

@ -1323,9 +1323,8 @@ block but are passed literally to the \"example-block\"."
(nb-add (buffer-substring index (point)))
(goto-char (match-end 0))
(setq index (point))
(nb-add (save-current-buffer
(set-buffer parent-buffer)
(mapconcat ;; interpose `prefix' between every line
(nb-add (with-current-buffer parent-buffer
(mapconcat ;; interpose PREFIX between every line
#'identity
(split-string
(if evaluate
@ -1334,7 +1333,8 @@ block but are passed literally to the \"example-block\"."
(if (stringp raw) raw (format "%S" raw)))
(save-restriction
(widen)
(let ((point (org-babel-find-named-block source-name)))
(let ((point (org-babel-find-named-block
source-name)))
(if point
(save-excursion
(goto-char point)
@ -1344,10 +1344,11 @@ block but are passed literally to the \"example-block\"."
;; optionally raise an error if named
;; source-block doesn't exist
(if (member lang org-babel-noweb-error-langs)
(error
(concat "<<%s>> could not be resolved "
"(see `org-babel-noweb-error-langs')")
source-name)
(error "%s"
(concat
"<<" source-name ">> "
"could not be resolved (see "
"`org-babel-noweb-error-langs')"))
"")))))
"[\n\r]") (concat "\n" prefix)))))
(nb-add (buffer-substring index (point-max)))))