forked from mirrors/org-mode
Merge branch 'master' of git+ssh://repo.or.cz/srv/git/org-mode
This commit is contained in:
commit
b564a944a7
|
@ -83,7 +83,6 @@ header arguments (calls `org-babel-C-expand')."
|
||||||
(defun org-babel-C-execute (body params)
|
(defun org-babel-C-execute (body params)
|
||||||
"This function should only be called by `org-babel-execute:C'
|
"This function should only be called by `org-babel-execute:C'
|
||||||
or `org-babel-execute:c++'."
|
or `org-babel-execute:c++'."
|
||||||
(message "executing C source code block")
|
|
||||||
(let* ((processed-params (org-babel-process-params params))
|
(let* ((processed-params (org-babel-process-params params))
|
||||||
(tmp-src-file (make-temp-file "org-babel-C-src" nil
|
(tmp-src-file (make-temp-file "org-babel-C-src" nil
|
||||||
(cond
|
(cond
|
||||||
|
|
|
@ -83,7 +83,6 @@
|
||||||
(defun org-babel-execute:R (body params)
|
(defun org-babel-execute:R (body params)
|
||||||
"Execute a block of R code with org-babel. This function is
|
"Execute a block of R code with org-babel. This function is
|
||||||
called by `org-babel-execute-src-block'."
|
called by `org-babel-execute-src-block'."
|
||||||
(message "executing R source code block...")
|
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(let* ((processed-params (org-babel-process-params params))
|
(let* ((processed-params (org-babel-process-params params))
|
||||||
(result-type (nth 3 processed-params))
|
(result-type (nth 3 processed-params))
|
||||||
|
|
|
@ -65,7 +65,6 @@
|
||||||
(defun org-babel-execute:asymptote (body params)
|
(defun org-babel-execute:asymptote (body params)
|
||||||
"Execute a block of Asymptote code with org-babel. This function is
|
"Execute a block of Asymptote code with org-babel. This function is
|
||||||
called by `org-babel-execute-src-block'."
|
called by `org-babel-execute-src-block'."
|
||||||
(message "executing Asymptote source code block")
|
|
||||||
(let* ((processed-params (org-babel-process-params params))
|
(let* ((processed-params (org-babel-process-params params))
|
||||||
(result-params (split-string (or (cdr (assoc :results params)) "")))
|
(result-params (split-string (or (cdr (assoc :results params)) "")))
|
||||||
(out-file (cdr (assoc :file params)))
|
(out-file (cdr (assoc :file params)))
|
||||||
|
|
|
@ -37,9 +37,7 @@
|
||||||
|
|
||||||
(defun org-babel-execute:css (body params)
|
(defun org-babel-execute:css (body params)
|
||||||
"Execute a block of CSS code with org-babel. This function is
|
"Execute a block of CSS code with org-babel. This function is
|
||||||
called by `org-babel-execute-src-block'."
|
called by `org-babel-execute-src-block'." body)
|
||||||
(message "executing CSS source code block")
|
|
||||||
body)
|
|
||||||
|
|
||||||
(defun org-babel-prep-session:css (session params)
|
(defun org-babel-prep-session:css (session params)
|
||||||
"Prepare SESSION according to the header arguments specified in PARAMS."
|
"Prepare SESSION according to the header arguments specified in PARAMS."
|
||||||
|
|
|
@ -50,7 +50,6 @@
|
||||||
(defun org-babel-execute:ditaa (body params)
|
(defun org-babel-execute:ditaa (body params)
|
||||||
"Execute a block of Ditaa code with org-babel. This function is
|
"Execute a block of Ditaa code with org-babel. This function is
|
||||||
called by `org-babel-execute-src-block'."
|
called by `org-babel-execute-src-block'."
|
||||||
(message "executing Ditaa source code block")
|
|
||||||
(let ((result-params (split-string (or (cdr (assoc :results params)) "")))
|
(let ((result-params (split-string (or (cdr (assoc :results params)) "")))
|
||||||
(out-file (cdr (assoc :file params)))
|
(out-file (cdr (assoc :file params)))
|
||||||
(cmdline (cdr (assoc :cmdline params)))
|
(cmdline (cdr (assoc :cmdline params)))
|
||||||
|
|
|
@ -52,7 +52,6 @@
|
||||||
(defun org-babel-execute:dot (body params)
|
(defun org-babel-execute:dot (body params)
|
||||||
"Execute a block of Dot code with org-babel. This function is
|
"Execute a block of Dot code with org-babel. This function is
|
||||||
called by `org-babel-execute-src-block'."
|
called by `org-babel-execute-src-block'."
|
||||||
(message "executing Dot source code block")
|
|
||||||
(let ((result-params (split-string (or (cdr (assoc :results params)) "")))
|
(let ((result-params (split-string (or (cdr (assoc :results params)) "")))
|
||||||
(out-file (cdr (assoc :file params)))
|
(out-file (cdr (assoc :file params)))
|
||||||
(cmdline (cdr (assoc :cmdline params)))
|
(cmdline (cdr (assoc :cmdline params)))
|
||||||
|
|
|
@ -58,7 +58,6 @@
|
||||||
|
|
||||||
(defun org-babel-execute:emacs-lisp (body params)
|
(defun org-babel-execute:emacs-lisp (body params)
|
||||||
"Execute a block of emacs-lisp code with org-babel."
|
"Execute a block of emacs-lisp code with org-babel."
|
||||||
(message "executing emacs-lisp code block...")
|
|
||||||
(save-window-excursion
|
(save-window-excursion
|
||||||
(let ((processed-params (org-babel-process-params params)))
|
(let ((processed-params (org-babel-process-params params)))
|
||||||
(org-babel-reassemble-table
|
(org-babel-reassemble-table
|
||||||
|
|
|
@ -132,7 +132,6 @@ code."
|
||||||
(defun org-babel-execute:gnuplot (body params)
|
(defun org-babel-execute:gnuplot (body params)
|
||||||
"Execute a block of Gnuplot code with org-babel. This function is
|
"Execute a block of Gnuplot code with org-babel. This function is
|
||||||
called by `org-babel-execute-src-block'."
|
called by `org-babel-execute-src-block'."
|
||||||
(message "executing Gnuplot source code block")
|
|
||||||
(require 'gnuplot)
|
(require 'gnuplot)
|
||||||
(let ((session (cdr (assoc :session params)))
|
(let ((session (cdr (assoc :session params)))
|
||||||
(result-type (cdr (assoc :results params)))
|
(result-type (cdr (assoc :results params)))
|
||||||
|
|
|
@ -71,7 +71,6 @@
|
||||||
|
|
||||||
(defun org-babel-execute:haskell (body params)
|
(defun org-babel-execute:haskell (body params)
|
||||||
"Execute a block of Haskell code with org-babel."
|
"Execute a block of Haskell code with org-babel."
|
||||||
(message "executing haskell source code block")
|
|
||||||
(let* ((processed-params (org-babel-process-params params))
|
(let* ((processed-params (org-babel-process-params params))
|
||||||
(session (nth 0 processed-params))
|
(session (nth 0 processed-params))
|
||||||
(vars (nth 1 processed-params))
|
(vars (nth 1 processed-params))
|
||||||
|
|
|
@ -60,7 +60,6 @@
|
||||||
(defun org-babel-execute:latex (body params)
|
(defun org-babel-execute:latex (body params)
|
||||||
"Execute a block of Latex code with org-babel. This function is
|
"Execute a block of Latex code with org-babel. This function is
|
||||||
called by `org-babel-execute-src-block'."
|
called by `org-babel-execute-src-block'."
|
||||||
(message "executing Latex source code block")
|
|
||||||
(setq body (org-babel-expand-body:latex body params))
|
(setq body (org-babel-expand-body:latex body params))
|
||||||
(if (cdr (assoc :file params))
|
(if (cdr (assoc :file params))
|
||||||
(let ((out-file (cdr (assoc :file params)))
|
(let ((out-file (cdr (assoc :file params)))
|
||||||
|
|
|
@ -70,7 +70,6 @@
|
||||||
is called by `org-babel-execute-src-block'. Default filetype is
|
is called by `org-babel-execute-src-block'. Default filetype is
|
||||||
png. Modify by setting :filetype parameter to mscgen supported
|
png. Modify by setting :filetype parameter to mscgen supported
|
||||||
formats."
|
formats."
|
||||||
(message "executing Mscgen source code block")
|
|
||||||
(let* ((out-file (or (cdr (assoc :file params)) "output.png" ))
|
(let* ((out-file (or (cdr (assoc :file params)) "output.png" ))
|
||||||
(filetype (or (cdr (assoc :filetype params)) "png" )))
|
(filetype (or (cdr (assoc :filetype params)) "png" )))
|
||||||
(unless (cdr (assoc :file params))
|
(unless (cdr (assoc :file params))
|
||||||
|
|
|
@ -60,7 +60,6 @@
|
||||||
|
|
||||||
(defun org-babel-execute:ocaml (body params)
|
(defun org-babel-execute:ocaml (body params)
|
||||||
"Execute a block of Ocaml code with org-babel."
|
"Execute a block of Ocaml code with org-babel."
|
||||||
(message "executing ocaml source code block")
|
|
||||||
(let* ((processed-params (org-babel-process-params params))
|
(let* ((processed-params (org-babel-process-params params))
|
||||||
(vars (nth 1 processed-params))
|
(vars (nth 1 processed-params))
|
||||||
(full-body (org-babel-expand-body:ocaml body params processed-params))
|
(full-body (org-babel-expand-body:ocaml body params processed-params))
|
||||||
|
|
|
@ -89,7 +89,6 @@ end")
|
||||||
(org-babel-execute:octave body params 'matlab))
|
(org-babel-execute:octave body params 'matlab))
|
||||||
(defun org-babel-execute:octave (body params &optional matlabp)
|
(defun org-babel-execute:octave (body params &optional matlabp)
|
||||||
"Execute a block of octave code with org-babel."
|
"Execute a block of octave code with org-babel."
|
||||||
(message "executing %s source code block" (if matlabp "matlab" "octave"))
|
|
||||||
(let* ((processed-params (org-babel-process-params params))
|
(let* ((processed-params (org-babel-process-params params))
|
||||||
(session
|
(session
|
||||||
(funcall (intern (format "org-babel-%s-initiate-session"
|
(funcall (intern (format "org-babel-%s-initiate-session"
|
||||||
|
|
|
@ -52,7 +52,6 @@
|
||||||
(defun org-babel-execute:perl (body params)
|
(defun org-babel-execute:perl (body params)
|
||||||
"Execute a block of Perl code with org-babel. This function is
|
"Execute a block of Perl code with org-babel. This function is
|
||||||
called by `org-babel-execute-src-block'."
|
called by `org-babel-execute-src-block'."
|
||||||
(message "executing Perl source code block")
|
|
||||||
(let* ((processed-params (org-babel-process-params params))
|
(let* ((processed-params (org-babel-process-params params))
|
||||||
(session (nth 0 processed-params))
|
(session (nth 0 processed-params))
|
||||||
(vars (nth 1 processed-params))
|
(vars (nth 1 processed-params))
|
||||||
|
|
|
@ -61,7 +61,6 @@
|
||||||
(defun org-babel-execute:python (body params)
|
(defun org-babel-execute:python (body params)
|
||||||
"Execute a block of Python code with org-babel. This function is
|
"Execute a block of Python code with org-babel. This function is
|
||||||
called by `org-babel-execute-src-block'."
|
called by `org-babel-execute-src-block'."
|
||||||
(message "executing Python source code block")
|
|
||||||
(let* ((processed-params (org-babel-process-params params))
|
(let* ((processed-params (org-babel-process-params params))
|
||||||
(session (org-babel-python-initiate-session (first processed-params)))
|
(session (org-babel-python-initiate-session (first processed-params)))
|
||||||
(result-params (nth 2 processed-params))
|
(result-params (nth 2 processed-params))
|
||||||
|
|
|
@ -67,7 +67,6 @@
|
||||||
(defun org-babel-execute:ruby (body params)
|
(defun org-babel-execute:ruby (body params)
|
||||||
"Execute a block of Ruby code with org-babel. This function is
|
"Execute a block of Ruby code with org-babel. This function is
|
||||||
called by `org-babel-execute-src-block'."
|
called by `org-babel-execute-src-block'."
|
||||||
(message "executing Ruby source code block")
|
|
||||||
(let* ((processed-params (org-babel-process-params params))
|
(let* ((processed-params (org-babel-process-params params))
|
||||||
(session (org-babel-ruby-initiate-session (first processed-params)))
|
(session (org-babel-ruby-initiate-session (first processed-params)))
|
||||||
(result-params (nth 2 processed-params))
|
(result-params (nth 2 processed-params))
|
||||||
|
|
|
@ -49,7 +49,6 @@
|
||||||
(defun org-babel-execute:sass (body params)
|
(defun org-babel-execute:sass (body params)
|
||||||
"Execute a block of Sass code with org-babel. This function is
|
"Execute a block of Sass code with org-babel. This function is
|
||||||
called by `org-babel-execute-src-block'."
|
called by `org-babel-execute-src-block'."
|
||||||
(message "executing Sass source code block")
|
|
||||||
(let* ((result-params (split-string (or (cdr (assoc :results params)) "")))
|
(let* ((result-params (split-string (or (cdr (assoc :results params)) "")))
|
||||||
(file (cdr (assoc :file params)))
|
(file (cdr (assoc :file params)))
|
||||||
(out-file (or file (make-temp-file "org-babel-sass-out")))
|
(out-file (or file (make-temp-file "org-babel-sass-out")))
|
||||||
|
|
|
@ -61,7 +61,6 @@
|
||||||
(defun org-babel-execute:sh (body params)
|
(defun org-babel-execute:sh (body params)
|
||||||
"Execute a block of Shell commands with org-babel. This
|
"Execute a block of Shell commands with org-babel. This
|
||||||
function is called by `org-babel-execute-src-block'."
|
function is called by `org-babel-execute-src-block'."
|
||||||
(message "executing Shell source code block")
|
|
||||||
(let* ((processed-params (org-babel-process-params params))
|
(let* ((processed-params (org-babel-process-params params))
|
||||||
(session (org-babel-sh-initiate-session (nth 0 processed-params)))
|
(session (org-babel-sh-initiate-session (nth 0 processed-params)))
|
||||||
(result-params (nth 2 processed-params))
|
(result-params (nth 2 processed-params))
|
||||||
|
|
|
@ -56,7 +56,6 @@
|
||||||
(defun org-babel-execute:sql (body params)
|
(defun org-babel-execute:sql (body params)
|
||||||
"Execute a block of Sql code with org-babel. This function is
|
"Execute a block of Sql code with org-babel. This function is
|
||||||
called by `org-babel-execute-src-block'."
|
called by `org-babel-execute-src-block'."
|
||||||
(message "executing Sql source code block")
|
|
||||||
(let* ((result-params (split-string (or (cdr (assoc :results params)) "")))
|
(let* ((result-params (split-string (or (cdr (assoc :results params)) "")))
|
||||||
(processed-params (org-babel-process-params params))
|
(processed-params (org-babel-process-params params))
|
||||||
(cmdline (cdr (assoc :cmdline params)))
|
(cmdline (cdr (assoc :cmdline params)))
|
||||||
|
|
|
@ -50,7 +50,6 @@
|
||||||
(defun org-babel-execute:sqlite (body params)
|
(defun org-babel-execute:sqlite (body params)
|
||||||
"Execute a block of Sqlite code with org-babel. This function is
|
"Execute a block of Sqlite code with org-babel. This function is
|
||||||
called by `org-babel-execute-src-block'."
|
called by `org-babel-execute-src-block'."
|
||||||
(message "executing Sqlite source code block")
|
|
||||||
(let ((result-params (split-string (or (cdr (assoc :results params)) "")))
|
(let ((result-params (split-string (or (cdr (assoc :results params)) "")))
|
||||||
(vars (org-babel-ref-variables params))
|
(vars (org-babel-ref-variables params))
|
||||||
(db (cdr (assoc :db params)))
|
(db (cdr (assoc :db params)))
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
(require 'cl))
|
(require 'cl))
|
||||||
|
|
||||||
(declare-function org-link-escape "org" (text &optional table))
|
(declare-function org-link-escape "org" (text &optional table))
|
||||||
|
(declare-function org-heading-components "org" ())
|
||||||
(declare-function with-temp-filebuffer "org-interaction" (file &rest body))
|
(declare-function with-temp-filebuffer "org-interaction" (file &rest body))
|
||||||
|
|
||||||
(defcustom org-babel-tangle-lang-exts
|
(defcustom org-babel-tangle-lang-exts
|
||||||
|
@ -199,15 +200,23 @@ Return an association list of source-code block specifications of
|
||||||
the form used by `org-babel-spec-to-string' grouped by language.
|
the form used by `org-babel-spec-to-string' grouped by language.
|
||||||
Optional argument LANG can be used to limit the collected source
|
Optional argument LANG can be used to limit the collected source
|
||||||
code blocks by language."
|
code blocks by language."
|
||||||
(let ((block-counter 0) blocks)
|
(let ((block-counter 1) (current-heading "") blocks)
|
||||||
(org-babel-map-src-blocks (buffer-file-name)
|
(org-babel-map-src-blocks (buffer-file-name)
|
||||||
(setq block-counter (+ 1 block-counter))
|
((lambda (new-heading)
|
||||||
|
(if (not (string= new-heading current-heading))
|
||||||
|
(progn
|
||||||
|
(setq block-counter 1)
|
||||||
|
(setq current-heading new-heading))
|
||||||
|
(setq block-counter (+ 1 block-counter))))
|
||||||
|
(replace-regexp-in-string "[ \t]" "-"
|
||||||
|
(nth 4 (org-heading-components))))
|
||||||
(let* ((link (progn (call-interactively 'org-store-link)
|
(let* ((link (progn (call-interactively 'org-store-link)
|
||||||
(org-babel-clean-text-properties
|
(org-babel-clean-text-properties
|
||||||
(car (pop org-stored-links)))))
|
(car (pop org-stored-links)))))
|
||||||
(info (org-babel-get-src-block-info))
|
(info (org-babel-get-src-block-info))
|
||||||
(source-name (intern (or (nth 4 info)
|
(source-name (intern (or (nth 4 info)
|
||||||
(format "block-%d" block-counter))))
|
(format "%s:%d"
|
||||||
|
current-heading block-counter))))
|
||||||
(src-lang (nth 0 info))
|
(src-lang (nth 0 info))
|
||||||
(expand-cmd (intern (concat "org-babel-expand-body:" src-lang)))
|
(expand-cmd (intern (concat "org-babel-expand-body:" src-lang)))
|
||||||
(params (nth 2 info))
|
(params (nth 2 info))
|
||||||
|
|
60
lisp/ob.el
60
lisp/ob.el
|
@ -143,7 +143,8 @@ added to the header-arguments-alist."
|
||||||
(setq indent (car (last info)))
|
(setq indent (car (last info)))
|
||||||
(setq info (butlast info))
|
(setq info (butlast info))
|
||||||
(forward-line -1)
|
(forward-line -1)
|
||||||
(if (looking-at org-babel-src-name-w-name-regexp)
|
(if (and (looking-at org-babel-src-name-w-name-regexp)
|
||||||
|
(match-string 2))
|
||||||
(progn
|
(progn
|
||||||
(setq info (append info (list (org-babel-clean-text-properties
|
(setq info (append info (list (org-babel-clean-text-properties
|
||||||
(match-string 2)))))
|
(match-string 2)))))
|
||||||
|
@ -239,7 +240,7 @@ then run `org-babel-pop-to-session'."
|
||||||
|
|
||||||
(defconst org-babel-header-arg-names
|
(defconst org-babel-header-arg-names
|
||||||
'(cache cmdline colnames dir exports file noweb results
|
'(cache cmdline colnames dir exports file noweb results
|
||||||
session tangle var noeval)
|
session tangle var noeval comments)
|
||||||
"Common header arguments used by org-babel. Note that
|
"Common header arguments used by org-babel. Note that
|
||||||
individual languages may define their own language specific
|
individual languages may define their own language specific
|
||||||
header arguments as well.")
|
header arguments as well.")
|
||||||
|
@ -349,6 +350,9 @@ block."
|
||||||
(setq result (org-babel-read-result))
|
(setq result (org-babel-read-result))
|
||||||
(message (replace-regexp-in-string "%" "%%"
|
(message (replace-regexp-in-string "%" "%%"
|
||||||
(format "%S" result))) result)
|
(format "%S" result))) result)
|
||||||
|
(message "executing %s code block%s..."
|
||||||
|
(capitalize lang)
|
||||||
|
(if (nth 4 info) (format " (%s)" (nth 4 info)) ""))
|
||||||
(setq result (funcall cmd body params))
|
(setq result (funcall cmd body params))
|
||||||
(if (eq result-type 'value)
|
(if (eq result-type 'value)
|
||||||
(setq result (if (and (or (member "vector" result-params)
|
(setq result (if (and (or (member "vector" result-params)
|
||||||
|
@ -979,10 +983,28 @@ following the source block."
|
||||||
(name (if on-lob-line
|
(name (if on-lob-line
|
||||||
(nth 0 (org-babel-lob-get-info))
|
(nth 0 (org-babel-lob-get-info))
|
||||||
(nth 4 (or info (org-babel-get-src-block-info)))))
|
(nth 4 (or info (org-babel-get-src-block-info)))))
|
||||||
(head (unless on-lob-line (org-babel-where-is-src-block-head))) end)
|
(head (unless on-lob-line (org-babel-where-is-src-block-head)))
|
||||||
|
found beg end)
|
||||||
(when head (goto-char head))
|
(when head (goto-char head))
|
||||||
(or (and name (org-babel-find-named-result name))
|
(setq
|
||||||
(and (or on-lob-line (re-search-forward "^[ \t]*#\\+end_src" nil t))
|
found ;; was there a result (before we potentially insert one)
|
||||||
|
(or
|
||||||
|
(and
|
||||||
|
;; named results:
|
||||||
|
;; - return t if it is found, else return nil
|
||||||
|
;; - if it does not need to be rebuilt, then don't set end
|
||||||
|
;; - if it does need to be rebuilt then do set end
|
||||||
|
name (setq beg (org-babel-find-named-result name))
|
||||||
|
(prog1 beg
|
||||||
|
(when (and hash (not (string= hash (match-string 3))))
|
||||||
|
(goto-char beg) (setq end beg) ;; beginning of result
|
||||||
|
(forward-line 1)
|
||||||
|
(delete-region end (org-babel-result-end)) nil)))
|
||||||
|
(and
|
||||||
|
;; unnamed results:
|
||||||
|
;; - return t if it is found, else return nil
|
||||||
|
;; - if it is found, and the hash doesn't match, delete and set end
|
||||||
|
(or on-lob-line (re-search-forward "^[ \t]*#\\+end_src" nil t))
|
||||||
(progn (end-of-line 1)
|
(progn (end-of-line 1)
|
||||||
(if (eobp) (insert "\n") (forward-char 1))
|
(if (eobp) (insert "\n") (forward-char 1))
|
||||||
(setq end (point))
|
(setq end (point))
|
||||||
|
@ -991,13 +1013,20 @@ following the source block."
|
||||||
(re-search-forward "[^ \f\t\n\r\v]" nil t)
|
(re-search-forward "[^ \f\t\n\r\v]" nil t)
|
||||||
(beginning-of-line 1)
|
(beginning-of-line 1)
|
||||||
(looking-at
|
(looking-at
|
||||||
(concat org-babel-result-regexp "\n"))))
|
(concat org-babel-result-regexp "\n")))
|
||||||
;; or (with optional insert) back up and
|
(prog1 (point)
|
||||||
;; make one ourselves
|
;; must remove and rebuild if hash!=old-hash
|
||||||
(when insert
|
(if (and hash (not (string= hash (match-string 3))))
|
||||||
|
(prog1 nil
|
||||||
|
(forward-line 1)
|
||||||
|
(delete-region
|
||||||
|
end (org-babel-result-end)))
|
||||||
|
(setq end nil)))))))))
|
||||||
|
(if (and insert end)
|
||||||
|
(progn
|
||||||
(goto-char end)
|
(goto-char end)
|
||||||
(if (looking-at "[\n\r]")
|
(unless beg
|
||||||
(forward-char 1) (insert "\n"))
|
(if (looking-at "[\n\r]") (forward-char 1) (insert "\n")))
|
||||||
(insert (concat
|
(insert (concat
|
||||||
(if indent
|
(if indent
|
||||||
(mapconcat
|
(mapconcat
|
||||||
|
@ -1007,11 +1036,12 @@ following the source block."
|
||||||
"#+results"
|
"#+results"
|
||||||
(when hash (concat "["hash"]"))
|
(when hash (concat "["hash"]"))
|
||||||
":"
|
":"
|
||||||
(when name (concat " " name)) "\n\n"))
|
(when name (concat " " name)) "\n"))
|
||||||
(backward-char)
|
(unless beg (insert "\n") (backward-char))
|
||||||
(beginning-of-line 0)
|
(beginning-of-line 0)
|
||||||
(if hash (org-babel-hide-hash)) t)))
|
(if hash (org-babel-hide-hash))
|
||||||
(point))))))
|
(point))
|
||||||
|
found))))
|
||||||
|
|
||||||
(defvar org-block-regexp)
|
(defvar org-block-regexp)
|
||||||
(defun org-babel-read-result ()
|
(defun org-babel-read-result ()
|
||||||
|
|
|
@ -2107,19 +2107,29 @@ in the list) and remove property and value from the list in LISTVAR."
|
||||||
lang code trans opts indent caption)
|
lang code trans opts indent caption)
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(while (re-search-forward
|
(while (re-search-forward
|
||||||
"\\(^\\([ \t]*\\)#\\+BEGIN_SRC:?[ \t]+\\([^ \t\n]+\\)\\(.*\\)\n\\([^\000]+?\n\\)[ \t]*#\\+END_SRC.*\n?\\)\\|\\(^\\([ \t]*\\)#\\+BEGIN_EXAMPLE:?\\(?:[ \t]+\\(.*\\)\\)?\n\\([^\000]+?\n\\)[ \t]*#\\+END_EXAMPLE.*\n?\\)"
|
"\\(^\\([ \t]*\\)#\\+BEGIN_SRC:?\\([ \t]+\\([^ \t\n]+\\)\\)?\\(.*\\)\n\\([^\000]+?\n\\)[ \t]*#\\+END_SRC.*\n?\\)\\|\\(^\\([ \t]*\\)#\\+BEGIN_EXAMPLE:?\\(?:[ \t]+\\(.*\\)\\)?\n\\([^\000]+?\n\\)[ \t]*#\\+END_EXAMPLE.*\n?\\)"
|
||||||
nil t)
|
nil t)
|
||||||
(if (match-end 1)
|
(if (match-end 1)
|
||||||
|
(if (not (match-string 4))
|
||||||
|
(error "source block missing language specification: %s"
|
||||||
|
(let* ((body (match-string 6))
|
||||||
|
(nothing (message "body:%s" body))
|
||||||
|
(preview (or (and (string-match
|
||||||
|
"^[ \t]*\\([^\n\r]*\\)" body)
|
||||||
|
(match-string 1 body)) body)))
|
||||||
|
(if (> (length preview) 35)
|
||||||
|
(concat (substring preview 0 32) "...")
|
||||||
|
preview)))
|
||||||
;; src segments
|
;; src segments
|
||||||
(setq lang (match-string 3)
|
(setq lang (match-string 4)
|
||||||
opts (match-string 4)
|
opts (match-string 5)
|
||||||
code (match-string 5)
|
code (match-string 6)
|
||||||
indent (length (match-string 2))
|
indent (length (match-string 2))
|
||||||
caption (get-text-property 0 'org-caption (match-string 0)))
|
caption (get-text-property 0 'org-caption (match-string 0))))
|
||||||
(setq lang nil
|
(setq lang nil
|
||||||
opts (match-string 8)
|
opts (match-string 9)
|
||||||
code (match-string 9)
|
code (match-string 10)
|
||||||
indent (length (match-string 7))
|
indent (length (match-string 8))
|
||||||
caption (get-text-property 0 'org-caption (match-string 0))))
|
caption (get-text-property 0 'org-caption (match-string 0))))
|
||||||
|
|
||||||
(setq trans (org-export-format-source-code-or-example
|
(setq trans (org-export-format-source-code-or-example
|
||||||
|
|
Loading…
Reference in New Issue