diff options
36 files changed, 793 insertions, 723 deletions
diff --git a/lisp/org/ChangeLog b/lisp/org/ChangeLog index 7ed95d0ebf9..216edbd6d40 100644 --- a/lisp/org/ChangeLog +++ b/lisp/org/ChangeLog | |||
| @@ -1,3 +1,65 @@ | |||
| 1 | 2013-11-12 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | Address some byte-compiler warnings. | ||
| 4 | * ob-abc.el (org-babel-expand-body:abc): Use dolist. | ||
| 5 | (org-babel-execute:abc): Fix regexp quoting. | ||
| 6 | * ob-calc.el (org--var-syms): Rename from `var-syms'. | ||
| 7 | * ob-lilypond.el (ly-compile-lilyfile): Remove redundant let-binding. | ||
| 8 | * ob-table.el (sbe): Move debug declaration. | ||
| 9 | * org-clock.el (org--msg-extra): Rename from `msg-extra'. | ||
| 10 | * org.el (org-version): Avoid var name starting with _. | ||
| 11 | (org-inhibit-startup, org-called-with-limited-levels) | ||
| 12 | (org-link-search-inhibit-query, org-time-was-given) | ||
| 13 | (org-end-time-was-given, org-def, org-defdecode, org-with-time): | ||
| 14 | * org-colview.el (org-agenda-overriding-columns-format): | ||
| 15 | * org-agenda.el (org-agenda-multi, org-depend-tag-blocked) | ||
| 16 | (org-agenda-show-log-scoped): | ||
| 17 | * ob-python.el (py-which-bufname, python-shell-buffer-name): | ||
| 18 | * ob-haskell.el (org-export-copy-to-kill-ring): | ||
| 19 | * ob-exp.el (org-link-search-inhibit-query): | ||
| 20 | * ob-R.el (ess-eval-visibly-p): | ||
| 21 | * ob-core.el (org-src-window-setup): Declare before use. | ||
| 22 | (org-babel-expand-noweb-references): Remove unused `blocks-in-buffer'. | ||
| 23 | * ox-odt.el (org-odt-hfy-face-to-css): | ||
| 24 | * org-src.el (org-src-associate-babel-session, org-src-get-lang-mode): | ||
| 25 | * org-bibtex.el (org-bibtex-get, org-bibtex-ask, org-bibtex) | ||
| 26 | (org-bibtex-check): | ||
| 27 | * ob-tangle.el (org-babel-tangle, org-babel-spec-to-string) | ||
| 28 | (org-babel-tangle-single-block, org-babel-tangle-comment-links): | ||
| 29 | * ob-table.el (sbe): | ||
| 30 | * ob-sqlite.el (org-babel-sqlite-expand-vars): | ||
| 31 | * ob-sql.el (org-babel-sql-expand-vars): | ||
| 32 | * ob-shen.el (org-babel-execute:shen): | ||
| 33 | * ob-sh.el (org-babel-execute:sh, org-babel-sh-evaluate): | ||
| 34 | * ob-scala.el (org-babel-scala-evaluate): | ||
| 35 | * ob-ruby.el (org-babel-ruby-table-or-string) | ||
| 36 | (org-babel-ruby-evaluate): | ||
| 37 | * ob-python.el (org-babel-python-table-or-string) | ||
| 38 | (org-babel-python-evaluate-external-process) | ||
| 39 | (org-babel-python-evaluate-session): | ||
| 40 | * ob-picolisp.el (org-babel-execute:picolisp): | ||
| 41 | * ob-perl.el (org-babel-perl-evaluate): | ||
| 42 | * ob-maxima.el (org-babel-execute:maxima): | ||
| 43 | * ob-lisp.el (org-babel-execute:lisp): | ||
| 44 | * ob-java.el (org-babel-execute:java): | ||
| 45 | * ob-io.el (org-babel-io-evaluate): | ||
| 46 | * ob-haskell.el (org-babel-execute:haskell): | ||
| 47 | * ob-fortran.el (org-babel-execute:fortran): | ||
| 48 | * ob-exp.el (org-babel-exp-code): | ||
| 49 | * ob-emacs-lisp.el (org-babel-execute:emacs-lisp): | ||
| 50 | * ob-ditaa.el (org-babel-execute:ditaa): | ||
| 51 | * ob-core.el (org-babel-execute-src-block, org-babel-sha1-hash) | ||
| 52 | (org-babel-parse-header-arguments, org-babel-reassemble-table) | ||
| 53 | (org-babel-goto-src-block-head, org-babel-mark-block) | ||
| 54 | (org-babel-expand-noweb-references, org-babel-script-escape) | ||
| 55 | (org-babel-process-file-name): | ||
| 56 | * ob-clojure.el (org-babel-execute:clojure): | ||
| 57 | * ob-calc.el (org-babel-execute:calc): | ||
| 58 | * ob-awk.el (org-babel-execute:awk): | ||
| 59 | * ob-abc.el (org-babel-execute:abc): | ||
| 60 | * ob-R.el (org-babel-expand-body:R): | ||
| 61 | * ob-C.el (org-babel-C-execute): Avoid deprecated ((lambda) ...). | ||
| 62 | |||
| 1 | 2013-11-12 Glenn Morris <rgm@gnu.org> | 63 | 2013-11-12 Glenn Morris <rgm@gnu.org> |
| 2 | 64 | ||
| 3 | * ox-html.el (org-html-scripts): Add 2013 to copyright years. | 65 | * ox-html.el (org-html-scripts): Add 2013 to copyright years. |
| @@ -14,7 +76,7 @@ | |||
| 14 | * ob-python.el: Update the arglist passed to `declare-function' | 76 | * ob-python.el: Update the arglist passed to `declare-function' |
| 15 | for `run-python'. | 77 | for `run-python'. |
| 16 | 78 | ||
| 17 | * ob-tangle.el (org-babel-tangle): Use 'light argument to | 79 | * ob-tangle.el (org-babel-tangle): Use `light' argument to |
| 18 | `org-babel-get-src-block-info'. | 80 | `org-babel-get-src-block-info'. |
| 19 | 81 | ||
| 20 | * ob-core.el (org-babel-execute-src-block): Return nil in case of | 82 | * ob-core.el (org-babel-execute-src-block): Return nil in case of |
| @@ -5191,7 +5253,7 @@ | |||
| 5191 | * org-clock.el (org-clock-notify-once-if-expired): Honor | 5253 | * org-clock.el (org-clock-notify-once-if-expired): Honor |
| 5192 | `org-clock-sound'. | 5254 | `org-clock-sound'. |
| 5193 | 5255 | ||
| 5194 | 2013-11-12 Rasmus Pank <rasmus.pank@gmail.com> | 5256 | 2013-11-12 Rasmus Pank <rasmus.pank@gmail.com> |
| 5195 | 5257 | ||
| 5196 | * org.el (org-format-latex-header): Remove eucal and amsmath. | 5258 | * org.el (org-format-latex-header): Remove eucal and amsmath. |
| 5197 | (org-latex-default-packages-alist): Remove amstext and add | 5259 | (org-latex-default-packages-alist): Remove amstext and add |
diff --git a/lisp/org/ob-C.el b/lisp/org/ob-C.el index e9eec934dc1..ddceb14f6d9 100644 --- a/lisp/org/ob-C.el +++ b/lisp/org/ob-C.el | |||
| @@ -103,20 +103,21 @@ or `org-babel-execute:C++'." | |||
| 103 | (mapconcat 'identity | 103 | (mapconcat 'identity |
| 104 | (if (listp flags) flags (list flags)) " ") | 104 | (if (listp flags) flags (list flags)) " ") |
| 105 | (org-babel-process-file-name tmp-src-file)) "")))) | 105 | (org-babel-process-file-name tmp-src-file)) "")))) |
| 106 | ((lambda (results) | 106 | (let ((results |
| 107 | (org-babel-reassemble-table | 107 | (org-babel-trim |
| 108 | (org-babel-result-cond (cdr (assoc :result-params params)) | 108 | (org-babel-eval |
| 109 | (org-babel-read results) | 109 | (concat tmp-bin-file (if cmdline (concat " " cmdline) "")) "")))) |
| 110 | (let ((tmp-file (org-babel-temp-file "c-"))) | 110 | (org-babel-reassemble-table |
| 111 | (with-temp-file tmp-file (insert results)) | 111 | (org-babel-result-cond (cdr (assoc :result-params params)) |
| 112 | (org-babel-import-elisp-from-file tmp-file))) | 112 | (org-babel-read results) |
| 113 | (org-babel-pick-name | 113 | (let ((tmp-file (org-babel-temp-file "c-"))) |
| 114 | (cdr (assoc :colname-names params)) (cdr (assoc :colnames params))) | 114 | (with-temp-file tmp-file (insert results)) |
| 115 | (org-babel-pick-name | 115 | (org-babel-import-elisp-from-file tmp-file))) |
| 116 | (cdr (assoc :rowname-names params)) (cdr (assoc :rownames params))))) | 116 | (org-babel-pick-name |
| 117 | (org-babel-trim | 117 | (cdr (assoc :colname-names params)) (cdr (assoc :colnames params))) |
| 118 | (org-babel-eval | 118 | (org-babel-pick-name |
| 119 | (concat tmp-bin-file (if cmdline (concat " " cmdline) "")) ""))))) | 119 | (cdr (assoc :rowname-names params)) (cdr (assoc :rownames params))))) |
| 120 | )) | ||
| 120 | 121 | ||
| 121 | (defun org-babel-C-expand (body params) | 122 | (defun org-babel-C-expand (body params) |
| 122 | "Expand a block of C or C++ code with org-babel according to | 123 | "Expand a block of C or C++ code with org-babel according to |
diff --git a/lisp/org/ob-R.el b/lisp/org/ob-R.el index 74d7513df3e..58f5536675c 100644 --- a/lisp/org/ob-R.el +++ b/lisp/org/ob-R.el | |||
| @@ -85,21 +85,22 @@ | |||
| 85 | (or graphics-file (org-babel-R-graphical-output-file params)))) | 85 | (or graphics-file (org-babel-R-graphical-output-file params)))) |
| 86 | (mapconcat | 86 | (mapconcat |
| 87 | #'identity | 87 | #'identity |
| 88 | ((lambda (inside) | 88 | (let ((inside |
| 89 | (if graphics-file | 89 | (append |
| 90 | (append | 90 | (when (cdr (assoc :prologue params)) |
| 91 | (list (org-babel-R-construct-graphics-device-call | 91 | (list (cdr (assoc :prologue params)))) |
| 92 | graphics-file params)) | 92 | (org-babel-variable-assignments:R params) |
| 93 | inside | 93 | (list body) |
| 94 | (list "dev.off()")) | 94 | (when (cdr (assoc :epilogue params)) |
| 95 | inside)) | 95 | (list (cdr (assoc :epilogue params))))))) |
| 96 | (append | 96 | (if graphics-file |
| 97 | (when (cdr (assoc :prologue params)) | 97 | (append |
| 98 | (list (cdr (assoc :prologue params)))) | 98 | (list (org-babel-R-construct-graphics-device-call |
| 99 | (org-babel-variable-assignments:R params) | 99 | graphics-file params)) |
| 100 | (list body) | 100 | inside |
| 101 | (when (cdr (assoc :epilogue params)) | 101 | (list "dev.off()")) |
| 102 | (list (cdr (assoc :epilogue params)))))) "\n"))) | 102 | inside)) |
| 103 | "\n"))) | ||
| 103 | 104 | ||
| 104 | (defun org-babel-execute:R (body params) | 105 | (defun org-babel-execute:R (body params) |
| 105 | "Execute a block of R code. | 106 | "Execute a block of R code. |
| @@ -324,6 +325,8 @@ last statement in BODY, as elisp." | |||
| 324 | column-names-p))) | 325 | column-names-p))) |
| 325 | (output (org-babel-eval org-babel-R-command body)))) | 326 | (output (org-babel-eval org-babel-R-command body)))) |
| 326 | 327 | ||
| 328 | (defvar ess-eval-visibly-p) | ||
| 329 | |||
| 327 | (defun org-babel-R-evaluate-session | 330 | (defun org-babel-R-evaluate-session |
| 328 | (session body result-type result-params column-names-p row-names-p) | 331 | (session body result-type result-params column-names-p row-names-p) |
| 329 | "Evaluate BODY in SESSION. | 332 | "Evaluate BODY in SESSION. |
diff --git a/lisp/org/ob-abc.el b/lisp/org/ob-abc.el index 09f2e63fabb..bb6abe396cd 100644 --- a/lisp/org/ob-abc.el +++ b/lisp/org/ob-abc.el | |||
| @@ -24,9 +24,11 @@ | |||
| 24 | 24 | ||
| 25 | ;;; Commentary: | 25 | ;;; Commentary: |
| 26 | 26 | ||
| 27 | ;;; This file adds support to Org Babel for music in ABC notation. | 27 | ;; This file adds support to Org Babel for music in ABC notation. |
| 28 | ;;; It requires that the abcm2ps program is installed. | 28 | ;; It requires that the abcm2ps program is installed. |
| 29 | ;;; See http://moinejf.free.fr/ | 29 | ;; See http://moinejf.free.fr/ |
| 30 | |||
| 31 | ;;; Code: | ||
| 30 | 32 | ||
| 31 | (require 'ob) | 33 | (require 'ob) |
| 32 | 34 | ||
| @@ -40,18 +42,15 @@ | |||
| 40 | 42 | ||
| 41 | (defun org-babel-expand-body:abc (body params) | 43 | (defun org-babel-expand-body:abc (body params) |
| 42 | "Expand BODY according to PARAMS, return the expanded body." | 44 | "Expand BODY according to PARAMS, return the expanded body." |
| 43 | (let ((vars (mapcar #'cdr (org-babel-get-header params :var)))) | 45 | (dolist (pair (mapcar #'cdr (org-babel-get-header params :var))) |
| 44 | (mapc | 46 | (let ((name (symbol-name (car pair))) |
| 45 | (lambda (pair) | 47 | (value (cdr pair))) |
| 46 | (let ((name (symbol-name (car pair))) | 48 | (setq body |
| 47 | (value (cdr pair))) | 49 | (replace-regexp-in-string |
| 48 | (setq body | 50 | (concat "\$" (regexp-quote name)) ;FIXME: "\$" == "$"! |
| 49 | (replace-regexp-in-string | 51 | (if (stringp value) value (format "%S" value)) |
| 50 | (concat "\$" (regexp-quote name)) | 52 | body)))) |
| 51 | (if (stringp value) value (format "%S" value)) | 53 | body) |
| 52 | body)))) | ||
| 53 | vars) | ||
| 54 | body)) | ||
| 55 | 54 | ||
| 56 | (defun org-babel-execute:abc (body params) | 55 | (defun org-babel-execute:abc (body params) |
| 57 | "Execute a block of ABC code with org-babel. This function is | 56 | "Execute a block of ABC code with org-babel. This function is |
| @@ -59,10 +58,10 @@ | |||
| 59 | (message "executing Abc source code block") | 58 | (message "executing Abc source code block") |
| 60 | (let* ((result-params (split-string (or (cdr (assoc :results params))))) | 59 | (let* ((result-params (split-string (or (cdr (assoc :results params))))) |
| 61 | (cmdline (cdr (assoc :cmdline params))) | 60 | (cmdline (cdr (assoc :cmdline params))) |
| 62 | (out-file ((lambda (el) | 61 | (out-file |
| 63 | (or el | 62 | (let ((el (cdr (assoc :file params)))) |
| 64 | (error "abc code block requires :file header argument"))) | 63 | (if el (replace-regexp-in-string "\\.pdf\\'" ".ps" el) |
| 65 | (replace-regexp-in-string "\.pdf$" ".ps" (cdr (assoc :file params))))) | 64 | (error "abc code block requires :file header argument")))) |
| 66 | (in-file (org-babel-temp-file "abc-")) | 65 | (in-file (org-babel-temp-file "abc-")) |
| 67 | (render (concat "abcm2ps" " " cmdline | 66 | (render (concat "abcm2ps" " " cmdline |
| 68 | " -O " (org-babel-process-file-name out-file) | 67 | " -O " (org-babel-process-file-name out-file) |
diff --git a/lisp/org/ob-awk.el b/lisp/org/ob-awk.el index 373d5fd9877..a9215d0b1c8 100644 --- a/lisp/org/ob-awk.el +++ b/lisp/org/ob-awk.el | |||
| @@ -59,34 +59,33 @@ called by `org-babel-execute-src-block'" | |||
| 59 | (cmd-line (cdr (assoc :cmd-line params))) | 59 | (cmd-line (cdr (assoc :cmd-line params))) |
| 60 | (in-file (cdr (assoc :in-file params))) | 60 | (in-file (cdr (assoc :in-file params))) |
| 61 | (full-body (org-babel-expand-body:awk body params)) | 61 | (full-body (org-babel-expand-body:awk body params)) |
| 62 | (code-file ((lambda (file) (with-temp-file file (insert full-body)) file) | 62 | (code-file (let ((file (org-babel-temp-file "awk-"))) |
| 63 | (org-babel-temp-file "awk-"))) | 63 | (with-temp-file file (insert full-body)) file)) |
| 64 | (stdin ((lambda (stdin) | 64 | (stdin (let ((stdin (cdr (assoc :stdin params)))) |
| 65 | (when stdin | 65 | (when stdin |
| 66 | (let ((tmp (org-babel-temp-file "awk-stdin-")) | 66 | (let ((tmp (org-babel-temp-file "awk-stdin-")) |
| 67 | (res (org-babel-ref-resolve stdin))) | 67 | (res (org-babel-ref-resolve stdin))) |
| 68 | (with-temp-file tmp | 68 | (with-temp-file tmp |
| 69 | (insert (org-babel-awk-var-to-awk res))) | 69 | (insert (org-babel-awk-var-to-awk res))) |
| 70 | tmp))) | 70 | tmp)))) |
| 71 | (cdr (assoc :stdin params)))) | ||
| 72 | (cmd (mapconcat #'identity (remove nil (list org-babel-awk-command | 71 | (cmd (mapconcat #'identity (remove nil (list org-babel-awk-command |
| 73 | "-f" code-file | 72 | "-f" code-file |
| 74 | cmd-line | 73 | cmd-line |
| 75 | in-file)) | 74 | in-file)) |
| 76 | " "))) | 75 | " "))) |
| 77 | (org-babel-reassemble-table | 76 | (org-babel-reassemble-table |
| 78 | ((lambda (results) | 77 | (let ((results |
| 79 | (when results | 78 | (cond |
| 80 | (org-babel-result-cond result-params | 79 | (stdin (with-temp-buffer |
| 81 | results | 80 | (call-process-shell-command cmd stdin (current-buffer)) |
| 82 | (let ((tmp (org-babel-temp-file "awk-results-"))) | 81 | (buffer-string))) |
| 83 | (with-temp-file tmp (insert results)) | 82 | (t (org-babel-eval cmd ""))))) |
| 84 | (org-babel-import-elisp-from-file tmp))))) | 83 | (when results |
| 85 | (cond | 84 | (org-babel-result-cond result-params |
| 86 | (stdin (with-temp-buffer | 85 | results |
| 87 | (call-process-shell-command cmd stdin (current-buffer)) | 86 | (let ((tmp (org-babel-temp-file "awk-results-"))) |
| 88 | (buffer-string))) | 87 | (with-temp-file tmp (insert results)) |
| 89 | (t (org-babel-eval cmd "")))) | 88 | (org-babel-import-elisp-from-file tmp))))) |
| 90 | (org-babel-pick-name | 89 | (org-babel-pick-name |
| 91 | (cdr (assoc :colname-names params)) (cdr (assoc :colnames params))) | 90 | (cdr (assoc :colname-names params)) (cdr (assoc :colnames params))) |
| 92 | (org-babel-pick-name | 91 | (org-babel-pick-name |
diff --git a/lisp/org/ob-calc.el b/lisp/org/ob-calc.el index 766f6cebb8e..b4201a18a02 100644 --- a/lisp/org/ob-calc.el +++ b/lisp/org/ob-calc.el | |||
| @@ -42,13 +42,15 @@ | |||
| 42 | (defun org-babel-expand-body:calc (body params) | 42 | (defun org-babel-expand-body:calc (body params) |
| 43 | "Expand BODY according to PARAMS, return the expanded body." body) | 43 | "Expand BODY according to PARAMS, return the expanded body." body) |
| 44 | 44 | ||
| 45 | (defvar org--var-syms) ; Dynamically scoped from org-babel-execute:calc | ||
| 46 | |||
| 45 | (defun org-babel-execute:calc (body params) | 47 | (defun org-babel-execute:calc (body params) |
| 46 | "Execute a block of calc code with Babel." | 48 | "Execute a block of calc code with Babel." |
| 47 | (unless (get-buffer "*Calculator*") | 49 | (unless (get-buffer "*Calculator*") |
| 48 | (save-window-excursion (calc) (calc-quit))) | 50 | (save-window-excursion (calc) (calc-quit))) |
| 49 | (let* ((vars (mapcar #'cdr (org-babel-get-header params :var))) | 51 | (let* ((vars (mapcar #'cdr (org-babel-get-header params :var))) |
| 50 | (var-syms (mapcar #'car vars)) | 52 | (org--var-syms (mapcar #'car vars)) |
| 51 | (var-names (mapcar #'symbol-name var-syms))) | 53 | (var-names (mapcar #'symbol-name org--var-syms))) |
| 52 | (mapc | 54 | (mapc |
| 53 | (lambda (pair) | 55 | (lambda (pair) |
| 54 | (calc-push-list (list (cdr pair))) | 56 | (calc-push-list (list (cdr pair))) |
| @@ -66,33 +68,32 @@ | |||
| 66 | ;; complex expression | 68 | ;; complex expression |
| 67 | (t | 69 | (t |
| 68 | (calc-push-list | 70 | (calc-push-list |
| 69 | (list ((lambda (res) | 71 | (list (let ((res (calc-eval line))) |
| 70 | (cond | 72 | (cond |
| 71 | ((numberp res) res) | 73 | ((numberp res) res) |
| 72 | ((math-read-number res) (math-read-number res)) | 74 | ((math-read-number res) (math-read-number res)) |
| 73 | ((listp res) (error "Calc error \"%s\" on input \"%s\"" | 75 | ((listp res) (error "Calc error \"%s\" on input \"%s\"" |
| 74 | (cadr res) line)) | 76 | (cadr res) line)) |
| 75 | (t (replace-regexp-in-string | 77 | (t (replace-regexp-in-string |
| 76 | "'" "" | 78 | "'" "" |
| 77 | (calc-eval | 79 | (calc-eval |
| 78 | (math-evaluate-expr | 80 | (math-evaluate-expr |
| 79 | ;; resolve user variables, calc built in | 81 | ;; resolve user variables, calc built in |
| 80 | ;; variables are handled automatically | 82 | ;; variables are handled automatically |
| 81 | ;; upstream by calc | 83 | ;; upstream by calc |
| 82 | (mapcar #'org-babel-calc-maybe-resolve-var | 84 | (mapcar #'org-babel-calc-maybe-resolve-var |
| 83 | ;; parse line into calc objects | 85 | ;; parse line into calc objects |
| 84 | (car (math-read-exprs line))))))))) | 86 | (car (math-read-exprs line))))))))) |
| 85 | (calc-eval line)))))))) | 87 | )))))) |
| 86 | (mapcar #'org-babel-trim | 88 | (mapcar #'org-babel-trim |
| 87 | (split-string (org-babel-expand-body:calc body params) "[\n\r]")))) | 89 | (split-string (org-babel-expand-body:calc body params) "[\n\r]")))) |
| 88 | (save-excursion | 90 | (save-excursion |
| 89 | (with-current-buffer (get-buffer "*Calculator*") | 91 | (with-current-buffer (get-buffer "*Calculator*") |
| 90 | (calc-eval (calc-top 1))))) | 92 | (calc-eval (calc-top 1))))) |
| 91 | 93 | ||
| 92 | (defvar var-syms) ; Dynamically scoped from org-babel-execute:calc | ||
| 93 | (defun org-babel-calc-maybe-resolve-var (el) | 94 | (defun org-babel-calc-maybe-resolve-var (el) |
| 94 | (if (consp el) | 95 | (if (consp el) |
| 95 | (if (and (equal 'var (car el)) (member (cadr el) var-syms)) | 96 | (if (and (equal 'var (car el)) (member (cadr el) org--var-syms)) |
| 96 | (progn | 97 | (progn |
| 97 | (calc-recall (cadr el)) | 98 | (calc-recall (cadr el)) |
| 98 | (prog1 (calc-top 1) | 99 | (prog1 (calc-top 1) |
diff --git a/lisp/org/ob-clojure.el b/lisp/org/ob-clojure.el index bc2bbc0d095..25b39f7f733 100644 --- a/lisp/org/ob-clojure.el +++ b/lisp/org/ob-clojure.el | |||
| @@ -24,17 +24,17 @@ | |||
| 24 | 24 | ||
| 25 | ;;; Commentary: | 25 | ;;; Commentary: |
| 26 | 26 | ||
| 27 | ;;; support for evaluating clojure code, relies on slime for all eval | 27 | ;; Support for evaluating clojure code, relies on slime for all eval. |
| 28 | 28 | ||
| 29 | ;;; Requirements: | 29 | ;;; Requirements: |
| 30 | 30 | ||
| 31 | ;;; - clojure (at least 1.2.0) | 31 | ;; - clojure (at least 1.2.0) |
| 32 | ;;; - clojure-mode | 32 | ;; - clojure-mode |
| 33 | ;;; - slime | 33 | ;; - slime |
| 34 | 34 | ||
| 35 | ;;; By far, the best way to install these components is by following | 35 | ;; By far, the best way to install these components is by following |
| 36 | ;;; the directions as set out by Phil Hagelberg (Technomancy) on the | 36 | ;; the directions as set out by Phil Hagelberg (Technomancy) on the |
| 37 | ;;; web page: http://technomancy.us/126 | 37 | ;; web page: http://technomancy.us/126 |
| 38 | 38 | ||
| 39 | ;;; Code: | 39 | ;;; Code: |
| 40 | (require 'ob) | 40 | (require 'ob) |
| @@ -77,16 +77,16 @@ | |||
| 77 | (require 'slime) | 77 | (require 'slime) |
| 78 | (with-temp-buffer | 78 | (with-temp-buffer |
| 79 | (insert (org-babel-expand-body:clojure body params)) | 79 | (insert (org-babel-expand-body:clojure body params)) |
| 80 | ((lambda (result) | 80 | (let ((result |
| 81 | (let ((result-params (cdr (assoc :result-params params)))) | 81 | (slime-eval |
| 82 | (org-babel-result-cond result-params | 82 | `(swank:eval-and-grab-output |
| 83 | result | 83 | ,(buffer-substring-no-properties (point-min) (point-max))) |
| 84 | (condition-case nil (org-babel-script-escape result) | 84 | (cdr (assoc :package params))))) |
| 85 | (error result))))) | 85 | (let ((result-params (cdr (assoc :result-params params)))) |
| 86 | (slime-eval | 86 | (org-babel-result-cond result-params |
| 87 | `(swank:eval-and-grab-output | 87 | result |
| 88 | ,(buffer-substring-no-properties (point-min) (point-max))) | 88 | (condition-case nil (org-babel-script-escape result) |
| 89 | (cdr (assoc :package params)))))) | 89 | (error result))))))) |
| 90 | 90 | ||
| 91 | (provide 'ob-clojure) | 91 | (provide 'ob-clojure) |
| 92 | 92 | ||
diff --git a/lisp/org/ob-core.el b/lisp/org/ob-core.el index cc6b7a93d69..0ec945d6ad8 100644 --- a/lisp/org/ob-core.el +++ b/lisp/org/ob-core.el | |||
| @@ -632,15 +632,14 @@ block." | |||
| 632 | (message "result silenced") | 632 | (message "result silenced") |
| 633 | (setq result nil)) | 633 | (setq result nil)) |
| 634 | (setq result | 634 | (setq result |
| 635 | ((lambda (result) | 635 | (let ((result (funcall cmd body params))) |
| 636 | (if (and (eq (cdr (assoc :result-type params)) | 636 | (if (and (eq (cdr (assoc :result-type params)) |
| 637 | 'value) | 637 | 'value) |
| 638 | (or (member "vector" result-params) | 638 | (or (member "vector" result-params) |
| 639 | (member "table" result-params)) | 639 | (member "table" result-params)) |
| 640 | (not (listp result))) | 640 | (not (listp result))) |
| 641 | (list (list result)) result)) | 641 | (list (list result)) result))) |
| 642 | (funcall cmd body params))) | 642 | ;; If non-empty result and :file then write to :file. |
| 643 | ;; if non-empty result and :file then write to :file | ||
| 644 | (when (cdr (assoc :file params)) | 643 | (when (cdr (assoc :file params)) |
| 645 | (when result | 644 | (when result |
| 646 | (with-temp-file (cdr (assoc :file params)) | 645 | (with-temp-file (cdr (assoc :file params)) |
| @@ -648,7 +647,7 @@ block." | |||
| 648 | (org-babel-format-result | 647 | (org-babel-format-result |
| 649 | result (cdr (assoc :sep (nth 2 info))))))) | 648 | result (cdr (assoc :sep (nth 2 info))))))) |
| 650 | (setq result (cdr (assoc :file params)))) | 649 | (setq result (cdr (assoc :file params)))) |
| 651 | ;; possibly perform post process provided its appropriate | 650 | ;; Possibly perform post process provided its appropriate. |
| 652 | (when (cdr (assoc :post params)) | 651 | (when (cdr (assoc :post params)) |
| 653 | (let ((*this* (if (cdr (assoc :file params)) | 652 | (let ((*this* (if (cdr (assoc :file params)) |
| 654 | (org-babel-result-to-file | 653 | (org-babel-result-to-file |
| @@ -893,6 +892,8 @@ with a prefix argument then this is passed on to | |||
| 893 | 892 | ||
| 894 | (defalias 'org-babel-pop-to-session 'org-babel-switch-to-session) | 893 | (defalias 'org-babel-pop-to-session 'org-babel-switch-to-session) |
| 895 | 894 | ||
| 895 | (defvar org-src-window-setup) | ||
| 896 | |||
| 896 | ;;;###autoload | 897 | ;;;###autoload |
| 897 | (defun org-babel-switch-to-session-with-code (&optional arg info) | 898 | (defun org-babel-switch-to-session-with-code (&optional arg info) |
| 898 | "Switch to code buffer and display session." | 899 | "Switch to code buffer and display session." |
| @@ -1157,18 +1158,18 @@ the current subtree." | |||
| 1157 | (mapconcat #'identity (sort (funcall rm (split-string v)) | 1158 | (mapconcat #'identity (sort (funcall rm (split-string v)) |
| 1158 | #'string<) " ")) | 1159 | #'string<) " ")) |
| 1159 | (t v))))))) | 1160 | (t v))))))) |
| 1160 | ((lambda (hash) | 1161 | (let* ((it (format "%s-%s" |
| 1161 | (when (org-called-interactively-p 'interactive) (message hash)) hash) | 1162 | (mapconcat |
| 1162 | (let ((it (format "%s-%s" | 1163 | #'identity |
| 1163 | (mapconcat | 1164 | (delq nil (mapcar (lambda (arg) |
| 1164 | #'identity | 1165 | (let ((normalized (funcall norm arg))) |
| 1165 | (delq nil (mapcar (lambda (arg) | 1166 | (when normalized |
| 1166 | (let ((normalized (funcall norm arg))) | 1167 | (format "%S" normalized)))) |
| 1167 | (when normalized | 1168 | (nth 2 info))) ":") |
| 1168 | (format "%S" normalized)))) | 1169 | (nth 1 info))) |
| 1169 | (nth 2 info))) ":") | 1170 | (hash (sha1 it))) |
| 1170 | (nth 1 info)))) | 1171 | (when (org-called-interactively-p 'interactive) (message hash)) |
| 1171 | (sha1 it)))))) | 1172 | hash)))) |
| 1172 | 1173 | ||
| 1173 | (defun org-babel-current-result-hash () | 1174 | (defun org-babel-current-result-hash () |
| 1174 | "Return the current in-buffer hash." | 1175 | "Return the current in-buffer hash." |
| @@ -1453,9 +1454,8 @@ instances of \"[ \t]:\" set ALTS to '((32 9) . 58)." | |||
| 1453 | (cons (intern (match-string 1 arg)) | 1454 | (cons (intern (match-string 1 arg)) |
| 1454 | (org-babel-read (org-babel-chomp (match-string 2 arg)))) | 1455 | (org-babel-read (org-babel-chomp (match-string 2 arg)))) |
| 1455 | (cons (intern (org-babel-chomp arg)) nil))) | 1456 | (cons (intern (org-babel-chomp arg)) nil))) |
| 1456 | ((lambda (raw) | 1457 | (let ((raw (org-babel-balanced-split arg-string '((32 9) . 58)))) |
| 1457 | (cons (car raw) (mapcar (lambda (r) (concat ":" r)) (cdr raw)))) | 1458 | (cons (car raw) (mapcar (lambda (r) (concat ":" r)) (cdr raw))))))))) |
| 1458 | (org-babel-balanced-split arg-string '((32 9) . 58)))))))) | ||
| 1459 | 1459 | ||
| 1460 | (defun org-babel-parse-multiple-vars (header-arguments) | 1460 | (defun org-babel-parse-multiple-vars (header-arguments) |
| 1461 | "Expand multiple variable assignments behind a single :var keyword. | 1461 | "Expand multiple variable assignments behind a single :var keyword. |
| @@ -1598,12 +1598,11 @@ of the vars, cnames and rnames." | |||
| 1598 | Given a TABLE and set of COLNAMES and ROWNAMES add the names | 1598 | Given a TABLE and set of COLNAMES and ROWNAMES add the names |
| 1599 | to the table for reinsertion to org-mode." | 1599 | to the table for reinsertion to org-mode." |
| 1600 | (if (listp table) | 1600 | (if (listp table) |
| 1601 | ((lambda (table) | 1601 | (let ((table (if (and rownames (= (length table) (length rownames))) |
| 1602 | (if (and colnames (listp (car table)) (= (length (car table)) | 1602 | (org-babel-put-rownames table rownames) table))) |
| 1603 | (length colnames))) | 1603 | (if (and colnames (listp (car table)) (= (length (car table)) |
| 1604 | (org-babel-put-colnames table colnames) table)) | 1604 | (length colnames))) |
| 1605 | (if (and rownames (= (length table) (length rownames))) | 1605 | (org-babel-put-colnames table colnames) table)) |
| 1606 | (org-babel-put-rownames table rownames) table)) | ||
| 1607 | table)) | 1606 | table)) |
| 1608 | 1607 | ||
| 1609 | (defun org-babel-where-is-src-block-head () | 1608 | (defun org-babel-where-is-src-block-head () |
| @@ -1640,9 +1639,8 @@ If the point is not on a source block then return nil." | |||
| 1640 | (defun org-babel-goto-src-block-head () | 1639 | (defun org-babel-goto-src-block-head () |
| 1641 | "Go to the beginning of the current code block." | 1640 | "Go to the beginning of the current code block." |
| 1642 | (interactive) | 1641 | (interactive) |
| 1643 | ((lambda (head) | 1642 | (let ((head (org-babel-where-is-src-block-head))) |
| 1644 | (if head (goto-char head) (error "Not currently in a code block"))) | 1643 | (if head (goto-char head) (error "Not currently in a code block")))) |
| 1645 | (org-babel-where-is-src-block-head))) | ||
| 1646 | 1644 | ||
| 1647 | ;;;###autoload | 1645 | ;;;###autoload |
| 1648 | (defun org-babel-goto-named-src-block (name) | 1646 | (defun org-babel-goto-named-src-block (name) |
| @@ -1763,14 +1761,13 @@ With optional prefix argument ARG, jump backward ARG many source blocks." | |||
| 1763 | (defun org-babel-mark-block () | 1761 | (defun org-babel-mark-block () |
| 1764 | "Mark current src block." | 1762 | "Mark current src block." |
| 1765 | (interactive) | 1763 | (interactive) |
| 1766 | ((lambda (head) | 1764 | (let ((head (org-babel-where-is-src-block-head))) |
| 1767 | (when head | 1765 | (when head |
| 1768 | (save-excursion | 1766 | (save-excursion |
| 1769 | (goto-char head) | 1767 | (goto-char head) |
| 1770 | (looking-at org-babel-src-block-regexp)) | 1768 | (looking-at org-babel-src-block-regexp)) |
| 1771 | (push-mark (match-end 5) nil t) | 1769 | (push-mark (match-end 5) nil t) |
| 1772 | (goto-char (match-beginning 5)))) | 1770 | (goto-char (match-beginning 5))))) |
| 1773 | (org-babel-where-is-src-block-head))) | ||
| 1774 | 1771 | ||
| 1775 | (defun org-babel-demarcate-block (&optional arg) | 1772 | (defun org-babel-demarcate-block (&optional arg) |
| 1776 | "Wrap or split the code in the region or on the point. | 1773 | "Wrap or split the code in the region or on the point. |
| @@ -2450,7 +2447,7 @@ block but are passed literally to the \"example-block\"." | |||
| 2450 | (funcall (intern (concat lang "-mode"))) | 2447 | (funcall (intern (concat lang "-mode"))) |
| 2451 | (comment-region (point) (progn (insert text) (point))) | 2448 | (comment-region (point) (progn (insert text) (point))) |
| 2452 | (org-babel-trim (buffer-string))))) | 2449 | (org-babel-trim (buffer-string))))) |
| 2453 | index source-name evaluate prefix blocks-in-buffer) | 2450 | index source-name evaluate prefix) |
| 2454 | (with-temp-buffer | 2451 | (with-temp-buffer |
| 2455 | (org-set-local 'org-babel-noweb-wrap-start ob-nww-start) | 2452 | (org-set-local 'org-babel-noweb-wrap-start ob-nww-start) |
| 2456 | (org-set-local 'org-babel-noweb-wrap-end ob-nww-end) | 2453 | (org-set-local 'org-babel-noweb-wrap-end ob-nww-end) |
| @@ -2469,119 +2466,118 @@ block but are passed literally to the \"example-block\"." | |||
| 2469 | (funcall nb-add (buffer-substring index (point))) | 2466 | (funcall nb-add (buffer-substring index (point))) |
| 2470 | (goto-char (match-end 0)) | 2467 | (goto-char (match-end 0)) |
| 2471 | (setq index (point)) | 2468 | (setq index (point)) |
| 2472 | (funcall nb-add | 2469 | (funcall |
| 2473 | (with-current-buffer parent-buffer | 2470 | nb-add |
| 2474 | (save-restriction | 2471 | (with-current-buffer parent-buffer |
| 2475 | (widen) | 2472 | (save-restriction |
| 2476 | (mapconcat ;; interpose PREFIX between every line | 2473 | (widen) |
| 2477 | #'identity | 2474 | (mapconcat ;; Interpose PREFIX between every line. |
| 2478 | (split-string | 2475 | #'identity |
| 2479 | (if evaluate | 2476 | (split-string |
| 2480 | (let ((raw (org-babel-ref-resolve source-name))) | 2477 | (if evaluate |
| 2481 | (if (stringp raw) raw (format "%S" raw))) | 2478 | (let ((raw (org-babel-ref-resolve source-name))) |
| 2482 | (or | 2479 | (if (stringp raw) raw (format "%S" raw))) |
| 2483 | ;; retrieve from the library of babel | 2480 | (or |
| 2484 | (nth 2 (assoc (intern source-name) | 2481 | ;; Retrieve from the library of babel. |
| 2485 | org-babel-library-of-babel)) | 2482 | (nth 2 (assoc (intern source-name) |
| 2486 | ;; return the contents of headlines literally | 2483 | org-babel-library-of-babel)) |
| 2487 | (save-excursion | 2484 | ;; Return the contents of headlines literally. |
| 2488 | (when (org-babel-ref-goto-headline-id source-name) | 2485 | (save-excursion |
| 2486 | (when (org-babel-ref-goto-headline-id source-name) | ||
| 2489 | (org-babel-ref-headline-body))) | 2487 | (org-babel-ref-headline-body))) |
| 2490 | ;; find the expansion of reference in this buffer | 2488 | ;; Find the expansion of reference in this buffer. |
| 2491 | (let ((rx (concat rx-prefix source-name "[ \t\n]")) | 2489 | (let ((rx (concat rx-prefix source-name "[ \t\n]")) |
| 2492 | expansion) | 2490 | expansion) |
| 2493 | (save-excursion | 2491 | (save-excursion |
| 2494 | (goto-char (point-min)) | 2492 | (goto-char (point-min)) |
| 2495 | (if org-babel-use-quick-and-dirty-noweb-expansion | 2493 | (if org-babel-use-quick-and-dirty-noweb-expansion |
| 2496 | (while (re-search-forward rx nil t) | 2494 | (while (re-search-forward rx nil t) |
| 2497 | (let* ((i (org-babel-get-src-block-info 'light)) | 2495 | (let* ((i (org-babel-get-src-block-info 'light)) |
| 2498 | (body (org-babel-expand-noweb-references i)) | 2496 | (body (org-babel-expand-noweb-references i)) |
| 2499 | (sep (or (cdr (assoc :noweb-sep (nth 2 i))) | 2497 | (sep (or (cdr (assoc :noweb-sep (nth 2 i))) |
| 2500 | "\n")) | 2498 | "\n")) |
| 2501 | (full (if comment | 2499 | (full (if comment |
| 2502 | ((lambda (cs) | 2500 | (let ((cs (org-babel-tangle-comment-links i))) |
| 2503 | (concat (funcall c-wrap (car cs)) "\n" | 2501 | (concat (funcall c-wrap (car cs)) "\n" |
| 2504 | body "\n" | 2502 | body "\n" |
| 2505 | (funcall c-wrap (cadr cs)))) | 2503 | (funcall c-wrap (cadr cs)))) |
| 2506 | (org-babel-tangle-comment-links i)) | 2504 | body))) |
| 2507 | body))) | 2505 | (setq expansion (cons sep (cons full expansion))))) |
| 2508 | (setq expansion (cons sep (cons full expansion))))) | 2506 | (org-babel-map-src-blocks nil |
| 2509 | (org-babel-map-src-blocks nil | 2507 | (let ((i (org-babel-get-src-block-info 'light))) |
| 2510 | (let ((i (org-babel-get-src-block-info 'light))) | 2508 | (when (equal (or (cdr (assoc :noweb-ref (nth 2 i))) |
| 2511 | (when (equal (or (cdr (assoc :noweb-ref (nth 2 i))) | 2509 | (nth 4 i)) |
| 2512 | (nth 4 i)) | 2510 | source-name) |
| 2513 | source-name) | 2511 | (let* ((body (org-babel-expand-noweb-references i)) |
| 2514 | (let* ((body (org-babel-expand-noweb-references i)) | 2512 | (sep (or (cdr (assoc :noweb-sep (nth 2 i))) |
| 2515 | (sep (or (cdr (assoc :noweb-sep (nth 2 i))) | 2513 | "\n")) |
| 2516 | "\n")) | 2514 | (full (if comment |
| 2517 | (full (if comment | 2515 | (let ((cs (org-babel-tangle-comment-links i))) |
| 2518 | ((lambda (cs) | 2516 | (concat (funcall c-wrap (car cs)) "\n" |
| 2519 | (concat (funcall c-wrap (car cs)) "\n" | 2517 | body "\n" |
| 2520 | body "\n" | 2518 | (funcall c-wrap (cadr cs)))) |
| 2521 | (funcall c-wrap (cadr cs)))) | 2519 | body))) |
| 2522 | (org-babel-tangle-comment-links i)) | 2520 | (setq expansion |
| 2523 | body))) | 2521 | (cons sep (cons full expansion))))))))) |
| 2524 | (setq expansion | 2522 | (and expansion |
| 2525 | (cons sep (cons full expansion))))))))) | 2523 | (mapconcat #'identity (nreverse (cdr expansion)) ""))) |
| 2526 | (and expansion | 2524 | ;; Possibly raise an error if named block doesn't exist. |
| 2527 | (mapconcat #'identity (nreverse (cdr expansion)) ""))) | 2525 | (if (member lang org-babel-noweb-error-langs) |
| 2528 | ;; possibly raise an error if named block doesn't exist | 2526 | (error "%s" (concat |
| 2529 | (if (member lang org-babel-noweb-error-langs) | 2527 | (org-babel-noweb-wrap source-name) |
| 2530 | (error "%s" (concat | 2528 | "could not be resolved (see " |
| 2531 | (org-babel-noweb-wrap source-name) | 2529 | "`org-babel-noweb-error-langs')")) |
| 2532 | "could not be resolved (see " | 2530 | ""))) |
| 2533 | "`org-babel-noweb-error-langs')")) | 2531 | "[\n\r]") (concat "\n" prefix)))))) |
| 2534 | ""))) | ||
| 2535 | "[\n\r]") (concat "\n" prefix)))))) | ||
| 2536 | (funcall nb-add (buffer-substring index (point-max)))) | 2532 | (funcall nb-add (buffer-substring index (point-max)))) |
| 2537 | new-body)) | 2533 | new-body)) |
| 2538 | 2534 | ||
| 2539 | (defun org-babel-script-escape (str &optional force) | 2535 | (defun org-babel-script-escape (str &optional force) |
| 2540 | "Safely convert tables into elisp lists." | 2536 | "Safely convert tables into elisp lists." |
| 2541 | (let (in-single in-double out) | 2537 | (let ((escaped |
| 2542 | ((lambda (escaped) (condition-case nil (org-babel-read escaped) (error escaped))) | 2538 | (if (or force |
| 2543 | (if (or force | 2539 | (and (stringp str) |
| 2544 | (and (stringp str) | 2540 | (> (length str) 2) |
| 2545 | (> (length str) 2) | 2541 | (or (and (string-equal "[" (substring str 0 1)) |
| 2546 | (or (and (string-equal "[" (substring str 0 1)) | 2542 | (string-equal "]" (substring str -1))) |
| 2547 | (string-equal "]" (substring str -1))) | 2543 | (and (string-equal "{" (substring str 0 1)) |
| 2548 | (and (string-equal "{" (substring str 0 1)) | 2544 | (string-equal "}" (substring str -1))) |
| 2549 | (string-equal "}" (substring str -1))) | 2545 | (and (string-equal "(" (substring str 0 1)) |
| 2550 | (and (string-equal "(" (substring str 0 1)) | 2546 | (string-equal ")" (substring str -1)))))) |
| 2551 | (string-equal ")" (substring str -1)))))) | 2547 | (org-babel-read |
| 2552 | (org-babel-read | 2548 | (concat |
| 2553 | (concat | 2549 | "'" |
| 2554 | "'" | 2550 | (let (in-single in-double out) |
| 2555 | (progn | 2551 | (mapc |
| 2556 | (mapc | 2552 | (lambda (ch) |
| 2557 | (lambda (ch) | 2553 | (setq |
| 2558 | (setq | 2554 | out |
| 2559 | out | 2555 | (case ch |
| 2560 | (case ch | 2556 | (91 (if (or in-double in-single) ; [ |
| 2561 | (91 (if (or in-double in-single) ; [ | 2557 | (cons 91 out) |
| 2562 | (cons 91 out) | 2558 | (cons 40 out))) |
| 2563 | (cons 40 out))) | 2559 | (93 (if (or in-double in-single) ; ] |
| 2564 | (93 (if (or in-double in-single) ; ] | 2560 | (cons 93 out) |
| 2565 | (cons 93 out) | 2561 | (cons 41 out))) |
| 2566 | (cons 41 out))) | 2562 | (123 (if (or in-double in-single) ; { |
| 2567 | (123 (if (or in-double in-single) ; { | 2563 | (cons 123 out) |
| 2568 | (cons 123 out) | 2564 | (cons 40 out))) |
| 2569 | (cons 40 out))) | 2565 | (125 (if (or in-double in-single) ; } |
| 2570 | (125 (if (or in-double in-single) ; } | 2566 | (cons 125 out) |
| 2571 | (cons 125 out) | 2567 | (cons 41 out))) |
| 2572 | (cons 41 out))) | 2568 | (44 (if (or in-double in-single) ; , |
| 2573 | (44 (if (or in-double in-single) ; , | 2569 | (cons 44 out) (cons 32 out))) |
| 2574 | (cons 44 out) (cons 32 out))) | 2570 | (39 (if in-double ; ' |
| 2575 | (39 (if in-double ; ' | 2571 | (cons 39 out) |
| 2576 | (cons 39 out) | 2572 | (setq in-single (not in-single)) (cons 34 out))) |
| 2577 | (setq in-single (not in-single)) (cons 34 out))) | 2573 | (34 (if in-single ; " |
| 2578 | (34 (if in-single ; " | 2574 | (append (list 34 32) out) |
| 2579 | (append (list 34 32) out) | 2575 | (setq in-double (not in-double)) (cons 34 out))) |
| 2580 | (setq in-double (not in-double)) (cons 34 out))) | 2576 | (t (cons ch out))))) |
| 2581 | (t (cons ch out))))) | 2577 | (string-to-list str)) |
| 2582 | (string-to-list str)) | 2578 | (apply #'string (reverse out))))) |
| 2583 | (apply #'string (reverse out))))) | 2579 | str))) |
| 2584 | str)))) | 2580 | (condition-case nil (org-babel-read escaped) (error escaped)))) |
| 2585 | 2581 | ||
| 2586 | (defun org-babel-read (cell &optional inhibit-lisp-eval) | 2582 | (defun org-babel-read (cell &optional inhibit-lisp-eval) |
| 2587 | "Convert the string value of CELL to a number if appropriate. | 2583 | "Convert the string value of CELL to a number if appropriate. |
| @@ -2691,8 +2687,8 @@ name is removed, since in that case the process will be executing | |||
| 2691 | remotely. The file name is then processed by `expand-file-name'. | 2687 | remotely. The file name is then processed by `expand-file-name'. |
| 2692 | Unless second argument NO-QUOTE-P is non-nil, the file name is | 2688 | Unless second argument NO-QUOTE-P is non-nil, the file name is |
| 2693 | additionally processed by `shell-quote-argument'" | 2689 | additionally processed by `shell-quote-argument'" |
| 2694 | ((lambda (f) (if no-quote-p f (shell-quote-argument f))) | 2690 | (let ((f (expand-file-name (org-babel-local-file-name name)))) |
| 2695 | (expand-file-name (org-babel-local-file-name name)))) | 2691 | (if no-quote-p f (shell-quote-argument f)))) |
| 2696 | 2692 | ||
| 2697 | (defvar org-babel-temporary-directory) | 2693 | (defvar org-babel-temporary-directory) |
| 2698 | (unless (or noninteractive (boundp 'org-babel-temporary-directory)) | 2694 | (unless (or noninteractive (boundp 'org-babel-temporary-directory)) |
diff --git a/lisp/org/ob-ditaa.el b/lisp/org/ob-ditaa.el index 60ab8c598dc..36681d0ad29 100644 --- a/lisp/org/ob-ditaa.el +++ b/lisp/org/ob-ditaa.el | |||
| @@ -82,11 +82,10 @@ Do not leave leading or trailing spaces in this string." | |||
| 82 | "Execute a block of Ditaa code with org-babel. | 82 | "Execute a block of Ditaa code with org-babel. |
| 83 | This function is called by `org-babel-execute-src-block'." | 83 | This function is called by `org-babel-execute-src-block'." |
| 84 | (let* ((result-params (split-string (or (cdr (assoc :results params)) ""))) | 84 | (let* ((result-params (split-string (or (cdr (assoc :results params)) ""))) |
| 85 | (out-file ((lambda (el) | 85 | (out-file (let ((el (cdr (assoc :file params)))) |
| 86 | (or el | 86 | (or el |
| 87 | (error | 87 | (error |
| 88 | "ditaa code block requires :file header argument"))) | 88 | "ditaa code block requires :file header argument")))) |
| 89 | (cdr (assoc :file params)))) | ||
| 90 | (cmdline (cdr (assoc :cmdline params))) | 89 | (cmdline (cdr (assoc :cmdline params))) |
| 91 | (java (cdr (assoc :java params))) | 90 | (java (cdr (assoc :java params))) |
| 92 | (in-file (org-babel-temp-file "ditaa-")) | 91 | (in-file (org-babel-temp-file "ditaa-")) |
diff --git a/lisp/org/ob-emacs-lisp.el b/lisp/org/ob-emacs-lisp.el index 886645dc9c3..a30e369ec7a 100644 --- a/lisp/org/ob-emacs-lisp.el +++ b/lisp/org/ob-emacs-lisp.el | |||
| @@ -54,25 +54,26 @@ | |||
| 54 | (defun org-babel-execute:emacs-lisp (body params) | 54 | (defun org-babel-execute:emacs-lisp (body params) |
| 55 | "Execute a block of emacs-lisp code with Babel." | 55 | "Execute a block of emacs-lisp code with Babel." |
| 56 | (save-window-excursion | 56 | (save-window-excursion |
| 57 | ((lambda (result) | 57 | (let ((result |
| 58 | (org-babel-result-cond (cdr (assoc :result-params params)) | 58 | (eval (read (format (if (member "output" |
| 59 | (let ((print-level nil) | 59 | (cdr (assoc :result-params params))) |
| 60 | (print-length nil)) | 60 | "(with-output-to-string %s)" |
| 61 | (if (or (member "scalar" (cdr (assoc :result-params params))) | 61 | "(progn %s)") |
| 62 | (member "verbatim" (cdr (assoc :result-params params)))) | 62 | (org-babel-expand-body:emacs-lisp |
| 63 | (format "%S" result) | 63 | body params)))))) |
| 64 | (format "%s" result))) | 64 | (org-babel-result-cond (cdr (assoc :result-params params)) |
| 65 | (org-babel-reassemble-table | 65 | (let ((print-level nil) |
| 66 | result | 66 | (print-length nil)) |
| 67 | (org-babel-pick-name (cdr (assoc :colname-names params)) | 67 | (if (or (member "scalar" (cdr (assoc :result-params params))) |
| 68 | (cdr (assoc :colnames params))) | 68 | (member "verbatim" (cdr (assoc :result-params params)))) |
| 69 | (org-babel-pick-name (cdr (assoc :rowname-names params)) | 69 | (format "%S" result) |
| 70 | (cdr (assoc :rownames params)))))) | 70 | (format "%s" result))) |
| 71 | (eval (read (format (if (member "output" | 71 | (org-babel-reassemble-table |
| 72 | (cdr (assoc :result-params params))) | 72 | result |
| 73 | "(with-output-to-string %s)" | 73 | (org-babel-pick-name (cdr (assoc :colname-names params)) |
| 74 | "(progn %s)") | 74 | (cdr (assoc :colnames params))) |
| 75 | (org-babel-expand-body:emacs-lisp body params))))))) | 75 | (org-babel-pick-name (cdr (assoc :rowname-names params)) |
| 76 | (cdr (assoc :rownames params)))))))) | ||
| 76 | 77 | ||
| 77 | (provide 'ob-emacs-lisp) | 78 | (provide 'ob-emacs-lisp) |
| 78 | 79 | ||
diff --git a/lisp/org/ob-exp.el b/lisp/org/ob-exp.el index c8479e36d7a..d6d4566c29f 100644 --- a/lisp/org/ob-exp.el +++ b/lisp/org/ob-exp.el | |||
| @@ -69,6 +69,8 @@ be executed." | |||
| 69 | ('otherwise | 69 | ('otherwise |
| 70 | (error "Requested export buffer when `org-current-export-file' is nil")))) | 70 | (error "Requested export buffer when `org-current-export-file' is nil")))) |
| 71 | 71 | ||
| 72 | (defvar org-link-search-inhibit-query) | ||
| 73 | |||
| 72 | (defmacro org-babel-exp-in-export-file (lang &rest body) | 74 | (defmacro org-babel-exp-in-export-file (lang &rest body) |
| 73 | (declare (indent 1)) | 75 | (declare (indent 1)) |
| 74 | `(let* ((lang-headers (intern (concat "org-babel-default-header-args:" ,lang))) | 76 | `(let* ((lang-headers (intern (concat "org-babel-default-header-args:" ,lang))) |
| @@ -372,7 +374,7 @@ replaced with its value." | |||
| 372 | (cons (substring (symbol-name (car pair)) 1) | 374 | (cons (substring (symbol-name (car pair)) 1) |
| 373 | (format "%S" (cdr pair)))) | 375 | (format "%S" (cdr pair)))) |
| 374 | (nth 2 info)) | 376 | (nth 2 info)) |
| 375 | ("flags" . ,((lambda (f) (when f (concat " " f))) (nth 3 info))) | 377 | ("flags" . ,(let ((f (nth 3 info))) (when f (concat " " f)))) |
| 376 | ("name" . ,(or (nth 4 info) ""))))) | 378 | ("name" . ,(or (nth 4 info) ""))))) |
| 377 | 379 | ||
| 378 | (defun org-babel-exp-results (info type &optional silent hash) | 380 | (defun org-babel-exp-results (info type &optional silent hash) |
diff --git a/lisp/org/ob-fortran.el b/lisp/org/ob-fortran.el index df7bfa00c1c..61cb19a56c5 100644 --- a/lisp/org/ob-fortran.el +++ b/lisp/org/ob-fortran.el | |||
| @@ -60,20 +60,20 @@ | |||
| 60 | (mapconcat 'identity | 60 | (mapconcat 'identity |
| 61 | (if (listp flags) flags (list flags)) " ") | 61 | (if (listp flags) flags (list flags)) " ") |
| 62 | (org-babel-process-file-name tmp-src-file)) "")))) | 62 | (org-babel-process-file-name tmp-src-file)) "")))) |
| 63 | ((lambda (results) | 63 | (let ((results |
| 64 | (org-babel-reassemble-table | 64 | (org-babel-trim |
| 65 | (org-babel-result-cond (cdr (assoc :result-params params)) | 65 | (org-babel-eval |
| 66 | (org-babel-read results) | 66 | (concat tmp-bin-file (if cmdline (concat " " cmdline) "")) "")))) |
| 67 | (let ((tmp-file (org-babel-temp-file "f-"))) | 67 | (org-babel-reassemble-table |
| 68 | (with-temp-file tmp-file (insert results)) | 68 | (org-babel-result-cond (cdr (assoc :result-params params)) |
| 69 | (org-babel-import-elisp-from-file tmp-file))) | 69 | (org-babel-read results) |
| 70 | (org-babel-pick-name | 70 | (let ((tmp-file (org-babel-temp-file "f-"))) |
| 71 | (cdr (assoc :colname-names params)) (cdr (assoc :colnames params))) | 71 | (with-temp-file tmp-file (insert results)) |
| 72 | (org-babel-pick-name | 72 | (org-babel-import-elisp-from-file tmp-file))) |
| 73 | (cdr (assoc :rowname-names params)) (cdr (assoc :rownames params))))) | 73 | (org-babel-pick-name |
| 74 | (org-babel-trim | 74 | (cdr (assoc :colname-names params)) (cdr (assoc :colnames params))) |
| 75 | (org-babel-eval | 75 | (org-babel-pick-name |
| 76 | (concat tmp-bin-file (if cmdline (concat " " cmdline) "")) ""))))) | 76 | (cdr (assoc :rowname-names params)) (cdr (assoc :rownames params))))))) |
| 77 | 77 | ||
| 78 | (defun org-babel-expand-body:fortran (body params) | 78 | (defun org-babel-expand-body:fortran (body params) |
| 79 | "Expand a block of fortran or fortran code with org-babel according to | 79 | "Expand a block of fortran or fortran code with org-babel according to |
diff --git a/lisp/org/ob-haskell.el b/lisp/org/ob-haskell.el index a0127119162..6c9fed14fa3 100644 --- a/lisp/org/ob-haskell.el +++ b/lisp/org/ob-haskell.el | |||
| @@ -79,12 +79,12 @@ | |||
| 79 | (cdr (member org-babel-haskell-eoe | 79 | (cdr (member org-babel-haskell-eoe |
| 80 | (reverse (mapcar #'org-babel-trim raw))))))) | 80 | (reverse (mapcar #'org-babel-trim raw))))))) |
| 81 | (org-babel-reassemble-table | 81 | (org-babel-reassemble-table |
| 82 | ((lambda (result) | 82 | (let ((result |
| 83 | (org-babel-result-cond (cdr (assoc :result-params params)) | 83 | (case result-type |
| 84 | result (org-babel-haskell-table-or-string result))) | 84 | (output (mapconcat #'identity (reverse (cdr results)) "\n")) |
| 85 | (case result-type | 85 | (value (car results))))) |
| 86 | ('output (mapconcat #'identity (reverse (cdr results)) "\n")) | 86 | (org-babel-result-cond (cdr (assoc :result-params params)) |
| 87 | ('value (car results)))) | 87 | result (org-babel-haskell-table-or-string result))) |
| 88 | (org-babel-pick-name (cdr (assoc :colname-names params)) | 88 | (org-babel-pick-name (cdr (assoc :colname-names params)) |
| 89 | (cdr (assoc :colname-names params))) | 89 | (cdr (assoc :colname-names params))) |
| 90 | (org-babel-pick-name (cdr (assoc :rowname-names params)) | 90 | (org-babel-pick-name (cdr (assoc :rowname-names params)) |
| @@ -148,6 +148,7 @@ specifying a variable of the same value." | |||
| 148 | (format "%S" var))) | 148 | (format "%S" var))) |
| 149 | 149 | ||
| 150 | (defvar org-src-preserve-indentation) | 150 | (defvar org-src-preserve-indentation) |
| 151 | (defvar org-export-copy-to-kill-ring) | ||
| 151 | (declare-function org-export-to-file "ox" | 152 | (declare-function org-export-to-file "ox" |
| 152 | (backend file | 153 | (backend file |
| 153 | &optional async subtreep visible-only body-only ext-plist)) | 154 | &optional async subtreep visible-only body-only ext-plist)) |
diff --git a/lisp/org/ob-io.el b/lisp/org/ob-io.el index af18f7468c7..5368ff51598 100644 --- a/lisp/org/ob-io.el +++ b/lisp/org/ob-io.el | |||
| @@ -94,12 +94,11 @@ in BODY as elisp." | |||
| 94 | (value (let* ((src-file (org-babel-temp-file "io-")) | 94 | (value (let* ((src-file (org-babel-temp-file "io-")) |
| 95 | (wrapper (format org-babel-io-wrapper-method body))) | 95 | (wrapper (format org-babel-io-wrapper-method body))) |
| 96 | (with-temp-file src-file (insert wrapper)) | 96 | (with-temp-file src-file (insert wrapper)) |
| 97 | ((lambda (raw) | 97 | (let ((raw (org-babel-eval |
| 98 | (org-babel-result-cond result-params | 98 | (concat org-babel-io-command " " src-file) ""))) |
| 99 | raw | 99 | (org-babel-result-cond result-params |
| 100 | (org-babel-io-table-or-string raw))) | 100 | raw |
| 101 | (org-babel-eval | 101 | (org-babel-io-table-or-string raw))))))) |
| 102 | (concat org-babel-io-command " " src-file) "")))))) | ||
| 103 | 102 | ||
| 104 | 103 | ||
| 105 | (defun org-babel-prep-session:io (session params) | 104 | (defun org-babel-prep-session:io (session params) |
diff --git a/lisp/org/ob-java.el b/lisp/org/ob-java.el index c0e9a5384ce..37ac8daea5d 100644 --- a/lisp/org/ob-java.el +++ b/lisp/org/ob-java.el | |||
| @@ -55,19 +55,18 @@ | |||
| 55 | ;; created package-name directories if missing | 55 | ;; created package-name directories if missing |
| 56 | (unless (or (not packagename) (file-exists-p packagename)) | 56 | (unless (or (not packagename) (file-exists-p packagename)) |
| 57 | (make-directory packagename 'parents)) | 57 | (make-directory packagename 'parents)) |
| 58 | ((lambda (results) | 58 | (let ((results (org-babel-eval (concat org-babel-java-command |
| 59 | (org-babel-reassemble-table | 59 | " " cmdline " " classname) ""))) |
| 60 | (org-babel-result-cond (cdr (assoc :result-params params)) | 60 | (org-babel-reassemble-table |
| 61 | (org-babel-read results) | 61 | (org-babel-result-cond (cdr (assoc :result-params params)) |
| 62 | (let ((tmp-file (org-babel-temp-file "c-"))) | 62 | (org-babel-read results) |
| 63 | (with-temp-file tmp-file (insert results)) | 63 | (let ((tmp-file (org-babel-temp-file "c-"))) |
| 64 | (org-babel-import-elisp-from-file tmp-file))) | 64 | (with-temp-file tmp-file (insert results)) |
| 65 | (org-babel-pick-name | 65 | (org-babel-import-elisp-from-file tmp-file))) |
| 66 | (cdr (assoc :colname-names params)) (cdr (assoc :colnames params))) | 66 | (org-babel-pick-name |
| 67 | (org-babel-pick-name | 67 | (cdr (assoc :colname-names params)) (cdr (assoc :colnames params))) |
| 68 | (cdr (assoc :rowname-names params)) (cdr (assoc :rownames params))))) | 68 | (org-babel-pick-name |
| 69 | (org-babel-eval (concat org-babel-java-command | 69 | (cdr (assoc :rowname-names params)) (cdr (assoc :rownames params))))))) |
| 70 | " " cmdline " " classname) "")))) | ||
| 71 | 70 | ||
| 72 | (provide 'ob-java) | 71 | (provide 'ob-java) |
| 73 | 72 | ||
diff --git a/lisp/org/ob-lilypond.el b/lisp/org/ob-lilypond.el index 6080a5a7c01..a58a443dc14 100644 --- a/lisp/org/ob-lilypond.el +++ b/lisp/org/ob-lilypond.el | |||
| @@ -200,7 +200,6 @@ FILE-NAME is full path to lilypond (.ly) file" | |||
| 200 | (let ((arg-1 (ly-determine-ly-path)) ;program | 200 | (let ((arg-1 (ly-determine-ly-path)) ;program |
| 201 | (arg-2 nil) ;infile | 201 | (arg-2 nil) ;infile |
| 202 | (arg-3 "*lilypond*") ;buffer | 202 | (arg-3 "*lilypond*") ;buffer |
| 203 | (arg-4 t) ;display | ||
| 204 | (arg-4 t) ;display | 203 | (arg-4 t) ;display |
| 205 | (arg-5 (if ly-gen-png "--png" "")) ;&rest... | 204 | (arg-5 (if ly-gen-png "--png" "")) ;&rest... |
| 206 | (arg-6 (if ly-gen-html "--html" "")) | 205 | (arg-6 (if ly-gen-html "--html" "")) |
diff --git a/lisp/org/ob-lisp.el b/lisp/org/ob-lisp.el index 2bb1a25bfb8..c912fd9f0fa 100644 --- a/lisp/org/ob-lisp.el +++ b/lisp/org/ob-lisp.el | |||
| @@ -75,23 +75,24 @@ current directory string." | |||
| 75 | "Execute a block of Common Lisp code with Babel." | 75 | "Execute a block of Common Lisp code with Babel." |
| 76 | (require 'slime) | 76 | (require 'slime) |
| 77 | (org-babel-reassemble-table | 77 | (org-babel-reassemble-table |
| 78 | ((lambda (result) | 78 | (let ((result |
| 79 | (org-babel-result-cond (cdr (assoc :result-params params)) | 79 | (with-temp-buffer |
| 80 | (car result) | 80 | (insert (org-babel-expand-body:lisp body params)) |
| 81 | (condition-case nil | 81 | (slime-eval `(swank:eval-and-grab-output |
| 82 | (read (org-babel-lisp-vector-to-list (cadr result))) | 82 | ,(let ((dir (if (assoc :dir params) |
| 83 | (error (cadr result))))) | 83 | (cdr (assoc :dir params)) |
| 84 | (with-temp-buffer | 84 | default-directory))) |
| 85 | (insert (org-babel-expand-body:lisp body params)) | 85 | (format |
| 86 | (slime-eval `(swank:eval-and-grab-output | 86 | (if dir (format org-babel-lisp-dir-fmt dir) |
| 87 | ,(let ((dir (if (assoc :dir params) | 87 | "(progn %s)") |
| 88 | (cdr (assoc :dir params)) | 88 | (buffer-substring-no-properties |
| 89 | default-directory))) | 89 | (point-min) (point-max))))) |
| 90 | (format | 90 | (cdr (assoc :package params)))))) |
| 91 | (if dir (format org-babel-lisp-dir-fmt dir) "(progn %s)") | 91 | (org-babel-result-cond (cdr (assoc :result-params params)) |
| 92 | (buffer-substring-no-properties | 92 | (car result) |
| 93 | (point-min) (point-max))))) | 93 | (condition-case nil |
| 94 | (cdr (assoc :package params))))) | 94 | (read (org-babel-lisp-vector-to-list (cadr result))) |
| 95 | (error (cadr result))))) | ||
| 95 | (org-babel-pick-name (cdr (assoc :colname-names params)) | 96 | (org-babel-pick-name (cdr (assoc :colname-names params)) |
| 96 | (cdr (assoc :colnames params))) | 97 | (cdr (assoc :colnames params))) |
| 97 | (org-babel-pick-name (cdr (assoc :rowname-names params)) | 98 | (org-babel-pick-name (cdr (assoc :rowname-names params)) |
diff --git a/lisp/org/ob-maxima.el b/lisp/org/ob-maxima.el index 726d6863e48..5be378ed600 100644 --- a/lisp/org/ob-maxima.el +++ b/lisp/org/ob-maxima.el | |||
| @@ -65,8 +65,8 @@ | |||
| 65 | "\n"))) | 65 | "\n"))) |
| 66 | 66 | ||
| 67 | (defun org-babel-execute:maxima (body params) | 67 | (defun org-babel-execute:maxima (body params) |
| 68 | "Execute a block of Maxima entries with org-babel. This function is | 68 | "Execute a block of Maxima entries with org-babel. |
| 69 | called by `org-babel-execute-src-block'." | 69 | This function is called by `org-babel-execute-src-block'." |
| 70 | (message "executing Maxima source code block") | 70 | (message "executing Maxima source code block") |
| 71 | (let ((result-params (split-string (or (cdr (assoc :results params)) ""))) | 71 | (let ((result-params (split-string (or (cdr (assoc :results params)) ""))) |
| 72 | (result | 72 | (result |
| @@ -76,18 +76,18 @@ called by `org-babel-execute-src-block'." | |||
| 76 | org-babel-maxima-command in-file cmdline))) | 76 | org-babel-maxima-command in-file cmdline))) |
| 77 | (with-temp-file in-file (insert (org-babel-maxima-expand body params))) | 77 | (with-temp-file in-file (insert (org-babel-maxima-expand body params))) |
| 78 | (message cmd) | 78 | (message cmd) |
| 79 | ((lambda (raw) ;; " | grep -v batch | grep -v 'replaced' | sed '/^$/d' " | 79 | ;; " | grep -v batch | grep -v 'replaced' | sed '/^$/d' " |
| 80 | (mapconcat | 80 | (let ((raw (org-babel-eval cmd ""))) |
| 81 | #'identity | 81 | (mapconcat |
| 82 | (delq nil | 82 | #'identity |
| 83 | (mapcar (lambda (line) | 83 | (delq nil |
| 84 | (unless (or (string-match "batch" line) | 84 | (mapcar (lambda (line) |
| 85 | (string-match "^rat: replaced .*$" line) | 85 | (unless (or (string-match "batch" line) |
| 86 | (string-match "^;;; Loading #P" line) | 86 | (string-match "^rat: replaced .*$" line) |
| 87 | (= 0 (length line))) | 87 | (string-match "^;;; Loading #P" line) |
| 88 | line)) | 88 | (= 0 (length line))) |
| 89 | (split-string raw "[\r\n]"))) "\n")) | 89 | line)) |
| 90 | (org-babel-eval cmd ""))))) | 90 | (split-string raw "[\r\n]"))) "\n"))))) |
| 91 | (if (org-babel-maxima-graphical-output-file params) | 91 | (if (org-babel-maxima-graphical-output-file params) |
| 92 | nil | 92 | nil |
| 93 | (org-babel-result-cond result-params | 93 | (org-babel-result-cond result-params |
diff --git a/lisp/org/ob-perl.el b/lisp/org/ob-perl.el index 43ab9467c1d..d374e47ebfa 100644 --- a/lisp/org/ob-perl.el +++ b/lisp/org/ob-perl.el | |||
| @@ -135,21 +135,21 @@ return the value of the last statement in BODY, as elisp." | |||
| 135 | (tmp-file (org-babel-temp-file "perl-")) | 135 | (tmp-file (org-babel-temp-file "perl-")) |
| 136 | (tmp-babel-file (org-babel-process-file-name | 136 | (tmp-babel-file (org-babel-process-file-name |
| 137 | tmp-file 'noquote))) | 137 | tmp-file 'noquote))) |
| 138 | ((lambda (results) | 138 | (let ((results |
| 139 | (when results | 139 | (case result-type |
| 140 | (org-babel-result-cond result-params | 140 | (output |
| 141 | (org-babel-eval-read-file tmp-file) | 141 | (with-temp-file tmp-file |
| 142 | (org-babel-import-elisp-from-file tmp-file '(16))))) | 142 | (insert |
| 143 | (case result-type | 143 | (org-babel-eval org-babel-perl-command body)) |
| 144 | (output | 144 | (buffer-string))) |
| 145 | (with-temp-file tmp-file | 145 | (value |
| 146 | (insert | 146 | (org-babel-eval org-babel-perl-command |
| 147 | (org-babel-eval org-babel-perl-command body)) | 147 | (format org-babel-perl-wrapper-method |
| 148 | (buffer-string))) | 148 | body tmp-babel-file)))))) |
| 149 | (value | 149 | (when results |
| 150 | (org-babel-eval org-babel-perl-command | 150 | (org-babel-result-cond result-params |
| 151 | (format org-babel-perl-wrapper-method | 151 | (org-babel-eval-read-file tmp-file) |
| 152 | body tmp-babel-file))))))) | 152 | (org-babel-import-elisp-from-file tmp-file '(16))))))) |
| 153 | 153 | ||
| 154 | (provide 'ob-perl) | 154 | (provide 'ob-perl) |
| 155 | 155 | ||
diff --git a/lisp/org/ob-picolisp.el b/lisp/org/ob-picolisp.el index 1d1791926c5..279cd7b3f45 100644 --- a/lisp/org/ob-picolisp.el +++ b/lisp/org/ob-picolisp.el | |||
| @@ -99,16 +99,16 @@ | |||
| 99 | called by `org-babel-execute-src-block'" | 99 | called by `org-babel-execute-src-block'" |
| 100 | (message "executing Picolisp source code block") | 100 | (message "executing Picolisp source code block") |
| 101 | (let* ( | 101 | (let* ( |
| 102 | ;; name of the session or "none" | 102 | ;; Name of the session or "none". |
| 103 | (session-name (cdr (assoc :session params))) | 103 | (session-name (cdr (assoc :session params))) |
| 104 | ;; set the session if the session variable is non-nil | 104 | ;; Set the session if the session variable is non-nil. |
| 105 | (session (org-babel-picolisp-initiate-session session-name)) | 105 | (session (org-babel-picolisp-initiate-session session-name)) |
| 106 | ;; either OUTPUT or VALUE which should behave as described above | 106 | ;; Either OUTPUT or VALUE which should behave as described above. |
| 107 | (result-type (cdr (assoc :result-type params))) | 107 | (result-type (cdr (assoc :result-type params))) |
| 108 | (result-params (cdr (assoc :result-params params))) | 108 | (result-params (cdr (assoc :result-params params))) |
| 109 | ;; expand the body with `org-babel-expand-body:picolisp' | 109 | ;; Expand the body with `org-babel-expand-body:picolisp'. |
| 110 | (full-body (org-babel-expand-body:picolisp body params)) | 110 | (full-body (org-babel-expand-body:picolisp body params)) |
| 111 | ;; wrap body appropriately for the type of evaluation and results | 111 | ;; Wrap body appropriately for the type of evaluation and results. |
| 112 | (wrapped-body | 112 | (wrapped-body |
| 113 | (cond | 113 | (cond |
| 114 | ((or (member "code" result-params) | 114 | ((or (member "code" result-params) |
| @@ -118,53 +118,54 @@ | |||
| 118 | (format "(print (out \"/dev/null\" %s))" full-body)) | 118 | (format "(print (out \"/dev/null\" %s))" full-body)) |
| 119 | ((member "value" result-params) | 119 | ((member "value" result-params) |
| 120 | (format "(out \"/dev/null\" %s)" full-body)) | 120 | (format "(out \"/dev/null\" %s)" full-body)) |
| 121 | (t full-body)))) | 121 | (t full-body))) |
| 122 | 122 | (result | |
| 123 | ((lambda (result) | 123 | (if (not (string= session-name "none")) |
| 124 | (org-babel-result-cond result-params | 124 | ;; Session based evaluation. |
| 125 | result | 125 | (mapconcat ;; <- joins the list back into a single string |
| 126 | (read result))) | 126 | #'identity |
| 127 | (if (not (string= session-name "none")) | 127 | (butlast ;; <- remove the org-babel-picolisp-eoe line |
| 128 | ;; session based evaluation | 128 | (delq nil |
| 129 | (mapconcat ;; <- joins the list back together into a single string | 129 | (mapcar |
| 130 | #'identity | 130 | (lambda (line) |
| 131 | (butlast ;; <- remove the org-babel-picolisp-eoe line | 131 | (org-babel-chomp ;; Remove trailing newlines. |
| 132 | (delq nil | 132 | (when (> (length line) 0) ;; Remove empty lines. |
| 133 | (mapcar | 133 | (cond |
| 134 | (lambda (line) | 134 | ;; Remove leading "-> " from return values. |
| 135 | (org-babel-chomp ;; remove trailing newlines | 135 | ((and (>= (length line) 3) |
| 136 | (when (> (length line) 0) ;; remove empty lines | 136 | (string= "-> " (substring line 0 3))) |
| 137 | (cond | 137 | (substring line 3)) |
| 138 | ;; remove leading "-> " from return values | 138 | ;; Remove trailing "-> <<return-value>>" on the |
| 139 | ((and (>= (length line) 3) | 139 | ;; last line of output. |
| 140 | (string= "-> " (substring line 0 3))) | 140 | ((and (member "output" result-params) |
| 141 | (substring line 3)) | 141 | (string-match-p "->" line)) |
| 142 | ;; remove trailing "-> <<return-value>>" on the | 142 | (substring line 0 (string-match "->" line))) |
| 143 | ;; last line of output | 143 | (t line) |
| 144 | ((and (member "output" result-params) | 144 | ) |
| 145 | (string-match-p "->" line)) | 145 | ;;(if (and (>= (length line) 3);Remove leading "<-" |
| 146 | (substring line 0 (string-match "->" line))) | 146 | ;; (string= "-> " (substring line 0 3))) |
| 147 | (t line) | 147 | ;; (substring line 3) |
| 148 | ) | 148 | ;; line) |
| 149 | ;; (if (and (>= (length line) 3) ;; remove leading "<- " | 149 | ))) |
| 150 | ;; (string= "-> " (substring line 0 3))) | 150 | ;; Returns a list of the output of each evaluated exp. |
| 151 | ;; (substring line 3) | 151 | (org-babel-comint-with-output |
| 152 | ;; line) | 152 | (session org-babel-picolisp-eoe) |
| 153 | ))) | 153 | (insert wrapped-body) (comint-send-input) |
| 154 | ;; returns a list of the output of each evaluated expression | 154 | (insert "'" org-babel-picolisp-eoe) |
| 155 | (org-babel-comint-with-output (session org-babel-picolisp-eoe) | 155 | (comint-send-input))))) |
| 156 | (insert wrapped-body) (comint-send-input) | 156 | "\n") |
| 157 | (insert "'" org-babel-picolisp-eoe) (comint-send-input))))) | 157 | ;; external evaluation |
| 158 | "\n") | 158 | (let ((script-file (org-babel-temp-file "picolisp-script-"))) |
| 159 | ;; external evaluation | 159 | (with-temp-file script-file |
| 160 | (let ((script-file (org-babel-temp-file "picolisp-script-"))) | 160 | (insert (concat wrapped-body "(bye)"))) |
| 161 | (with-temp-file script-file | 161 | (org-babel-eval |
| 162 | (insert (concat wrapped-body "(bye)"))) | 162 | (format "%s %s" |
| 163 | (org-babel-eval | 163 | org-babel-picolisp-cmd |
| 164 | (format "%s %s" | 164 | (org-babel-process-file-name script-file)) |
| 165 | org-babel-picolisp-cmd | 165 | ""))))) |
| 166 | (org-babel-process-file-name script-file)) | 166 | (org-babel-result-cond result-params |
| 167 | "")))))) | 167 | result |
| 168 | (read result)))) | ||
| 168 | 169 | ||
| 169 | (defun org-babel-picolisp-initiate-session (&optional session-name) | 170 | (defun org-babel-picolisp-initiate-session (&optional session-name) |
| 170 | "If there is not a current inferior-process-buffer in SESSION | 171 | "If there is not a current inferior-process-buffer in SESSION |
diff --git a/lisp/org/ob-python.el b/lisp/org/ob-python.el index 17da109ca0b..b8f8a6daafa 100644 --- a/lisp/org/ob-python.el +++ b/lisp/org/ob-python.el | |||
| @@ -143,13 +143,12 @@ specifying a variable of the same value." | |||
| 143 | "Convert RESULTS into an appropriate elisp value. | 143 | "Convert RESULTS into an appropriate elisp value. |
| 144 | If the results look like a list or tuple, then convert them into an | 144 | If the results look like a list or tuple, then convert them into an |
| 145 | Emacs-lisp table, otherwise return the results as a string." | 145 | Emacs-lisp table, otherwise return the results as a string." |
| 146 | ((lambda (res) | 146 | (let ((res (org-babel-script-escape results))) |
| 147 | (if (listp res) | 147 | (if (listp res) |
| 148 | (mapcar (lambda (el) (if (equal el 'None) | 148 | (mapcar (lambda (el) (if (equal el 'None) |
| 149 | org-babel-python-None-to el)) | 149 | org-babel-python-None-to el)) |
| 150 | res) | 150 | res) |
| 151 | res)) | 151 | res))) |
| 152 | (org-babel-script-escape results))) | ||
| 153 | 152 | ||
| 154 | (defvar org-babel-python-buffers '((:default . "*Python*"))) | 153 | (defvar org-babel-python-buffers '((:default . "*Python*"))) |
| 155 | 154 | ||
| @@ -172,6 +171,8 @@ Emacs-lisp table, otherwise return the results as a string." | |||
| 172 | name))) | 171 | name))) |
| 173 | 172 | ||
| 174 | (defvar py-default-interpreter) | 173 | (defvar py-default-interpreter) |
| 174 | (defvar py-which-bufname) | ||
| 175 | (defvar python-shell-buffer-name) | ||
| 175 | (defun org-babel-python-initiate-session-by-key (&optional session) | 176 | (defun org-babel-python-initiate-session-by-key (&optional session) |
| 176 | "Initiate a python session. | 177 | "Initiate a python session. |
| 177 | If there is not a current inferior-process-buffer in SESSION | 178 | If there is not a current inferior-process-buffer in SESSION |
| @@ -252,34 +253,34 @@ open('%s', 'w').write( pprint.pformat(main()) )") | |||
| 252 | If RESULT-TYPE equals 'output then return standard output as a | 253 | If RESULT-TYPE equals 'output then return standard output as a |
| 253 | string. If RESULT-TYPE equals 'value then return the value of the | 254 | string. If RESULT-TYPE equals 'value then return the value of the |
| 254 | last statement in BODY, as elisp." | 255 | last statement in BODY, as elisp." |
| 255 | ((lambda (raw) | 256 | (let ((raw |
| 256 | (org-babel-result-cond result-params | 257 | (case result-type |
| 257 | raw | 258 | (output (org-babel-eval org-babel-python-command |
| 258 | (org-babel-python-table-or-string (org-babel-trim raw)))) | 259 | (concat (if preamble (concat preamble "\n")) |
| 259 | (case result-type | 260 | body))) |
| 260 | (output (org-babel-eval org-babel-python-command | 261 | (value (let ((tmp-file (org-babel-temp-file "python-"))) |
| 261 | (concat (if preamble (concat preamble "\n") "") | 262 | (org-babel-eval |
| 262 | body))) | 263 | org-babel-python-command |
| 263 | (value (let ((tmp-file (org-babel-temp-file "python-"))) | 264 | (concat |
| 264 | (org-babel-eval | 265 | (if preamble (concat preamble "\n") "") |
| 265 | org-babel-python-command | 266 | (format |
| 266 | (concat | 267 | (if (member "pp" result-params) |
| 267 | (if preamble (concat preamble "\n") "") | 268 | org-babel-python-pp-wrapper-method |
| 268 | (format | 269 | org-babel-python-wrapper-method) |
| 269 | (if (member "pp" result-params) | 270 | (mapconcat |
| 270 | org-babel-python-pp-wrapper-method | 271 | (lambda (line) (format "\t%s" line)) |
| 271 | org-babel-python-wrapper-method) | 272 | (split-string |
| 272 | (mapconcat | 273 | (org-remove-indentation |
| 273 | (lambda (line) (format "\t%s" line)) | 274 | (org-babel-trim body)) |
| 274 | (split-string | 275 | "[\r\n]") "\n") |
| 275 | (org-remove-indentation | 276 | (org-babel-process-file-name tmp-file 'noquote)))) |
| 276 | (org-babel-trim body)) | 277 | (org-babel-eval-read-file tmp-file)))))) |
| 277 | "[\r\n]") "\n") | 278 | (org-babel-result-cond result-params |
| 278 | (org-babel-process-file-name tmp-file 'noquote)))) | 279 | raw |
| 279 | (org-babel-eval-read-file tmp-file)))))) | 280 | (org-babel-python-table-or-string (org-babel-trim raw))))) |
| 280 | 281 | ||
| 281 | (defun org-babel-python-evaluate-session | 282 | (defun org-babel-python-evaluate-session |
| 282 | (session body &optional result-type result-params) | 283 | (session body &optional result-type result-params) |
| 283 | "Pass BODY to the Python process in SESSION. | 284 | "Pass BODY to the Python process in SESSION. |
| 284 | If RESULT-TYPE equals 'output then return standard output as a | 285 | If RESULT-TYPE equals 'output then return standard output as a |
| 285 | string. If RESULT-TYPE equals 'value then return the value of the | 286 | string. If RESULT-TYPE equals 'value then return the value of the |
| @@ -296,39 +297,41 @@ last statement in BODY, as elisp." | |||
| 296 | (format "open('%s', 'w').write(pprint.pformat(_))" | 297 | (format "open('%s', 'w').write(pprint.pformat(_))" |
| 297 | (org-babel-process-file-name tmp-file 'noquote))) | 298 | (org-babel-process-file-name tmp-file 'noquote))) |
| 298 | (list (format "open('%s', 'w').write(str(_))" | 299 | (list (format "open('%s', 'w').write(str(_))" |
| 299 | (org-babel-process-file-name tmp-file 'noquote))))))) | 300 | (org-babel-process-file-name tmp-file |
| 301 | 'noquote))))))) | ||
| 300 | (input-body (lambda (body) | 302 | (input-body (lambda (body) |
| 301 | (mapc (lambda (line) (insert line) (funcall send-wait)) | 303 | (mapc (lambda (line) (insert line) (funcall send-wait)) |
| 302 | (split-string body "[\r\n]")) | 304 | (split-string body "[\r\n]")) |
| 303 | (funcall send-wait)))) | 305 | (funcall send-wait))) |
| 304 | ((lambda (results) | 306 | (results |
| 305 | (unless (string= (substring org-babel-python-eoe-indicator 1 -1) results) | 307 | (case result-type |
| 306 | (org-babel-result-cond result-params | 308 | (output |
| 307 | results | 309 | (mapconcat |
| 308 | (org-babel-python-table-or-string results)))) | 310 | #'org-babel-trim |
| 309 | (case result-type | 311 | (butlast |
| 310 | (output | 312 | (org-babel-comint-with-output |
| 311 | (mapconcat | 313 | (session org-babel-python-eoe-indicator t body) |
| 312 | #'org-babel-trim | 314 | (funcall input-body body) |
| 313 | (butlast | 315 | (funcall send-wait) (funcall send-wait) |
| 314 | (org-babel-comint-with-output | 316 | (insert org-babel-python-eoe-indicator) |
| 315 | (session org-babel-python-eoe-indicator t body) | 317 | (funcall send-wait)) |
| 316 | (funcall input-body body) | 318 | 2) "\n")) |
| 317 | (funcall send-wait) (funcall send-wait) | 319 | (value |
| 318 | (insert org-babel-python-eoe-indicator) | 320 | (let ((tmp-file (org-babel-temp-file "python-"))) |
| 319 | (funcall send-wait)) | 321 | (org-babel-comint-with-output |
| 320 | 2) "\n")) | 322 | (session org-babel-python-eoe-indicator nil body) |
| 321 | (value | 323 | (let ((comint-process-echoes nil)) |
| 322 | (let ((tmp-file (org-babel-temp-file "python-"))) | 324 | (funcall input-body body) |
| 323 | (org-babel-comint-with-output | 325 | (funcall dump-last-value tmp-file |
| 324 | (session org-babel-python-eoe-indicator nil body) | 326 | (member "pp" result-params)) |
| 325 | (let ((comint-process-echoes nil)) | 327 | (funcall send-wait) (funcall send-wait) |
| 326 | (funcall input-body body) | 328 | (insert org-babel-python-eoe-indicator) |
| 327 | (funcall dump-last-value tmp-file (member "pp" result-params)) | 329 | (funcall send-wait))) |
| 328 | (funcall send-wait) (funcall send-wait) | 330 | (org-babel-eval-read-file tmp-file)))))) |
| 329 | (insert org-babel-python-eoe-indicator) | 331 | (unless (string= (substring org-babel-python-eoe-indicator 1 -1) results) |
| 330 | (funcall send-wait))) | 332 | (org-babel-result-cond result-params |
| 331 | (org-babel-eval-read-file tmp-file))))))) | 333 | results |
| 334 | (org-babel-python-table-or-string results))))) | ||
| 332 | 335 | ||
| 333 | (defun org-babel-python-read-string (string) | 336 | (defun org-babel-python-read-string (string) |
| 334 | "Strip 's from around Python string." | 337 | "Strip 's from around Python string." |
diff --git a/lisp/org/ob-ruby.el b/lisp/org/ob-ruby.el index af528314393..fe1ee0ff098 100644 --- a/lisp/org/ob-ruby.el +++ b/lisp/org/ob-ruby.el | |||
| @@ -139,13 +139,12 @@ specifying a variable of the same value." | |||
| 139 | "Convert RESULTS into an appropriate elisp value. | 139 | "Convert RESULTS into an appropriate elisp value. |
| 140 | If RESULTS look like a table, then convert them into an | 140 | If RESULTS look like a table, then convert them into an |
| 141 | Emacs-lisp table, otherwise return the results as a string." | 141 | Emacs-lisp table, otherwise return the results as a string." |
| 142 | ((lambda (res) | 142 | (let ((res (org-babel-script-escape results))) |
| 143 | (if (listp res) | 143 | (if (listp res) |
| 144 | (mapcar (lambda (el) (if (equal el 'nil) | 144 | (mapcar (lambda (el) (if (equal el 'nil) |
| 145 | org-babel-ruby-nil-to el)) | 145 | org-babel-ruby-nil-to el)) |
| 146 | res) | 146 | res) |
| 147 | res)) | 147 | res))) |
| 148 | (org-babel-script-escape results))) | ||
| 149 | 148 | ||
| 150 | (defun org-babel-ruby-initiate-session (&optional session params) | 149 | (defun org-babel-ruby-initiate-session (&optional session params) |
| 151 | "Initiate a ruby session. | 150 | "Initiate a ruby session. |
| @@ -204,12 +203,11 @@ return the value of the last statement in BODY, as elisp." | |||
| 204 | org-babel-ruby-pp-wrapper-method | 203 | org-babel-ruby-pp-wrapper-method |
| 205 | org-babel-ruby-wrapper-method) | 204 | org-babel-ruby-wrapper-method) |
| 206 | body (org-babel-process-file-name tmp-file 'noquote))) | 205 | body (org-babel-process-file-name tmp-file 'noquote))) |
| 207 | ((lambda (raw) | 206 | (let ((raw (org-babel-eval-read-file tmp-file))) |
| 208 | (if (or (member "code" result-params) | 207 | (if (or (member "code" result-params) |
| 209 | (member "pp" result-params)) | 208 | (member "pp" result-params)) |
| 210 | raw | 209 | raw |
| 211 | (org-babel-ruby-table-or-string raw))) | 210 | (org-babel-ruby-table-or-string raw)))))) |
| 212 | (org-babel-eval-read-file tmp-file))))) | ||
| 213 | ;; comint session evaluation | 211 | ;; comint session evaluation |
| 214 | (case result-type | 212 | (case result-type |
| 215 | (output | 213 | (output |
diff --git a/lisp/org/ob-scala.el b/lisp/org/ob-scala.el index 7cb3099c00f..f7783619457 100644 --- a/lisp/org/ob-scala.el +++ b/lisp/org/ob-scala.el | |||
| @@ -100,12 +100,11 @@ in BODY as elisp." | |||
| 100 | (let* ((src-file (org-babel-temp-file "scala-")) | 100 | (let* ((src-file (org-babel-temp-file "scala-")) |
| 101 | (wrapper (format org-babel-scala-wrapper-method body))) | 101 | (wrapper (format org-babel-scala-wrapper-method body))) |
| 102 | (with-temp-file src-file (insert wrapper)) | 102 | (with-temp-file src-file (insert wrapper)) |
| 103 | ((lambda (raw) | 103 | (let ((raw (org-babel-eval |
| 104 | (org-babel-result-cond result-params | 104 | (concat org-babel-scala-command " " src-file) ""))) |
| 105 | raw | 105 | (org-babel-result-cond result-params |
| 106 | (org-babel-scala-table-or-string raw))) | 106 | raw |
| 107 | (org-babel-eval | 107 | (org-babel-scala-table-or-string raw))))))) |
| 108 | (concat org-babel-scala-command " " src-file) "")))))) | ||
| 109 | 108 | ||
| 110 | 109 | ||
| 111 | (defun org-babel-prep-session:scala (session params) | 110 | (defun org-babel-prep-session:scala (session params) |
diff --git a/lisp/org/ob-sh.el b/lisp/org/ob-sh.el index ec1306b3b9e..4984ff9bf45 100644 --- a/lisp/org/ob-sh.el +++ b/lisp/org/ob-sh.el | |||
| @@ -53,9 +53,9 @@ This will be passed to `shell-command-on-region'") | |||
| 53 | This function is called by `org-babel-execute-src-block'." | 53 | This function is called by `org-babel-execute-src-block'." |
| 54 | (let* ((session (org-babel-sh-initiate-session | 54 | (let* ((session (org-babel-sh-initiate-session |
| 55 | (cdr (assoc :session params)))) | 55 | (cdr (assoc :session params)))) |
| 56 | (stdin ((lambda (stdin) (when stdin (org-babel-sh-var-to-string | 56 | (stdin (let ((stdin (cdr (assoc :stdin params)))) |
| 57 | (org-babel-ref-resolve stdin)))) | 57 | (when stdin (org-babel-sh-var-to-string |
| 58 | (cdr (assoc :stdin params)))) | 58 | (org-babel-ref-resolve stdin))))) |
| 59 | (full-body (org-babel-expand-body:generic | 59 | (full-body (org-babel-expand-body:generic |
| 60 | body params (org-babel-variable-assignments:sh params)))) | 60 | body params (org-babel-variable-assignments:sh params)))) |
| 61 | (org-babel-reassemble-table | 61 | (org-babel-reassemble-table |
| @@ -135,68 +135,69 @@ Emacs-lisp table, otherwise return the results as a string." | |||
| 135 | If RESULT-TYPE equals 'output then return a list of the outputs | 135 | If RESULT-TYPE equals 'output then return a list of the outputs |
| 136 | of the statements in BODY, if RESULT-TYPE equals 'value then | 136 | of the statements in BODY, if RESULT-TYPE equals 'value then |
| 137 | return the value of the last statement in BODY." | 137 | return the value of the last statement in BODY." |
| 138 | ((lambda (results) | 138 | (let ((results |
| 139 | (when results | 139 | (cond |
| 140 | (let ((result-params (cdr (assoc :result-params params)))) | 140 | (stdin ; external shell script w/STDIN |
| 141 | (org-babel-result-cond result-params | 141 | (let ((script-file (org-babel-temp-file "sh-script-")) |
| 142 | results | 142 | (stdin-file (org-babel-temp-file "sh-stdin-")) |
| 143 | (let ((tmp-file (org-babel-temp-file "sh-"))) | 143 | (shebang (cdr (assoc :shebang params))) |
| 144 | (with-temp-file tmp-file (insert results)) | 144 | (padline (not (string= "no" (cdr (assoc :padline params)))))) |
| 145 | (org-babel-import-elisp-from-file tmp-file)))))) | 145 | (with-temp-file script-file |
| 146 | (cond | 146 | (when shebang (insert (concat shebang "\n"))) |
| 147 | (stdin ; external shell script w/STDIN | 147 | (when padline (insert "\n")) |
| 148 | (let ((script-file (org-babel-temp-file "sh-script-")) | 148 | (insert body)) |
| 149 | (stdin-file (org-babel-temp-file "sh-stdin-")) | 149 | (set-file-modes script-file #o755) |
| 150 | (shebang (cdr (assoc :shebang params))) | 150 | (with-temp-file stdin-file (insert stdin)) |
| 151 | (padline (not (string= "no" (cdr (assoc :padline params)))))) | 151 | (with-temp-buffer |
| 152 | (with-temp-file script-file | 152 | (call-process-shell-command |
| 153 | (when shebang (insert (concat shebang "\n"))) | 153 | (if shebang |
| 154 | (when padline (insert "\n")) | 154 | script-file |
| 155 | (insert body)) | 155 | (format "%s %s" org-babel-sh-command script-file)) |
| 156 | (set-file-modes script-file #o755) | 156 | stdin-file |
| 157 | (with-temp-file stdin-file (insert stdin)) | 157 | (current-buffer)) |
| 158 | (with-temp-buffer | 158 | (buffer-string)))) |
| 159 | (call-process-shell-command | 159 | (session ; session evaluation |
| 160 | (if shebang | 160 | (mapconcat |
| 161 | script-file | 161 | #'org-babel-sh-strip-weird-long-prompt |
| 162 | (format "%s %s" org-babel-sh-command script-file)) | 162 | (mapcar |
| 163 | stdin-file | 163 | #'org-babel-trim |
| 164 | (current-buffer)) | 164 | (butlast |
| 165 | (buffer-string)))) | 165 | (org-babel-comint-with-output |
| 166 | (session ; session evaluation | 166 | (session org-babel-sh-eoe-output t body) |
| 167 | (mapconcat | 167 | (mapc |
| 168 | #'org-babel-sh-strip-weird-long-prompt | 168 | (lambda (line) |
| 169 | (mapcar | 169 | (insert line) |
| 170 | #'org-babel-trim | 170 | (comint-send-input nil t) |
| 171 | (butlast | 171 | (while (save-excursion |
| 172 | (org-babel-comint-with-output | 172 | (goto-char comint-last-input-end) |
| 173 | (session org-babel-sh-eoe-output t body) | 173 | (not (re-search-forward |
| 174 | (mapc | 174 | comint-prompt-regexp nil t))) |
| 175 | (lambda (line) | 175 | (accept-process-output |
| 176 | (insert line) | 176 | (get-buffer-process (current-buffer))))) |
| 177 | (comint-send-input nil t) | 177 | (append |
| 178 | (while (save-excursion | 178 | (split-string (org-babel-trim body) "\n") |
| 179 | (goto-char comint-last-input-end) | 179 | (list org-babel-sh-eoe-indicator)))) |
| 180 | (not (re-search-forward | 180 | 2)) "\n")) |
| 181 | comint-prompt-regexp nil t))) | 181 | ('otherwise ; external shell script |
| 182 | (accept-process-output (get-buffer-process (current-buffer))))) | 182 | (if (and (cdr (assoc :shebang params)) |
| 183 | (append | 183 | (> (length (cdr (assoc :shebang params))) 0)) |
| 184 | (split-string (org-babel-trim body) "\n") | 184 | (let ((script-file (org-babel-temp-file "sh-script-")) |
| 185 | (list org-babel-sh-eoe-indicator)))) | 185 | (shebang (cdr (assoc :shebang params))) |
| 186 | 2)) "\n")) | 186 | (padline (not (equal "no" (cdr (assoc :padline params)))))) |
| 187 | ('otherwise ; external shell script | 187 | (with-temp-file script-file |
| 188 | (if (and (cdr (assoc :shebang params)) | 188 | (when shebang (insert (concat shebang "\n"))) |
| 189 | (> (length (cdr (assoc :shebang params))) 0)) | 189 | (when padline (insert "\n")) |
| 190 | (let ((script-file (org-babel-temp-file "sh-script-")) | 190 | (insert body)) |
| 191 | (shebang (cdr (assoc :shebang params))) | 191 | (set-file-modes script-file #o755) |
| 192 | (padline (not (string= "no" (cdr (assoc :padline params)))))) | 192 | (org-babel-eval script-file "")) |
| 193 | (with-temp-file script-file | 193 | (org-babel-eval org-babel-sh-command (org-babel-trim body))))))) |
| 194 | (when shebang (insert (concat shebang "\n"))) | 194 | (when results |
| 195 | (when padline (insert "\n")) | 195 | (let ((result-params (cdr (assoc :result-params params)))) |
| 196 | (insert body)) | 196 | (org-babel-result-cond result-params |
| 197 | (set-file-modes script-file #o755) | 197 | results |
| 198 | (org-babel-eval script-file "")) | 198 | (let ((tmp-file (org-babel-temp-file "sh-"))) |
| 199 | (org-babel-eval org-babel-sh-command (org-babel-trim body))))))) | 199 | (with-temp-file tmp-file (insert results)) |
| 200 | (org-babel-import-elisp-from-file tmp-file))))))) | ||
| 200 | 201 | ||
| 201 | (defun org-babel-sh-strip-weird-long-prompt (string) | 202 | (defun org-babel-sh-strip-weird-long-prompt (string) |
| 202 | "Remove prompt cruft from a string of shell output." | 203 | "Remove prompt cruft from a string of shell output." |
diff --git a/lisp/org/ob-shen.el b/lisp/org/ob-shen.el index dc6313dc247..68169da9a68 100644 --- a/lisp/org/ob-shen.el +++ b/lisp/org/ob-shen.el | |||
| @@ -66,14 +66,14 @@ This function is called by `org-babel-execute-src-block'" | |||
| 66 | (let* ((result-type (cdr (assoc :result-type params))) | 66 | (let* ((result-type (cdr (assoc :result-type params))) |
| 67 | (result-params (cdr (assoc :result-params params))) | 67 | (result-params (cdr (assoc :result-params params))) |
| 68 | (full-body (org-babel-expand-body:shen body params))) | 68 | (full-body (org-babel-expand-body:shen body params))) |
| 69 | ((lambda (results) | 69 | (let ((results |
| 70 | (org-babel-result-cond result-params | 70 | (with-temp-buffer |
| 71 | results | 71 | (insert full-body) |
| 72 | (condition-case nil (org-babel-script-escape results) | 72 | (call-interactively #'shen-eval-defun)))) |
| 73 | (error results)))) | 73 | (org-babel-result-cond result-params |
| 74 | (with-temp-buffer | 74 | results |
| 75 | (insert full-body) | 75 | (condition-case nil (org-babel-script-escape results) |
| 76 | (call-interactively #'shen-eval-defun))))) | 76 | (error results)))))) |
| 77 | 77 | ||
| 78 | (provide 'ob-shen) | 78 | (provide 'ob-shen) |
| 79 | ;;; ob-shen.el ends here | 79 | ;;; ob-shen.el ends here |
diff --git a/lisp/org/ob-sql.el b/lisp/org/ob-sql.el index 658a54f1d8a..d17dd8a7f9d 100644 --- a/lisp/org/ob-sql.el +++ b/lisp/org/ob-sql.el | |||
| @@ -186,19 +186,17 @@ This function is called by `org-babel-execute-src-block'." | |||
| 186 | (lambda (pair) | 186 | (lambda (pair) |
| 187 | (setq body | 187 | (setq body |
| 188 | (replace-regexp-in-string | 188 | (replace-regexp-in-string |
| 189 | (format "\$%s" (car pair)) | 189 | (format "\$%s" (car pair)) ;FIXME: "\$" == "$"! |
| 190 | ((lambda (val) | 190 | (let ((val (cdr pair))) |
| 191 | (if (listp val) | 191 | (if (listp val) |
| 192 | ((lambda (data-file) | 192 | (let ((data-file (org-babel-temp-file "sql-data-"))) |
| 193 | (with-temp-file data-file | 193 | (with-temp-file data-file |
| 194 | (insert (orgtbl-to-csv | 194 | (insert (orgtbl-to-csv |
| 195 | val '(:fmt (lambda (el) (if (stringp el) | 195 | val '(:fmt (lambda (el) (if (stringp el) |
| 196 | el | 196 | el |
| 197 | (format "%S" el))))))) | 197 | (format "%S" el))))))) |
| 198 | data-file) | 198 | data-file) |
| 199 | (org-babel-temp-file "sql-data-")) | 199 | (if (stringp val) val (format "%S" val)))) |
| 200 | (if (stringp val) val (format "%S" val)))) | ||
| 201 | (cdr pair)) | ||
| 202 | body))) | 200 | body))) |
| 203 | vars) | 201 | vars) |
| 204 | body) | 202 | body) |
diff --git a/lisp/org/ob-sqlite.el b/lisp/org/ob-sqlite.el index 84d4688ab38..fcfdb8ebd3e 100644 --- a/lisp/org/ob-sqlite.el +++ b/lisp/org/ob-sqlite.el | |||
| @@ -114,23 +114,22 @@ This function is called by `org-babel-execute-src-block'." | |||
| 114 | 114 | ||
| 115 | (defun org-babel-sqlite-expand-vars (body vars) | 115 | (defun org-babel-sqlite-expand-vars (body vars) |
| 116 | "Expand the variables held in VARS in BODY." | 116 | "Expand the variables held in VARS in BODY." |
| 117 | ;; FIXME: Redundancy with org-babel-sql-expand-vars! | ||
| 117 | (mapc | 118 | (mapc |
| 118 | (lambda (pair) | 119 | (lambda (pair) |
| 119 | (setq body | 120 | (setq body |
| 120 | (replace-regexp-in-string | 121 | (replace-regexp-in-string |
| 121 | (format "\$%s" (car pair)) | 122 | (format "\$%s" (car pair)) ;FIXME: "\$" == "$"! |
| 122 | ((lambda (val) | 123 | (let ((val (cdr pair))) |
| 123 | (if (listp val) | 124 | (if (listp val) |
| 124 | ((lambda (data-file) | 125 | (let ((data-file (org-babel-temp-file "sqlite-data-"))) |
| 125 | (with-temp-file data-file | 126 | (with-temp-file data-file |
| 126 | (insert (orgtbl-to-csv | 127 | (insert (orgtbl-to-csv |
| 127 | val '(:fmt (lambda (el) (if (stringp el) | 128 | val '(:fmt (lambda (el) (if (stringp el) |
| 128 | el | 129 | el |
| 129 | (format "%S" el))))))) | 130 | (format "%S" el))))))) |
| 130 | data-file) | 131 | data-file) |
| 131 | (org-babel-temp-file "sqlite-data-")) | 132 | (if (stringp val) val (format "%S" val)))) |
| 132 | (if (stringp val) val (format "%S" val)))) | ||
| 133 | (cdr pair)) | ||
| 134 | body))) | 133 | body))) |
| 135 | vars) | 134 | vars) |
| 136 | body) | 135 | body) |
diff --git a/lisp/org/ob-table.el b/lisp/org/ob-table.el index 8b3e36d735c..c71bb8758f8 100644 --- a/lisp/org/ob-table.el +++ b/lisp/org/ob-table.el | |||
| @@ -60,7 +60,7 @@ character and replace it with ellipses." | |||
| 60 | (concat (substring string 0 (match-beginning 0)) | 60 | (concat (substring string 0 (match-beginning 0)) |
| 61 | (if (match-string 1 string) "...")) string)) | 61 | (if (match-string 1 string) "...")) string)) |
| 62 | 62 | ||
| 63 | (defmacro sbe (source-block &rest variables) | 63 | (defmacro sbe (source-block &rest variables) ;FIXME: Namespace prefix! |
| 64 | "Return the results of calling SOURCE-BLOCK with VARIABLES. | 64 | "Return the results of calling SOURCE-BLOCK with VARIABLES. |
| 65 | Each element of VARIABLES should be a two | 65 | Each element of VARIABLES should be a two |
| 66 | element list, whose first element is the name of the variable and | 66 | element list, whose first element is the name of the variable and |
| @@ -85,6 +85,7 @@ as shown in the example below. | |||
| 85 | 85 | ||
| 86 | | 1 | 2 | :file nothing.png | nothing.png | | 86 | | 1 | 2 | :file nothing.png | nothing.png | |
| 87 | #+TBLFM: @1$4='(sbe test-sbe $3 (x $1) (y $2))" | 87 | #+TBLFM: @1$4='(sbe test-sbe $3 (x $1) (y $2))" |
| 88 | (declare (debug (form form))) | ||
| 88 | (let* ((header-args (if (stringp (car variables)) (car variables) "")) | 89 | (let* ((header-args (if (stringp (car variables)) (car variables) "")) |
| 89 | (variables (if (stringp (car variables)) (cdr variables) variables))) | 90 | (variables (if (stringp (car variables)) (cdr variables) variables))) |
| 90 | (let* (quote | 91 | (let* (quote |
| @@ -107,31 +108,31 @@ as shown in the example below. | |||
| 107 | variables))) | 108 | variables))) |
| 108 | (unless (stringp source-block) | 109 | (unless (stringp source-block) |
| 109 | (setq source-block (symbol-name source-block))) | 110 | (setq source-block (symbol-name source-block))) |
| 110 | ((lambda (result) | 111 | (let ((result |
| 111 | (org-babel-trim (if (stringp result) result (format "%S" result)))) | 112 | (if (and source-block (> (length source-block) 0)) |
| 112 | (if (and source-block (> (length source-block) 0)) | 113 | (let ((params |
| 113 | (let ((params | 114 | ;; FIXME: Why `eval'?!?!? |
| 114 | (eval `(org-babel-parse-header-arguments | 115 | (eval `(org-babel-parse-header-arguments |
| 115 | (concat | 116 | (concat |
| 116 | ":var results=" | 117 | ":var results=" |
| 117 | ,source-block | 118 | ,source-block |
| 118 | "[" ,header-args "]" | 119 | "[" ,header-args "]" |
| 119 | "(" | 120 | "(" |
| 120 | (mapconcat | 121 | (mapconcat |
| 121 | (lambda (var-spec) | 122 | (lambda (var-spec) |
| 122 | (if (> (length (cdr var-spec)) 1) | 123 | (if (> (length (cdr var-spec)) 1) |
| 123 | (format "%S='%S" | 124 | (format "%S='%S" |
| 124 | (car var-spec) | 125 | (car var-spec) |
| 125 | (mapcar #'read (cdr var-spec))) | 126 | (mapcar #'read (cdr var-spec))) |
| 126 | (format "%S=%s" | 127 | (format "%S=%s" |
| 127 | (car var-spec) (cadr var-spec)))) | 128 | (car var-spec) (cadr var-spec)))) |
| 128 | ',variables ", ") | 129 | ',variables ", ") |
| 129 | ")"))))) | 130 | ")"))))) |
| 130 | (org-babel-execute-src-block | 131 | (org-babel-execute-src-block |
| 131 | nil (list "emacs-lisp" "results" params) | 132 | nil (list "emacs-lisp" "results" params) |
| 132 | '((:results . "silent")))) | 133 | '((:results . "silent")))) |
| 133 | ""))))) | 134 | ""))) |
| 134 | (def-edebug-spec sbe (form form)) | 135 | (org-babel-trim (if (stringp result) result (format "%S" result))))))) |
| 135 | 136 | ||
| 136 | (provide 'ob-table) | 137 | (provide 'ob-table) |
| 137 | 138 | ||
diff --git a/lisp/org/ob-tangle.el b/lisp/org/ob-tangle.el index 9f0e2de7f1a..ffc74cb22a9 100644 --- a/lisp/org/ob-tangle.el +++ b/lisp/org/ob-tangle.el | |||
| @@ -210,8 +210,8 @@ used to limit the exported source code blocks by language." | |||
| 210 | (lambda (spec) | 210 | (lambda (spec) |
| 211 | (let ((get-spec (lambda (name) (cdr (assoc name (nth 4 spec)))))) | 211 | (let ((get-spec (lambda (name) (cdr (assoc name (nth 4 spec)))))) |
| 212 | (let* ((tangle (funcall get-spec :tangle)) | 212 | (let* ((tangle (funcall get-spec :tangle)) |
| 213 | (she-bang ((lambda (sheb) (when (> (length sheb) 0) sheb)) | 213 | (she-bang (let ((sheb (funcall get-spec :shebang))) |
| 214 | (funcall get-spec :shebang))) | 214 | (when (> (length sheb) 0) sheb))) |
| 215 | (tangle-mode (funcall get-spec :tangle-mode)) | 215 | (tangle-mode (funcall get-spec :tangle-mode)) |
| 216 | (base-name (cond | 216 | (base-name (cond |
| 217 | ((string= "yes" tangle) | 217 | ((string= "yes" tangle) |
| @@ -224,9 +224,9 @@ used to limit the exported source code blocks by language." | |||
| 224 | (if (and ext (string= "yes" tangle)) | 224 | (if (and ext (string= "yes" tangle)) |
| 225 | (concat base-name "." ext) base-name)))) | 225 | (concat base-name "." ext) base-name)))) |
| 226 | (when file-name | 226 | (when file-name |
| 227 | ;; possibly create the parent directories for file | 227 | ;; Possibly create the parent directories for file. |
| 228 | (when ((lambda (m) (and m (not (string= m "no")))) | 228 | (when (let ((m (funcall get-spec :mkdirp))) |
| 229 | (funcall get-spec :mkdirp)) | 229 | (and m (not (string= m "no")))) |
| 230 | (make-directory (file-name-directory file-name) 'parents)) | 230 | (make-directory (file-name-directory file-name) 'parents)) |
| 231 | ;; delete any old versions of file | 231 | ;; delete any old versions of file |
| 232 | (when (and (file-exists-p file-name) | 232 | (when (and (file-exists-p file-name) |
| @@ -314,9 +314,8 @@ that the appropriate major-mode is set. SPEC has the form: | |||
| 314 | (string= comments "yes") (string= comments "noweb"))) | 314 | (string= comments "yes") (string= comments "noweb"))) |
| 315 | (link-data (mapcar (lambda (el) | 315 | (link-data (mapcar (lambda (el) |
| 316 | (cons (symbol-name el) | 316 | (cons (symbol-name el) |
| 317 | ((lambda (le) | 317 | (let ((le (eval el))) |
| 318 | (if (stringp le) le (format "%S" le))) | 318 | (if (stringp le) le (format "%S" le))))) |
| 319 | (eval el)))) | ||
| 320 | '(start-line file link source-name))) | 319 | '(start-line file link source-name))) |
| 321 | (insert-comment (lambda (text) | 320 | (insert-comment (lambda (text) |
| 322 | (when (and comments (not (string= comments "no")) | 321 | (when (and comments (not (string= comments "no")) |
| @@ -402,11 +401,10 @@ list to be used by `org-babel-tangle' directly." | |||
| 402 | (cref-fmt (or (and (string-match "-l \"\\(.+\\)\"" extra) | 401 | (cref-fmt (or (and (string-match "-l \"\\(.+\\)\"" extra) |
| 403 | (match-string 1 extra)) | 402 | (match-string 1 extra)) |
| 404 | org-coderef-label-format)) | 403 | org-coderef-label-format)) |
| 405 | (link ((lambda (link) | 404 | (link (let ((link (org-no-properties |
| 406 | (and (string-match org-bracket-link-regexp link) | 405 | (org-store-link nil)))) |
| 407 | (match-string 1 link))) | 406 | (and (string-match org-bracket-link-regexp link) |
| 408 | (org-no-properties | 407 | (match-string 1 link)))) |
| 409 | (org-store-link nil)))) | ||
| 410 | (source-name | 408 | (source-name |
| 411 | (intern (or (nth 4 info) | 409 | (intern (or (nth 4 info) |
| 412 | (format "%s:%d" | 410 | (format "%s:%d" |
| @@ -418,28 +416,29 @@ list to be used by `org-babel-tangle' directly." | |||
| 418 | (assignments-cmd | 416 | (assignments-cmd |
| 419 | (intern (concat "org-babel-variable-assignments:" src-lang))) | 417 | (intern (concat "org-babel-variable-assignments:" src-lang))) |
| 420 | (body | 418 | (body |
| 421 | ((lambda (body) ;; Run the tangle-body-hook | 419 | ;; Run the tangle-body-hook. |
| 422 | (with-temp-buffer | 420 | (let* ((body ;; Expand the body in language specific manner. |
| 423 | (insert body) | 421 | (if (org-babel-noweb-p params :tangle) |
| 424 | (when (string-match "-r" extra) | 422 | (org-babel-expand-noweb-references info) |
| 425 | (goto-char (point-min)) | 423 | (nth 1 info))) |
| 426 | (while (re-search-forward | 424 | (body |
| 427 | (replace-regexp-in-string "%s" ".+" cref-fmt) nil t) | 425 | (if (assoc :no-expand params) |
| 428 | (replace-match ""))) | 426 | body |
| 429 | (run-hooks 'org-babel-tangle-body-hook) | 427 | (if (fboundp expand-cmd) |
| 430 | (buffer-string))) | 428 | (funcall expand-cmd body params) |
| 431 | ((lambda (body) ;; Expand the body in language specific manner | 429 | (org-babel-expand-body:generic |
| 432 | (if (assoc :no-expand params) | 430 | body params |
| 433 | body | 431 | (and (fboundp assignments-cmd) |
| 434 | (if (fboundp expand-cmd) | 432 | (funcall assignments-cmd params))))))) |
| 435 | (funcall expand-cmd body params) | 433 | (with-temp-buffer |
| 436 | (org-babel-expand-body:generic | 434 | (insert body) |
| 437 | body params | 435 | (when (string-match "-r" extra) |
| 438 | (and (fboundp assignments-cmd) | 436 | (goto-char (point-min)) |
| 439 | (funcall assignments-cmd params)))))) | 437 | (while (re-search-forward |
| 440 | (if (org-babel-noweb-p params :tangle) | 438 | (replace-regexp-in-string "%s" ".+" cref-fmt) nil t) |
| 441 | (org-babel-expand-noweb-references info) | 439 | (replace-match ""))) |
| 442 | (nth 1 info))))) | 440 | (run-hooks 'org-babel-tangle-body-hook) |
| 441 | (buffer-string)))) | ||
| 443 | (comment | 442 | (comment |
| 444 | (when (or (string= "both" (cdr (assoc :comments params))) | 443 | (when (or (string= "both" (cdr (assoc :comments params))) |
| 445 | (string= "org" (cdr (assoc :comments params)))) | 444 | (string= "org" (cdr (assoc :comments params)))) |
| @@ -474,9 +473,8 @@ list to be used by `org-babel-tangle' directly." | |||
| 474 | (source-name (nth 4 (or info (org-babel-get-src-block-info 'light)))) | 473 | (source-name (nth 4 (or info (org-babel-get-src-block-info 'light)))) |
| 475 | (link-data (mapcar (lambda (el) | 474 | (link-data (mapcar (lambda (el) |
| 476 | (cons (symbol-name el) | 475 | (cons (symbol-name el) |
| 477 | ((lambda (le) | 476 | (let ((le (eval el))) |
| 478 | (if (stringp le) le (format "%S" le))) | 477 | (if (stringp le) le (format "%S" le))))) |
| 479 | (eval el)))) | ||
| 480 | '(start-line file link source-name)))) | 478 | '(start-line file link source-name)))) |
| 481 | (list (org-fill-template org-babel-tangle-comment-format-beg link-data) | 479 | (list (org-fill-template org-babel-tangle-comment-format-beg link-data) |
| 482 | (org-fill-template org-babel-tangle-comment-format-end link-data)))) | 480 | (org-fill-template org-babel-tangle-comment-format-end link-data)))) |
diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el index fedbbe72ed7..3ecd49a81fa 100644 --- a/lisp/org/org-agenda.el +++ b/lisp/org/org-agenda.el | |||
| @@ -2840,6 +2840,8 @@ Pressing `<' twice means to restrict to the current subtree or region | |||
| 2840 | ((equal org-keys "!") (customize-variable 'org-stuck-projects)) | 2840 | ((equal org-keys "!") (customize-variable 'org-stuck-projects)) |
| 2841 | (t (user-error "Invalid agenda key")))))) | 2841 | (t (user-error "Invalid agenda key")))))) |
| 2842 | 2842 | ||
| 2843 | (defvar org-agenda-multi) | ||
| 2844 | |||
| 2843 | (defun org-agenda-append-agenda () | 2845 | (defun org-agenda-append-agenda () |
| 2844 | "Append another agenda view to the current one. | 2846 | "Append another agenda view to the current one. |
| 2845 | This function allows interactive building of block agendas. | 2847 | This function allows interactive building of block agendas. |
| @@ -3814,6 +3816,8 @@ generating a new one." | |||
| 3814 | 'org-priority)) | 3816 | 'org-priority)) |
| 3815 | (overlay-put ov 'org-type 'org-priority))))) | 3817 | (overlay-put ov 'org-type 'org-priority))))) |
| 3816 | 3818 | ||
| 3819 | (defvar org-depend-tag-blocked) | ||
| 3820 | |||
| 3817 | (defun org-agenda-dim-blocked-tasks (&optional invisible) | 3821 | (defun org-agenda-dim-blocked-tasks (&optional invisible) |
| 3818 | "Dim currently blocked TODO's in the agenda display. | 3822 | "Dim currently blocked TODO's in the agenda display. |
| 3819 | When INVISIBLE is non-nil, hide currently blocked TODO instead of | 3823 | When INVISIBLE is non-nil, hide currently blocked TODO instead of |
| @@ -3982,6 +3986,7 @@ This check for agenda markers in all agenda buffers currently active." | |||
| 3982 | ;;; Agenda timeline | 3986 | ;;; Agenda timeline |
| 3983 | 3987 | ||
| 3984 | (defvar org-agenda-only-exact-dates nil) ; dynamically scoped | 3988 | (defvar org-agenda-only-exact-dates nil) ; dynamically scoped |
| 3989 | (defvar org-agenda-show-log-scoped) ;; dynamically scope in `org-timeline' or `org-agenda-list' | ||
| 3985 | 3990 | ||
| 3986 | (defun org-timeline (&optional dotodo) | 3991 | (defun org-timeline (&optional dotodo) |
| 3987 | "Show a time-sorted view of the entries in the current org file. | 3992 | "Show a time-sorted view of the entries in the current org file. |
| @@ -5762,7 +5767,6 @@ please use `org-class' instead." | |||
| 5762 | dayname skip-weeks))) | 5767 | dayname skip-weeks))) |
| 5763 | (make-obsolete 'org-diary-class 'org-class "") | 5768 | (make-obsolete 'org-diary-class 'org-class "") |
| 5764 | 5769 | ||
| 5765 | (defvar org-agenda-show-log-scoped) ;; dynamically scope in `org-timeline' or `org-agenda-list' | ||
| 5766 | (defalias 'org-get-closed 'org-agenda-get-progress) | 5770 | (defalias 'org-get-closed 'org-agenda-get-progress) |
| 5767 | (defun org-agenda-get-progress () | 5771 | (defun org-agenda-get-progress () |
| 5768 | "Return the logged TODO entries for agenda display." | 5772 | "Return the logged TODO entries for agenda display." |
diff --git a/lisp/org/org-bibtex.el b/lisp/org/org-bibtex.el index 1f71d91ae9c..52643994879 100644 --- a/lisp/org/org-bibtex.el +++ b/lisp/org/org-bibtex.el | |||
| @@ -293,12 +293,13 @@ This variable is relevant only if `org-bibtex-export-tags-as-keywords' is t." | |||
| 293 | 293 | ||
| 294 | ;;; Utility functions | 294 | ;;; Utility functions |
| 295 | (defun org-bibtex-get (property) | 295 | (defun org-bibtex-get (property) |
| 296 | ((lambda (it) (when it (org-babel-trim it))) | 296 | (let ((it (let ((org-special-properties |
| 297 | (let ((org-special-properties | 297 | (delete "FILE" (copy-sequence org-special-properties)))) |
| 298 | (delete "FILE" (copy-sequence org-special-properties)))) | 298 | (or |
| 299 | (or | 299 | (org-entry-get (point) (upcase property)) |
| 300 | (org-entry-get (point) (upcase property)) | 300 | (org-entry-get (point) (concat org-bibtex-prefix |
| 301 | (org-entry-get (point) (concat org-bibtex-prefix (upcase property))))))) | 301 | (upcase property))))))) |
| 302 | (when it (org-babel-trim it)))) | ||
| 302 | 303 | ||
| 303 | (defun org-bibtex-put (property value) | 304 | (defun org-bibtex-put (property value) |
| 304 | (let ((prop (upcase (if (keywordp property) | 305 | (let ((prop (upcase (if (keywordp property) |
| @@ -384,8 +385,8 @@ This variable is relevant only if `org-bibtex-export-tags-as-keywords' is t." | |||
| 384 | (princ (cdr (assoc field org-bibtex-fields)))) | 385 | (princ (cdr (assoc field org-bibtex-fields)))) |
| 385 | (with-current-buffer buf-name (visual-line-mode 1)) | 386 | (with-current-buffer buf-name (visual-line-mode 1)) |
| 386 | (org-fit-window-to-buffer (get-buffer-window buf-name)) | 387 | (org-fit-window-to-buffer (get-buffer-window buf-name)) |
| 387 | ((lambda (result) (when (> (length result) 0) result)) | 388 | (let ((result (read-from-minibuffer (format "%s: " name)))) |
| 388 | (read-from-minibuffer (format "%s: " name)))))) | 389 | (when (> (length result) 0) result))))) |
| 389 | 390 | ||
| 390 | (defun org-bibtex-autokey () | 391 | (defun org-bibtex-autokey () |
| 391 | "Generate an autokey for the current headline." | 392 | "Generate an autokey for the current headline." |
| @@ -539,20 +540,21 @@ Headlines are exported using `org-bibtex-export-headline'." | |||
| 539 | "Bibtex file: " nil nil nil | 540 | "Bibtex file: " nil nil nil |
| 540 | (file-name-nondirectory | 541 | (file-name-nondirectory |
| 541 | (concat (file-name-sans-extension (buffer-file-name)) ".bib"))))) | 542 | (concat (file-name-sans-extension (buffer-file-name)) ".bib"))))) |
| 542 | ((lambda (error-point) | 543 | (let ((error-point |
| 543 | (when error-point | 544 | (catch 'bib |
| 544 | (goto-char error-point) | 545 | (let ((bibtex-entries |
| 545 | (message "Bibtex error at %S" (nth 4 (org-heading-components))))) | 546 | (remove nil (org-map-entries |
| 546 | (catch 'bib | 547 | (lambda () |
| 547 | (let ((bibtex-entries (remove nil (org-map-entries | 548 | (condition-case foo |
| 548 | (lambda () | 549 | (org-bibtex-headline) |
| 549 | (condition-case foo | 550 | (error (throw 'bib (point))))))))) |
| 550 | (org-bibtex-headline) | 551 | (with-temp-file filename |
| 551 | (error (throw 'bib (point))))))))) | 552 | (insert (mapconcat #'identity bibtex-entries "\n"))) |
| 552 | (with-temp-file filename | 553 | (message "Successfully exported %d BibTeX entries to %s" |
| 553 | (insert (mapconcat #'identity bibtex-entries "\n"))) | 554 | (length bibtex-entries) filename) nil)))) |
| 554 | (message "Successfully exported %d BibTeX entries to %s" | 555 | (when error-point |
| 555 | (length bibtex-entries) filename) nil)))) | 556 | (goto-char error-point) |
| 557 | (message "Bibtex error at %S" (nth 4 (org-heading-components)))))) | ||
| 556 | 558 | ||
| 557 | (defun org-bibtex-check (&optional optional) | 559 | (defun org-bibtex-check (&optional optional) |
| 558 | "Check the current headline for required fields. | 560 | "Check the current headline for required fields. |
| @@ -560,8 +562,8 @@ With prefix argument OPTIONAL also prompt for optional fields." | |||
| 560 | (interactive "P") | 562 | (interactive "P") |
| 561 | (save-restriction | 563 | (save-restriction |
| 562 | (org-narrow-to-subtree) | 564 | (org-narrow-to-subtree) |
| 563 | (let ((type ((lambda (name) (when name (intern (concat ":" name)))) | 565 | (let ((type (let ((name (org-bibtex-get org-bibtex-type-property-name))) |
| 564 | (org-bibtex-get org-bibtex-type-property-name)))) | 566 | (when name (intern (concat ":" name)))))) |
| 565 | (when type (org-bibtex-fleshout type optional))))) | 567 | (when type (org-bibtex-fleshout type optional))))) |
| 566 | 568 | ||
| 567 | (defun org-bibtex-check-all (&optional optional) | 569 | (defun org-bibtex-check-all (&optional optional) |
diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el index 9f2256286b1..0b2037d0725 100644 --- a/lisp/org/org-clock.el +++ b/lisp/org/org-clock.el | |||
| @@ -1114,6 +1114,7 @@ so long." | |||
| 1114 | 1114 | ||
| 1115 | (defvar org-clock-current-task nil "Task currently clocked in.") | 1115 | (defvar org-clock-current-task nil "Task currently clocked in.") |
| 1116 | (defvar org-clock-out-time nil) ; store the time of the last clock-out | 1116 | (defvar org-clock-out-time nil) ; store the time of the last clock-out |
| 1117 | (defvar org--msg-extra) | ||
| 1117 | 1118 | ||
| 1118 | ;;;###autoload | 1119 | ;;;###autoload |
| 1119 | (defun org-clock-in (&optional select start-time) | 1120 | (defun org-clock-in (&optional select start-time) |
| @@ -1133,7 +1134,7 @@ make this the default behavior.)" | |||
| 1133 | (catch 'abort | 1134 | (catch 'abort |
| 1134 | (let ((interrupting (and (not org-clock-resolving-clocks-due-to-idleness) | 1135 | (let ((interrupting (and (not org-clock-resolving-clocks-due-to-idleness) |
| 1135 | (org-clocking-p))) | 1136 | (org-clocking-p))) |
| 1136 | ts selected-task target-pos (msg-extra "") | 1137 | ts selected-task target-pos (org--msg-extra "") |
| 1137 | (leftover (and (not org-clock-resolving-clocks) | 1138 | (leftover (and (not org-clock-resolving-clocks) |
| 1138 | org-clock-leftover-time))) | 1139 | org-clock-leftover-time))) |
| 1139 | 1140 | ||
| @@ -1305,7 +1306,7 @@ make this the default behavior.)" | |||
| 1305 | (setq org-clock-idle-timer nil)) | 1306 | (setq org-clock-idle-timer nil)) |
| 1306 | (setq org-clock-idle-timer | 1307 | (setq org-clock-idle-timer |
| 1307 | (run-with-timer 60 60 'org-resolve-clocks-if-idle)) | 1308 | (run-with-timer 60 60 'org-resolve-clocks-if-idle)) |
| 1308 | (message "Clock starts at %s - %s" ts msg-extra) | 1309 | (message "Clock starts at %s - %s" ts org--msg-extra) |
| 1309 | (run-hooks 'org-clock-in-hook))))))) | 1310 | (run-hooks 'org-clock-in-hook))))))) |
| 1310 | 1311 | ||
| 1311 | ;;;###autoload | 1312 | ;;;###autoload |
| @@ -1351,7 +1352,6 @@ for a todo state to switch to, overriding the existing value | |||
| 1351 | (org-back-to-heading t) | 1352 | (org-back-to-heading t) |
| 1352 | (move-marker org-clock-default-task (point)))) | 1353 | (move-marker org-clock-default-task (point)))) |
| 1353 | 1354 | ||
| 1354 | (defvar msg-extra) | ||
| 1355 | (defun org-clock-get-sum-start () | 1355 | (defun org-clock-get-sum-start () |
| 1356 | "Return the time from which clock times should be counted. | 1356 | "Return the time from which clock times should be counted. |
| 1357 | This is for the currently running clock as it is displayed | 1357 | This is for the currently running clock as it is displayed |
| @@ -1364,10 +1364,10 @@ decides which time to use." | |||
| 1364 | (lr (org-entry-get nil "LAST_REPEAT"))) | 1364 | (lr (org-entry-get nil "LAST_REPEAT"))) |
| 1365 | (cond | 1365 | (cond |
| 1366 | ((equal cmt "current") | 1366 | ((equal cmt "current") |
| 1367 | (setq msg-extra "showing time in current clock instance") | 1367 | (setq org--msg-extra "showing time in current clock instance") |
| 1368 | (current-time)) | 1368 | (current-time)) |
| 1369 | ((equal cmt "today") | 1369 | ((equal cmt "today") |
| 1370 | (setq msg-extra "showing today's task time.") | 1370 | (setq org--msg-extra "showing today's task time.") |
| 1371 | (let* ((dt (decode-time (current-time)))) | 1371 | (let* ((dt (decode-time (current-time)))) |
| 1372 | (setq dt (append (list 0 0 0) (nthcdr 3 dt))) | 1372 | (setq dt (append (list 0 0 0) (nthcdr 3 dt))) |
| 1373 | (if org-extend-today-until | 1373 | (if org-extend-today-until |
| @@ -1376,12 +1376,12 @@ decides which time to use." | |||
| 1376 | ((or (equal cmt "all") | 1376 | ((or (equal cmt "all") |
| 1377 | (and (or (not cmt) (equal cmt "auto")) | 1377 | (and (or (not cmt) (equal cmt "auto")) |
| 1378 | (not lr))) | 1378 | (not lr))) |
| 1379 | (setq msg-extra "showing entire task time.") | 1379 | (setq org--msg-extra "showing entire task time.") |
| 1380 | nil) | 1380 | nil) |
| 1381 | ((or (equal cmt "repeat") | 1381 | ((or (equal cmt "repeat") |
| 1382 | (and (or (not cmt) (equal cmt "auto")) | 1382 | (and (or (not cmt) (equal cmt "auto")) |
| 1383 | lr)) | 1383 | lr)) |
| 1384 | (setq msg-extra "showing task time since last repeat.") | 1384 | (setq org--msg-extra "showing task time since last repeat.") |
| 1385 | (if (not lr) | 1385 | (if (not lr) |
| 1386 | nil | 1386 | nil |
| 1387 | (org-time-string-to-time lr))) | 1387 | (org-time-string-to-time lr))) |
diff --git a/lisp/org/org-colview.el b/lisp/org/org-colview.el index 8790ad45fb1..523b42186b4 100644 --- a/lisp/org/org-colview.el +++ b/lisp/org/org-colview.el | |||
| @@ -416,6 +416,10 @@ If yes, throw an error indicating that changing it does not make sense." | |||
| 416 | (org-columns-next-allowed-value) | 416 | (org-columns-next-allowed-value) |
| 417 | (org-columns-edit-value "TAGS"))) | 417 | (org-columns-edit-value "TAGS"))) |
| 418 | 418 | ||
| 419 | (defvar org-agenda-overriding-columns-format nil | ||
| 420 | "When set, overrides any other format definition for the agenda. | ||
| 421 | Don't set this, this is meant for dynamic scoping.") | ||
| 422 | |||
| 419 | (defun org-columns-edit-value (&optional key) | 423 | (defun org-columns-edit-value (&optional key) |
| 420 | "Edit the value of the property at point in column view. | 424 | "Edit the value of the property at point in column view. |
| 421 | Where possible, use the standard interface for changing this line." | 425 | Where possible, use the standard interface for changing this line." |
| @@ -901,10 +905,6 @@ display, or in the #+COLUMNS line of the current buffer." | |||
| 901 | (insert-before-markers "#+COLUMNS: " fmt "\n"))) | 905 | (insert-before-markers "#+COLUMNS: " fmt "\n"))) |
| 902 | (org-set-local 'org-columns-default-format fmt)))))) | 906 | (org-set-local 'org-columns-default-format fmt)))))) |
| 903 | 907 | ||
| 904 | (defvar org-agenda-overriding-columns-format nil | ||
| 905 | "When set, overrides any other format definition for the agenda. | ||
| 906 | Don't set this, this is meant for dynamic scoping.") | ||
| 907 | |||
| 908 | (defun org-columns-get-autowidth-alist (s cache) | 908 | (defun org-columns-get-autowidth-alist (s cache) |
| 909 | "Derive the maximum column widths from the format and the cache." | 909 | "Derive the maximum column widths from the format and the cache." |
| 910 | (let ((start 0) rtn) | 910 | (let ((start 0) rtn) |
diff --git a/lisp/org/org-src.el b/lisp/org/org-src.el index 6ec3adc4719..99038576ff7 100644 --- a/lisp/org/org-src.el +++ b/lisp/org/org-src.el | |||
| @@ -844,8 +844,9 @@ with \",*\", \",#+\", \",,*\" and \",,#+\"." | |||
| 844 | (let ((session (cdr (assoc :session (nth 2 info))))) | 844 | (let ((session (cdr (assoc :session (nth 2 info))))) |
| 845 | (and session (not (string= session "none")) | 845 | (and session (not (string= session "none")) |
| 846 | (org-babel-comint-buffer-livep session) | 846 | (org-babel-comint-buffer-livep session) |
| 847 | ((lambda (f) (and (fboundp f) (funcall f session))) | 847 | (let ((f (intern (format "org-babel-%s-associate-session" |
| 848 | (intern (format "org-babel-%s-associate-session" (nth 0 info))))))) | 848 | (nth 0 info))))) |
| 849 | (and (fboundp f) (funcall f session)))))) | ||
| 849 | 850 | ||
| 850 | (defun org-src-babel-configure-edit-buffer () | 851 | (defun org-src-babel-configure-edit-buffer () |
| 851 | (when org-src-babel-info | 852 | (when org-src-babel-info |
| @@ -953,8 +954,9 @@ fontification of code blocks see `org-src-fontify-block' and | |||
| 953 | LANG is a string, and the returned major mode is a symbol." | 954 | LANG is a string, and the returned major mode is a symbol." |
| 954 | (intern | 955 | (intern |
| 955 | (concat | 956 | (concat |
| 956 | ((lambda (l) (if (symbolp l) (symbol-name l) l)) | 957 | (let ((l (or (cdr (assoc lang org-src-lang-modes)) lang))) |
| 957 | (or (cdr (assoc lang org-src-lang-modes)) lang)) "-mode"))) | 958 | (if (symbolp l) (symbol-name l) l)) |
| 959 | "-mode"))) | ||
| 958 | 960 | ||
| 959 | (provide 'org-src) | 961 | (provide 'org-src) |
| 960 | 962 | ||
diff --git a/lisp/org/org.el b/lisp/org/org.el index 4a74d44fe1d..8e23ec9f87f 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el | |||
| @@ -82,7 +82,7 @@ | |||
| 82 | (require 'org-macs) | 82 | (require 'org-macs) |
| 83 | (require 'org-compat) | 83 | (require 'org-compat) |
| 84 | 84 | ||
| 85 | ;; `org-outline-regexp' ought to be a defconst but is let-binding in | 85 | ;; `org-outline-regexp' ought to be a defconst but is let-bound in |
| 86 | ;; some places -- e.g. see the macro `org-with-limited-levels'. | 86 | ;; some places -- e.g. see the macro `org-with-limited-levels'. |
| 87 | ;; | 87 | ;; |
| 88 | ;; In Org buffers, the value of `outline-regexp' is that of | 88 | ;; In Org buffers, the value of `outline-regexp' is that of |
| @@ -304,13 +304,13 @@ When MESSAGE is non-nil, display a message with the version." | |||
| 304 | org-install-dir | 304 | org-install-dir |
| 305 | (concat "mixed installation! " org-install-dir " and " org-dir)) | 305 | (concat "mixed installation! " org-install-dir " and " org-dir)) |
| 306 | "org-loaddefs.el can not be found!"))) | 306 | "org-loaddefs.el can not be found!"))) |
| 307 | (_version (if full version org-version))) | 307 | (version1 (if full version org-version))) |
| 308 | (if (org-called-interactively-p 'interactive) | 308 | (if (org-called-interactively-p 'interactive) |
| 309 | (if here | 309 | (if here |
| 310 | (insert version) | 310 | (insert version) |
| 311 | (message version)) | 311 | (message version)) |
| 312 | (if message (message _version)) | 312 | (if message (message _version)) |
| 313 | _version))) | 313 | version1))) |
| 314 | 314 | ||
| 315 | (defconst org-version (org-version)) | 315 | (defconst org-version (org-version)) |
| 316 | 316 | ||
| @@ -4804,6 +4804,8 @@ This can be turned on/off through `org-toggle-tags-groups'." | |||
| 4804 | :group 'org-startup | 4804 | :group 'org-startup |
| 4805 | :type 'boolean) | 4805 | :type 'boolean) |
| 4806 | 4806 | ||
| 4807 | (defvar org-inhibit-startup nil) ; Dynamically-scoped param. | ||
| 4808 | |||
| 4807 | (defun org-toggle-tags-groups () | 4809 | (defun org-toggle-tags-groups () |
| 4808 | "Toggle support for group tags. | 4810 | "Toggle support for group tags. |
| 4809 | Support for group tags is controlled by the option | 4811 | Support for group tags is controlled by the option |
| @@ -5264,7 +5266,6 @@ This variable is set by `org-before-change-function'. | |||
| 5264 | "Every change indicates that a table might need an update." | 5266 | "Every change indicates that a table might need an update." |
| 5265 | (setq org-table-may-need-update t)) | 5267 | (setq org-table-may-need-update t)) |
| 5266 | (defvar org-mode-map) | 5268 | (defvar org-mode-map) |
| 5267 | (defvar org-inhibit-startup nil) ; Dynamically-scoped param. | ||
| 5268 | (defvar org-inhibit-startup-visibility-stuff nil) ; Dynamically-scoped param. | 5269 | (defvar org-inhibit-startup-visibility-stuff nil) ; Dynamically-scoped param. |
| 5269 | (defvar org-agenda-keep-modes nil) ; Dynamically-scoped param. | 5270 | (defvar org-agenda-keep-modes nil) ; Dynamically-scoped param. |
| 5270 | (defvar org-inhibit-logging nil) ; Dynamically-scoped param. | 5271 | (defvar org-inhibit-logging nil) ; Dynamically-scoped param. |
| @@ -6714,6 +6715,8 @@ in special contexts. | |||
| 6714 | (setq org-cycle-global-status 'overview) | 6715 | (setq org-cycle-global-status 'overview) |
| 6715 | (run-hook-with-args 'org-cycle-hook 'overview))))) | 6716 | (run-hook-with-args 'org-cycle-hook 'overview))))) |
| 6716 | 6717 | ||
| 6718 | (defvar org-called-with-limited-levels);Dyn-bound in ̀org-with-limited-levels'. | ||
| 6719 | |||
| 6717 | (defun org-cycle-internal-local () | 6720 | (defun org-cycle-internal-local () |
| 6718 | "Do the local cycling action." | 6721 | "Do the local cycling action." |
| 6719 | (let ((goal-column 0) eoh eol eos has-children children-skipped struct) | 6722 | (let ((goal-column 0) eoh eol eos has-children children-skipped struct) |
| @@ -7944,8 +7947,6 @@ even level numbers will become the next higher odd number." | |||
| 7944 | (define-obsolete-function-alias 'org-get-legal-level | 7947 | (define-obsolete-function-alias 'org-get-legal-level |
| 7945 | 'org-get-valid-level "23.1"))) | 7948 | 'org-get-valid-level "23.1"))) |
| 7946 | 7949 | ||
| 7947 | (defvar org-called-with-limited-levels nil) ;; Dynamically bound in | ||
| 7948 | ;; ̀org-with-limited-levels' | ||
| 7949 | (defun org-promote () | 7950 | (defun org-promote () |
| 7950 | "Promote the current heading higher up the tree. | 7951 | "Promote the current heading higher up the tree. |
| 7951 | If the region is active in `transient-mark-mode', promote all headings | 7952 | If the region is active in `transient-mark-mode', promote all headings |
| @@ -10321,6 +10322,7 @@ Functions in this hook must return t if they identify and follow | |||
| 10321 | a link at point. If they don't find anything interesting at point, | 10322 | a link at point. If they don't find anything interesting at point, |
| 10322 | they must return nil.") | 10323 | they must return nil.") |
| 10323 | 10324 | ||
| 10325 | (defvar org-link-search-inhibit-query nil) ;; dynamically scoped | ||
| 10324 | (defvar clean-buffer-list-kill-buffer-names) ; Defined in midnight.el | 10326 | (defvar clean-buffer-list-kill-buffer-names) ; Defined in midnight.el |
| 10325 | (defun org-open-at-point (&optional arg reference-buffer) | 10327 | (defun org-open-at-point (&optional arg reference-buffer) |
| 10326 | "Open link at or after point. | 10328 | "Open link at or after point. |
| @@ -10696,7 +10698,6 @@ the window configuration before `org-open-at-point' was called using: | |||
| 10696 | 10698 | ||
| 10697 | (set-window-configuration org-window-config-before-follow-link)") | 10699 | (set-window-configuration org-window-config-before-follow-link)") |
| 10698 | 10700 | ||
| 10699 | (defvar org-link-search-inhibit-query nil) ;; dynamically scoped | ||
| 10700 | (defun org-link-search (s &optional type avoid-pos stealth) | 10701 | (defun org-link-search (s &optional type avoid-pos stealth) |
| 10701 | "Search for a link search option. | 10702 | "Search for a link search option. |
| 10702 | If S is surrounded by forward slashes, it is interpreted as a | 10703 | If S is surrounded by forward slashes, it is interpreted as a |
| @@ -13104,6 +13105,9 @@ nil." | |||
| 13104 | (delete-region (point-at-bol) | 13105 | (delete-region (point-at-bol) |
| 13105 | (min (point-max) (1+ (point-at-eol)))))))))) | 13106 | (min (point-max) (1+ (point-at-eol)))))))))) |
| 13106 | 13107 | ||
| 13108 | (defvar org-time-was-given) ; dynamically scoped parameter | ||
| 13109 | (defvar org-end-time-was-given) ; dynamically scoped parameter | ||
| 13110 | |||
| 13107 | (defun org-add-planning-info (what &optional time &rest remove) | 13111 | (defun org-add-planning-info (what &optional time &rest remove) |
| 13108 | "Insert new timestamp with keyword in the line directly after the headline. | 13112 | "Insert new timestamp with keyword in the line directly after the headline. |
| 13109 | WHAT indicates what kind of time stamp to add. TIME indicates the time to use. | 13113 | WHAT indicates what kind of time stamp to add. TIME indicates the time to use. |
| @@ -16035,8 +16039,6 @@ Return the position where this entry starts, or nil if there is no such entry." | |||
| 16035 | (defvar org-last-changed-timestamp nil) | 16039 | (defvar org-last-changed-timestamp nil) |
| 16036 | (defvar org-last-inserted-timestamp nil | 16040 | (defvar org-last-inserted-timestamp nil |
| 16037 | "The last time stamp inserted with `org-insert-time-stamp'.") | 16041 | "The last time stamp inserted with `org-insert-time-stamp'.") |
| 16038 | (defvar org-time-was-given) ; dynamically scoped parameter | ||
| 16039 | (defvar org-end-time-was-given) ; dynamically scoped parameter | ||
| 16040 | (defvar org-ts-what) ; dynamically scoped parameter | 16042 | (defvar org-ts-what) ; dynamically scoped parameter |
| 16041 | 16043 | ||
| 16042 | (defun org-time-stamp (arg &optional inactive) | 16044 | (defun org-time-stamp (arg &optional inactive) |
| @@ -16225,6 +16227,10 @@ So these are more for recording a certain time/date." | |||
| 16225 | map) | 16227 | map) |
| 16226 | "Keymap for minibuffer commands when using `org-read-date'.") | 16228 | "Keymap for minibuffer commands when using `org-read-date'.") |
| 16227 | 16229 | ||
| 16230 | (defvar org-def) | ||
| 16231 | (defvar org-defdecode) | ||
| 16232 | (defvar org-with-time) | ||
| 16233 | |||
| 16228 | (defun org-read-date (&optional org-with-time to-time from-string prompt | 16234 | (defun org-read-date (&optional org-with-time to-time from-string prompt |
| 16229 | default-time default-input inactive) | 16235 | default-time default-input inactive) |
| 16230 | "Read a date, possibly a time, and make things smooth for the user. | 16236 | "Read a date, possibly a time, and make things smooth for the user. |
| @@ -16371,9 +16377,6 @@ user." | |||
| 16371 | (nth 2 final) (nth 1 final)) | 16377 | (nth 2 final) (nth 1 final)) |
| 16372 | (format "%04d-%02d-%02d" (nth 5 final) (nth 4 final) (nth 3 final)))))) | 16378 | (format "%04d-%02d-%02d" (nth 5 final) (nth 4 final) (nth 3 final)))))) |
| 16373 | 16379 | ||
| 16374 | (defvar org-def) | ||
| 16375 | (defvar org-defdecode) | ||
| 16376 | (defvar org-with-time) | ||
| 16377 | (defun org-read-date-display () | 16380 | (defun org-read-date-display () |
| 16378 | "Display the current date prompt interpretation in the minibuffer." | 16381 | "Display the current date prompt interpretation in the minibuffer." |
| 16379 | (when org-read-date-display-live | 16382 | (when org-read-date-display-live |
diff --git a/lisp/org/ox-odt.el b/lisp/org/ox-odt.el index 07f6889ae95..eb7856b296a 100644 --- a/lisp/org/ox-odt.el +++ b/lisp/org/ox-odt.el | |||
| @@ -3113,12 +3113,11 @@ and prefix with \"OrgSrc\". For example, | |||
| 3113 | `font-lock-function-name-face' is associated with | 3113 | `font-lock-function-name-face' is associated with |
| 3114 | \"OrgSrcFontLockFunctionNameFace\"." | 3114 | \"OrgSrcFontLockFunctionNameFace\"." |
| 3115 | (let* ((css-list (hfy-face-to-style fn)) | 3115 | (let* ((css-list (hfy-face-to-style fn)) |
| 3116 | (style-name ((lambda (fn) | 3116 | (style-name (concat "OrgSrc" |
| 3117 | (concat "OrgSrc" | 3117 | (mapconcat |
| 3118 | (mapconcat | 3118 | 'capitalize (split-string |
| 3119 | 'capitalize (split-string | 3119 | (hfy-face-or-def-to-name fn) "-") |
| 3120 | (hfy-face-or-def-to-name fn) "-") | 3120 | ""))) |
| 3121 | ""))) fn)) | ||
| 3122 | (color-val (cdr (assoc "color" css-list))) | 3121 | (color-val (cdr (assoc "color" css-list))) |
| 3123 | (background-color-val (cdr (assoc "background" css-list))) | 3122 | (background-color-val (cdr (assoc "background" css-list))) |
| 3124 | (style (and org-odt-create-custom-styles-for-srcblocks | 3123 | (style (and org-odt-create-custom-styles-for-srcblocks |