mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-11-25 07:27:57 +00:00
Merge branch 'maint'
Conflicts: lisp/ob-C.el lisp/ob-clojure.el lisp/ob-core.el lisp/ob-lisp.el lisp/org-clock.el
This commit is contained in:
commit
71884cc039
18
lisp/ob-C.el
18
lisp/ob-C.el
@ -103,6 +103,7 @@ or `org-babel-execute:C++'."
|
||||
(mapconcat 'identity
|
||||
(if (listp flags) flags (list flags)) " ")
|
||||
(org-babel-process-file-name tmp-src-file)) ""))))
|
||||
<<<<<<< HEAD
|
||||
((lambda (results)
|
||||
(org-babel-reassemble-table
|
||||
(org-babel-result-cond (cdr (assoc :result-params params))
|
||||
@ -117,6 +118,23 @@ or `org-babel-execute:C++'."
|
||||
(org-babel-trim
|
||||
(org-babel-eval
|
||||
(concat tmp-bin-file (if cmdline (concat " " cmdline) "")) "")))))
|
||||
=======
|
||||
(let ((results
|
||||
(org-babel-trim
|
||||
(org-babel-eval
|
||||
(concat tmp-bin-file (if cmdline (concat " " cmdline) "")) ""))))
|
||||
(org-babel-reassemble-table
|
||||
(org-babel-result-cond (cdr (assoc :result-params params))
|
||||
(org-babel-read results)
|
||||
(let ((tmp-file (org-babel-temp-file "c-")))
|
||||
(with-temp-file tmp-file (insert results))
|
||||
(org-babel-import-elisp-from-file tmp-file)))
|
||||
(org-babel-pick-name
|
||||
(cdr (assoc :colname-names params)) (cdr (assoc :colnames params)))
|
||||
(org-babel-pick-name
|
||||
(cdr (assoc :rowname-names params)) (cdr (assoc :rownames params)))))
|
||||
))
|
||||
>>>>>>> maint
|
||||
|
||||
(defun org-babel-C-expand (body params)
|
||||
"Expand a block of C or C++ code with org-babel according to
|
||||
|
33
lisp/ob-R.el
33
lisp/ob-R.el
@ -98,21 +98,22 @@ this variable.")
|
||||
(or graphics-file (org-babel-R-graphical-output-file params))))
|
||||
(mapconcat
|
||||
#'identity
|
||||
((lambda (inside)
|
||||
(if graphics-file
|
||||
(append
|
||||
(list (org-babel-R-construct-graphics-device-call
|
||||
graphics-file params))
|
||||
inside
|
||||
(list "dev.off()"))
|
||||
inside))
|
||||
(append
|
||||
(when (cdr (assoc :prologue params))
|
||||
(list (cdr (assoc :prologue params))))
|
||||
(org-babel-variable-assignments:R params)
|
||||
(list body)
|
||||
(when (cdr (assoc :epilogue params))
|
||||
(list (cdr (assoc :epilogue params)))))) "\n")))
|
||||
(let ((inside
|
||||
(append
|
||||
(when (cdr (assoc :prologue params))
|
||||
(list (cdr (assoc :prologue params))))
|
||||
(org-babel-variable-assignments:R params)
|
||||
(list body)
|
||||
(when (cdr (assoc :epilogue params))
|
||||
(list (cdr (assoc :epilogue params)))))))
|
||||
(if graphics-file
|
||||
(append
|
||||
(list (org-babel-R-construct-graphics-device-call
|
||||
graphics-file params))
|
||||
inside
|
||||
(list "dev.off()"))
|
||||
inside))
|
||||
"\n")))
|
||||
|
||||
(defun org-babel-execute:R (body params)
|
||||
"Execute a block of R code.
|
||||
@ -337,6 +338,8 @@ last statement in BODY, as elisp."
|
||||
column-names-p)))
|
||||
(output (org-babel-eval org-babel-R-command body))))
|
||||
|
||||
(defvar ess-eval-visibly-p)
|
||||
|
||||
(defun org-babel-R-evaluate-session
|
||||
(session body result-type result-params column-names-p row-names-p)
|
||||
"Evaluate BODY in SESSION.
|
||||
|
@ -59,34 +59,33 @@ called by `org-babel-execute-src-block'"
|
||||
(cmd-line (cdr (assoc :cmd-line params)))
|
||||
(in-file (cdr (assoc :in-file params)))
|
||||
(full-body (org-babel-expand-body:awk body params))
|
||||
(code-file ((lambda (file) (with-temp-file file (insert full-body)) file)
|
||||
(org-babel-temp-file "awk-")))
|
||||
(stdin ((lambda (stdin)
|
||||
(code-file (let ((file (org-babel-temp-file "awk-")))
|
||||
(with-temp-file file (insert full-body)) file))
|
||||
(stdin (let ((stdin (cdr (assoc :stdin params))))
|
||||
(when stdin
|
||||
(let ((tmp (org-babel-temp-file "awk-stdin-"))
|
||||
(res (org-babel-ref-resolve stdin)))
|
||||
(with-temp-file tmp
|
||||
(insert (org-babel-awk-var-to-awk res)))
|
||||
tmp)))
|
||||
(cdr (assoc :stdin params))))
|
||||
tmp))))
|
||||
(cmd (mapconcat #'identity (remove nil (list org-babel-awk-command
|
||||
"-f" code-file
|
||||
cmd-line
|
||||
in-file))
|
||||
" ")))
|
||||
(org-babel-reassemble-table
|
||||
((lambda (results)
|
||||
(when results
|
||||
(org-babel-result-cond result-params
|
||||
results
|
||||
(let ((tmp (org-babel-temp-file "awk-results-")))
|
||||
(with-temp-file tmp (insert results))
|
||||
(org-babel-import-elisp-from-file tmp)))))
|
||||
(cond
|
||||
(stdin (with-temp-buffer
|
||||
(call-process-shell-command cmd stdin (current-buffer))
|
||||
(buffer-string)))
|
||||
(t (org-babel-eval cmd ""))))
|
||||
(let ((results
|
||||
(cond
|
||||
(stdin (with-temp-buffer
|
||||
(call-process-shell-command cmd stdin (current-buffer))
|
||||
(buffer-string)))
|
||||
(t (org-babel-eval cmd "")))))
|
||||
(when results
|
||||
(org-babel-result-cond result-params
|
||||
results
|
||||
(let ((tmp (org-babel-temp-file "awk-results-")))
|
||||
(with-temp-file tmp (insert results))
|
||||
(org-babel-import-elisp-from-file tmp)))))
|
||||
(org-babel-pick-name
|
||||
(cdr (assoc :colname-names params)) (cdr (assoc :colnames params)))
|
||||
(org-babel-pick-name
|
||||
|
@ -42,13 +42,15 @@
|
||||
(defun org-babel-expand-body:calc (body params)
|
||||
"Expand BODY according to PARAMS, return the expanded body." body)
|
||||
|
||||
(defvar org--var-syms) ; Dynamically scoped from org-babel-execute:calc
|
||||
|
||||
(defun org-babel-execute:calc (body params)
|
||||
"Execute a block of calc code with Babel."
|
||||
(unless (get-buffer "*Calculator*")
|
||||
(save-window-excursion (calc) (calc-quit)))
|
||||
(let* ((vars (mapcar #'cdr (org-babel-get-header params :var)))
|
||||
(var-syms (mapcar #'car vars))
|
||||
(var-names (mapcar #'symbol-name var-syms)))
|
||||
(org--var-syms (mapcar #'car vars))
|
||||
(var-names (mapcar #'symbol-name org--var-syms)))
|
||||
(mapc
|
||||
(lambda (pair)
|
||||
(calc-push-list (list (cdr pair)))
|
||||
@ -66,33 +68,32 @@
|
||||
;; complex expression
|
||||
(t
|
||||
(calc-push-list
|
||||
(list ((lambda (res)
|
||||
(cond
|
||||
((numberp res) res)
|
||||
((math-read-number res) (math-read-number res))
|
||||
((listp res) (error "Calc error \"%s\" on input \"%s\""
|
||||
(cadr res) line))
|
||||
(t (replace-regexp-in-string
|
||||
"'" ""
|
||||
(calc-eval
|
||||
(math-evaluate-expr
|
||||
;; resolve user variables, calc built in
|
||||
;; variables are handled automatically
|
||||
;; upstream by calc
|
||||
(mapcar #'org-babel-calc-maybe-resolve-var
|
||||
;; parse line into calc objects
|
||||
(car (math-read-exprs line)))))))))
|
||||
(calc-eval line))))))))
|
||||
(list (let ((res (calc-eval line)))
|
||||
(cond
|
||||
((numberp res) res)
|
||||
((math-read-number res) (math-read-number res))
|
||||
((listp res) (error "Calc error \"%s\" on input \"%s\""
|
||||
(cadr res) line))
|
||||
(t (replace-regexp-in-string
|
||||
"'" ""
|
||||
(calc-eval
|
||||
(math-evaluate-expr
|
||||
;; resolve user variables, calc built in
|
||||
;; variables are handled automatically
|
||||
;; upstream by calc
|
||||
(mapcar #'org-babel-calc-maybe-resolve-var
|
||||
;; parse line into calc objects
|
||||
(car (math-read-exprs line)))))))))
|
||||
))))))
|
||||
(mapcar #'org-babel-trim
|
||||
(split-string (org-babel-expand-body:calc body params) "[\n\r]"))))
|
||||
(save-excursion
|
||||
(with-current-buffer (get-buffer "*Calculator*")
|
||||
(calc-eval (calc-top 1)))))
|
||||
|
||||
(defvar var-syms) ; Dynamically scoped from org-babel-execute:calc
|
||||
(defun org-babel-calc-maybe-resolve-var (el)
|
||||
(if (consp el)
|
||||
(if (and (equal 'var (car el)) (member (cadr el) var-syms))
|
||||
(if (and (equal 'var (car el)) (member (cadr el) org--var-syms))
|
||||
(progn
|
||||
(calc-recall (cadr el))
|
||||
(prog1 (calc-top 1)
|
||||
|
@ -24,13 +24,18 @@
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
<<<<<<< HEAD
|
||||
;; Support for evaluating clojure code, relies either on Slime or
|
||||
;; on Nrepl.el for all eval.
|
||||
=======
|
||||
;; Support for evaluating clojure code, relies on slime for all eval.
|
||||
>>>>>>> maint
|
||||
|
||||
;; Requirements:
|
||||
|
||||
;; - clojure (at least 1.2.0)
|
||||
;; - clojure-mode
|
||||
<<<<<<< HEAD
|
||||
;; - either cider or nrepl.el or SLIME
|
||||
|
||||
;; For cider, see https://github.com/clojure-emacs/cider
|
||||
@ -42,6 +47,13 @@
|
||||
;; For nREPL:
|
||||
;; get clojure with https://github.com/technomancy/leiningen
|
||||
;; get nrepl from MELPA (clojure-mode is a dependency).
|
||||
=======
|
||||
;; - slime
|
||||
|
||||
;; By far, the best way to install these components is by following
|
||||
;; the directions as set out by Phil Hagelberg (Technomancy) on the
|
||||
;; web page: http://technomancy.us/126
|
||||
>>>>>>> maint
|
||||
|
||||
;;; Code:
|
||||
(require 'ob)
|
||||
@ -96,6 +108,7 @@
|
||||
|
||||
(defun org-babel-execute:clojure (body params)
|
||||
"Execute a block of Clojure code with Babel."
|
||||
<<<<<<< HEAD
|
||||
(let ((expanded (org-babel-expand-body:clojure body params)))
|
||||
(case org-babel-clojure-backend
|
||||
(cider
|
||||
@ -127,6 +140,21 @@
|
||||
`(swank:eval-and-grab-output
|
||||
,(buffer-substring-no-properties (point-min) (point-max)))
|
||||
(cdr (assoc :package params)))))))))
|
||||
=======
|
||||
(require 'slime)
|
||||
(with-temp-buffer
|
||||
(insert (org-babel-expand-body:clojure body params))
|
||||
(let ((result
|
||||
(slime-eval
|
||||
`(swank:eval-and-grab-output
|
||||
,(buffer-substring-no-properties (point-min) (point-max)))
|
||||
(cdr (assoc :package params)))))
|
||||
(let ((result-params (cdr (assoc :result-params params))))
|
||||
(org-babel-result-cond result-params
|
||||
result
|
||||
(condition-case nil (org-babel-script-escape result)
|
||||
(error result)))))))
|
||||
>>>>>>> maint
|
||||
|
||||
(provide 'ob-clojure)
|
||||
|
||||
|
301
lisp/ob-core.el
301
lisp/ob-core.el
@ -681,15 +681,14 @@ block."
|
||||
(message "result silenced")
|
||||
(setq result nil))
|
||||
(setq result
|
||||
((lambda (result)
|
||||
(if (and (eq (cdr (assoc :result-type params))
|
||||
'value)
|
||||
(or (member "vector" result-params)
|
||||
(member "table" result-params))
|
||||
(not (listp result)))
|
||||
(list (list result)) result))
|
||||
(funcall cmd body params)))
|
||||
;; if non-empty result and :file then write to :file
|
||||
(let ((result (funcall cmd body params)))
|
||||
(if (and (eq (cdr (assoc :result-type params))
|
||||
'value)
|
||||
(or (member "vector" result-params)
|
||||
(member "table" result-params))
|
||||
(not (listp result)))
|
||||
(list (list result)) result)))
|
||||
;; If non-empty result and :file then write to :file.
|
||||
(when (cdr (assoc :file params))
|
||||
(when result
|
||||
(with-temp-file (cdr (assoc :file params))
|
||||
@ -697,7 +696,7 @@ block."
|
||||
(org-babel-format-result
|
||||
result (cdr (assoc :sep (nth 2 info)))))))
|
||||
(setq result (cdr (assoc :file params))))
|
||||
;; possibly perform post process provided its appropriate
|
||||
;; Possibly perform post process provided its appropriate.
|
||||
(when (cdr (assoc :post params))
|
||||
(let ((*this* (if (cdr (assoc :file params))
|
||||
(org-babel-result-to-file
|
||||
@ -948,6 +947,8 @@ with a prefix argument then this is passed on to
|
||||
|
||||
(defalias 'org-babel-pop-to-session 'org-babel-switch-to-session)
|
||||
|
||||
(defvar org-src-window-setup)
|
||||
|
||||
;;;###autoload
|
||||
(defun org-babel-switch-to-session-with-code (&optional arg info)
|
||||
"Switch to code buffer and display session."
|
||||
@ -1212,18 +1213,18 @@ the current subtree."
|
||||
(mapconcat #'identity (sort (funcall rm (split-string v))
|
||||
#'string<) " "))
|
||||
(t v)))))))
|
||||
((lambda (hash)
|
||||
(when (org-called-interactively-p 'interactive) (message hash)) hash)
|
||||
(let ((it (format "%s-%s"
|
||||
(mapconcat
|
||||
#'identity
|
||||
(delq nil (mapcar (lambda (arg)
|
||||
(let ((normalized (funcall norm arg)))
|
||||
(when normalized
|
||||
(format "%S" normalized))))
|
||||
(nth 2 info))) ":")
|
||||
(nth 1 info))))
|
||||
(sha1 it))))))
|
||||
(let* ((it (format "%s-%s"
|
||||
(mapconcat
|
||||
#'identity
|
||||
(delq nil (mapcar (lambda (arg)
|
||||
(let ((normalized (funcall norm arg)))
|
||||
(when normalized
|
||||
(format "%S" normalized))))
|
||||
(nth 2 info))) ":")
|
||||
(nth 1 info)))
|
||||
(hash (sha1 it)))
|
||||
(when (org-called-interactively-p 'interactive) (message hash))
|
||||
hash))))
|
||||
|
||||
(defun org-babel-current-result-hash ()
|
||||
"Return the current in-buffer hash."
|
||||
@ -1508,9 +1509,8 @@ instances of \"[ \t]:\" set ALTS to '((32 9) . 58)."
|
||||
(cons (intern (match-string 1 arg))
|
||||
(org-babel-read (org-babel-chomp (match-string 2 arg))))
|
||||
(cons (intern (org-babel-chomp arg)) nil)))
|
||||
((lambda (raw)
|
||||
(cons (car raw) (mapcar (lambda (r) (concat ":" r)) (cdr raw))))
|
||||
(org-babel-balanced-split arg-string '((32 9) . 58))))))))
|
||||
(let ((raw (org-babel-balanced-split arg-string '((32 9) . 58))))
|
||||
(cons (car raw) (mapcar (lambda (r) (concat ":" r)) (cdr raw)))))))))
|
||||
|
||||
(defun org-babel-parse-multiple-vars (header-arguments)
|
||||
"Expand multiple variable assignments behind a single :var keyword.
|
||||
@ -1653,12 +1653,11 @@ of the vars, cnames and rnames."
|
||||
Given a TABLE and set of COLNAMES and ROWNAMES add the names
|
||||
to the table for reinsertion to org-mode."
|
||||
(if (listp table)
|
||||
((lambda (table)
|
||||
(if (and colnames (listp (car table)) (= (length (car table))
|
||||
(length colnames)))
|
||||
(org-babel-put-colnames table colnames) table))
|
||||
(if (and rownames (= (length table) (length rownames)))
|
||||
(org-babel-put-rownames table rownames) table))
|
||||
(let ((table (if (and rownames (= (length table) (length rownames)))
|
||||
(org-babel-put-rownames table rownames) table)))
|
||||
(if (and colnames (listp (car table)) (= (length (car table))
|
||||
(length colnames)))
|
||||
(org-babel-put-colnames table colnames) table))
|
||||
table))
|
||||
|
||||
(defun org-babel-where-is-src-block-head ()
|
||||
@ -1695,9 +1694,8 @@ If the point is not on a source block then return nil."
|
||||
(defun org-babel-goto-src-block-head ()
|
||||
"Go to the beginning of the current code block."
|
||||
(interactive)
|
||||
((lambda (head)
|
||||
(if head (goto-char head) (error "Not currently in a code block")))
|
||||
(org-babel-where-is-src-block-head)))
|
||||
(let ((head (org-babel-where-is-src-block-head)))
|
||||
(if head (goto-char head) (error "Not currently in a code block"))))
|
||||
|
||||
;;;###autoload
|
||||
(defun org-babel-goto-named-src-block (name)
|
||||
@ -1818,14 +1816,13 @@ With optional prefix argument ARG, jump backward ARG many source blocks."
|
||||
(defun org-babel-mark-block ()
|
||||
"Mark current src block."
|
||||
(interactive)
|
||||
((lambda (head)
|
||||
(when head
|
||||
(save-excursion
|
||||
(goto-char head)
|
||||
(looking-at org-babel-src-block-regexp))
|
||||
(push-mark (match-end 5) nil t)
|
||||
(goto-char (match-beginning 5))))
|
||||
(org-babel-where-is-src-block-head)))
|
||||
(let ((head (org-babel-where-is-src-block-head)))
|
||||
(when head
|
||||
(save-excursion
|
||||
(goto-char head)
|
||||
(looking-at org-babel-src-block-regexp))
|
||||
(push-mark (match-end 5) nil t)
|
||||
(goto-char (match-beginning 5)))))
|
||||
|
||||
(defun org-babel-demarcate-block (&optional arg)
|
||||
"Wrap or split the code in the region or on the point.
|
||||
@ -2507,7 +2504,7 @@ block but are passed literally to the \"example-block\"."
|
||||
(funcall (intern (concat lang "-mode")))
|
||||
(comment-region (point) (progn (insert text) (point)))
|
||||
(org-babel-trim (buffer-string)))))
|
||||
index source-name evaluate prefix blocks-in-buffer)
|
||||
index source-name evaluate prefix)
|
||||
(with-temp-buffer
|
||||
(org-set-local 'org-babel-noweb-wrap-start ob-nww-start)
|
||||
(org-set-local 'org-babel-noweb-wrap-end ob-nww-end)
|
||||
@ -2526,119 +2523,118 @@ block but are passed literally to the \"example-block\"."
|
||||
(funcall nb-add (buffer-substring index (point)))
|
||||
(goto-char (match-end 0))
|
||||
(setq index (point))
|
||||
(funcall nb-add
|
||||
(with-current-buffer parent-buffer
|
||||
(save-restriction
|
||||
(widen)
|
||||
(mapconcat ;; interpose PREFIX between every line
|
||||
#'identity
|
||||
(split-string
|
||||
(if evaluate
|
||||
(let ((raw (org-babel-ref-resolve source-name)))
|
||||
(if (stringp raw) raw (format "%S" raw)))
|
||||
(or
|
||||
;; retrieve from the library of babel
|
||||
(nth 2 (assoc (intern source-name)
|
||||
org-babel-library-of-babel))
|
||||
;; return the contents of headlines literally
|
||||
(save-excursion
|
||||
(when (org-babel-ref-goto-headline-id source-name)
|
||||
(funcall
|
||||
nb-add
|
||||
(with-current-buffer parent-buffer
|
||||
(save-restriction
|
||||
(widen)
|
||||
(mapconcat ;; Interpose PREFIX between every line.
|
||||
#'identity
|
||||
(split-string
|
||||
(if evaluate
|
||||
(let ((raw (org-babel-ref-resolve source-name)))
|
||||
(if (stringp raw) raw (format "%S" raw)))
|
||||
(or
|
||||
;; Retrieve from the library of babel.
|
||||
(nth 2 (assoc (intern source-name)
|
||||
org-babel-library-of-babel))
|
||||
;; Return the contents of headlines literally.
|
||||
(save-excursion
|
||||
(when (org-babel-ref-goto-headline-id source-name)
|
||||
(org-babel-ref-headline-body)))
|
||||
;; find the expansion of reference in this buffer
|
||||
(let ((rx (concat rx-prefix source-name "[ \t\n]"))
|
||||
expansion)
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(if org-babel-use-quick-and-dirty-noweb-expansion
|
||||
(while (re-search-forward rx nil t)
|
||||
(let* ((i (org-babel-get-src-block-info 'light))
|
||||
(body (org-babel-expand-noweb-references i))
|
||||
(sep (or (cdr (assoc :noweb-sep (nth 2 i)))
|
||||
"\n"))
|
||||
(full (if comment
|
||||
((lambda (cs)
|
||||
(concat (funcall c-wrap (car cs)) "\n"
|
||||
body "\n"
|
||||
(funcall c-wrap (cadr cs))))
|
||||
(org-babel-tangle-comment-links i))
|
||||
body)))
|
||||
(setq expansion (cons sep (cons full expansion)))))
|
||||
(org-babel-map-src-blocks nil
|
||||
(let ((i (org-babel-get-src-block-info 'light)))
|
||||
(when (equal (or (cdr (assoc :noweb-ref (nth 2 i)))
|
||||
(nth 4 i))
|
||||
source-name)
|
||||
(let* ((body (org-babel-expand-noweb-references i))
|
||||
(sep (or (cdr (assoc :noweb-sep (nth 2 i)))
|
||||
"\n"))
|
||||
(full (if comment
|
||||
((lambda (cs)
|
||||
(concat (funcall c-wrap (car cs)) "\n"
|
||||
body "\n"
|
||||
(funcall c-wrap (cadr cs))))
|
||||
(org-babel-tangle-comment-links i))
|
||||
body)))
|
||||
(setq expansion
|
||||
(cons sep (cons full expansion)))))))))
|
||||
(and expansion
|
||||
(mapconcat #'identity (nreverse (cdr expansion)) "")))
|
||||
;; possibly raise an error if named block doesn't exist
|
||||
(if (member lang org-babel-noweb-error-langs)
|
||||
(error "%s" (concat
|
||||
(org-babel-noweb-wrap source-name)
|
||||
"could not be resolved (see "
|
||||
"`org-babel-noweb-error-langs')"))
|
||||
"")))
|
||||
"[\n\r]") (concat "\n" prefix))))))
|
||||
;; Find the expansion of reference in this buffer.
|
||||
(let ((rx (concat rx-prefix source-name "[ \t\n]"))
|
||||
expansion)
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(if org-babel-use-quick-and-dirty-noweb-expansion
|
||||
(while (re-search-forward rx nil t)
|
||||
(let* ((i (org-babel-get-src-block-info 'light))
|
||||
(body (org-babel-expand-noweb-references i))
|
||||
(sep (or (cdr (assoc :noweb-sep (nth 2 i)))
|
||||
"\n"))
|
||||
(full (if comment
|
||||
(let ((cs (org-babel-tangle-comment-links i)))
|
||||
(concat (funcall c-wrap (car cs)) "\n"
|
||||
body "\n"
|
||||
(funcall c-wrap (cadr cs))))
|
||||
body)))
|
||||
(setq expansion (cons sep (cons full expansion)))))
|
||||
(org-babel-map-src-blocks nil
|
||||
(let ((i (org-babel-get-src-block-info 'light)))
|
||||
(when (equal (or (cdr (assoc :noweb-ref (nth 2 i)))
|
||||
(nth 4 i))
|
||||
source-name)
|
||||
(let* ((body (org-babel-expand-noweb-references i))
|
||||
(sep (or (cdr (assoc :noweb-sep (nth 2 i)))
|
||||
"\n"))
|
||||
(full (if comment
|
||||
(let ((cs (org-babel-tangle-comment-links i)))
|
||||
(concat (funcall c-wrap (car cs)) "\n"
|
||||
body "\n"
|
||||
(funcall c-wrap (cadr cs))))
|
||||
body)))
|
||||
(setq expansion
|
||||
(cons sep (cons full expansion)))))))))
|
||||
(and expansion
|
||||
(mapconcat #'identity (nreverse (cdr expansion)) "")))
|
||||
;; Possibly raise an error if named block doesn't exist.
|
||||
(if (member lang org-babel-noweb-error-langs)
|
||||
(error "%s" (concat
|
||||
(org-babel-noweb-wrap source-name)
|
||||
"could not be resolved (see "
|
||||
"`org-babel-noweb-error-langs')"))
|
||||
"")))
|
||||
"[\n\r]") (concat "\n" prefix))))))
|
||||
(funcall nb-add (buffer-substring index (point-max))))
|
||||
new-body))
|
||||
|
||||
(defun org-babel-script-escape (str &optional force)
|
||||
"Safely convert tables into elisp lists."
|
||||
(let (in-single in-double out)
|
||||
((lambda (escaped) (condition-case nil (org-babel-read escaped) (error escaped)))
|
||||
(if (or force
|
||||
(and (stringp str)
|
||||
(> (length str) 2)
|
||||
(or (and (string-equal "[" (substring str 0 1))
|
||||
(string-equal "]" (substring str -1)))
|
||||
(and (string-equal "{" (substring str 0 1))
|
||||
(string-equal "}" (substring str -1)))
|
||||
(and (string-equal "(" (substring str 0 1))
|
||||
(string-equal ")" (substring str -1))))))
|
||||
(org-babel-read
|
||||
(concat
|
||||
"'"
|
||||
(progn
|
||||
(mapc
|
||||
(lambda (ch)
|
||||
(setq
|
||||
out
|
||||
(case ch
|
||||
(91 (if (or in-double in-single) ; [
|
||||
(cons 91 out)
|
||||
(cons 40 out)))
|
||||
(93 (if (or in-double in-single) ; ]
|
||||
(cons 93 out)
|
||||
(cons 41 out)))
|
||||
(123 (if (or in-double in-single) ; {
|
||||
(cons 123 out)
|
||||
(cons 40 out)))
|
||||
(125 (if (or in-double in-single) ; }
|
||||
(cons 125 out)
|
||||
(cons 41 out)))
|
||||
(44 (if (or in-double in-single) ; ,
|
||||
(cons 44 out) (cons 32 out)))
|
||||
(39 (if in-double ; '
|
||||
(cons 39 out)
|
||||
(setq in-single (not in-single)) (cons 34 out)))
|
||||
(34 (if in-single ; "
|
||||
(append (list 34 32) out)
|
||||
(setq in-double (not in-double)) (cons 34 out)))
|
||||
(t (cons ch out)))))
|
||||
(string-to-list str))
|
||||
(apply #'string (reverse out)))))
|
||||
str))))
|
||||
(let ((escaped
|
||||
(if (or force
|
||||
(and (stringp str)
|
||||
(> (length str) 2)
|
||||
(or (and (string-equal "[" (substring str 0 1))
|
||||
(string-equal "]" (substring str -1)))
|
||||
(and (string-equal "{" (substring str 0 1))
|
||||
(string-equal "}" (substring str -1)))
|
||||
(and (string-equal "(" (substring str 0 1))
|
||||
(string-equal ")" (substring str -1))))))
|
||||
(org-babel-read
|
||||
(concat
|
||||
"'"
|
||||
(let (in-single in-double out)
|
||||
(mapc
|
||||
(lambda (ch)
|
||||
(setq
|
||||
out
|
||||
(case ch
|
||||
(91 (if (or in-double in-single) ; [
|
||||
(cons 91 out)
|
||||
(cons 40 out)))
|
||||
(93 (if (or in-double in-single) ; ]
|
||||
(cons 93 out)
|
||||
(cons 41 out)))
|
||||
(123 (if (or in-double in-single) ; {
|
||||
(cons 123 out)
|
||||
(cons 40 out)))
|
||||
(125 (if (or in-double in-single) ; }
|
||||
(cons 125 out)
|
||||
(cons 41 out)))
|
||||
(44 (if (or in-double in-single) ; ,
|
||||
(cons 44 out) (cons 32 out)))
|
||||
(39 (if in-double ; '
|
||||
(cons 39 out)
|
||||
(setq in-single (not in-single)) (cons 34 out)))
|
||||
(34 (if in-single ; "
|
||||
(append (list 34 32) out)
|
||||
(setq in-double (not in-double)) (cons 34 out)))
|
||||
(t (cons ch out)))))
|
||||
(string-to-list str))
|
||||
(apply #'string (reverse out)))))
|
||||
str)))
|
||||
(condition-case nil (org-babel-read escaped) (error escaped))))
|
||||
|
||||
(defun org-babel-read (cell &optional inhibit-lisp-eval)
|
||||
"Convert the string value of CELL to a number if appropriate.
|
||||
@ -2744,11 +2740,16 @@ name is removed, since in that case the process will be executing
|
||||
remotely. The file name is then processed by `expand-file-name'.
|
||||
Unless second argument NO-QUOTE-P is non-nil, the file name is
|
||||
additionally processed by `shell-quote-argument'"
|
||||
<<<<<<< HEAD
|
||||
((lambda (f) (if no-quote-p f (shell-quote-argument f)))
|
||||
;; We must apply `expand-file-name' on the whole filename. If we
|
||||
;; would apply it on the local filename only, undesired effects
|
||||
;; like prepending a drive letter on MS Windows could happen.
|
||||
(org-babel-local-file-name (expand-file-name name))))
|
||||
=======
|
||||
(let ((f (expand-file-name (org-babel-local-file-name name))))
|
||||
(if no-quote-p f (shell-quote-argument f))))
|
||||
>>>>>>> maint
|
||||
|
||||
(defvar org-babel-temporary-directory)
|
||||
(unless (or noninteractive (boundp 'org-babel-temporary-directory))
|
||||
|
@ -82,11 +82,10 @@ Do not leave leading or trailing spaces in this string."
|
||||
"Execute a block of Ditaa code with org-babel.
|
||||
This function is called by `org-babel-execute-src-block'."
|
||||
(let* ((result-params (split-string (or (cdr (assoc :results params)) "")))
|
||||
(out-file ((lambda (el)
|
||||
(or el
|
||||
(error
|
||||
"ditaa code block requires :file header argument")))
|
||||
(cdr (assoc :file params))))
|
||||
(out-file (let ((el (cdr (assoc :file params))))
|
||||
(or el
|
||||
(error
|
||||
"ditaa code block requires :file header argument"))))
|
||||
(cmdline (cdr (assoc :cmdline params)))
|
||||
(java (cdr (assoc :java params)))
|
||||
(in-file (org-babel-temp-file "ditaa-"))
|
||||
|
@ -53,25 +53,26 @@
|
||||
(defun org-babel-execute:emacs-lisp (body params)
|
||||
"Execute a block of emacs-lisp code with Babel."
|
||||
(save-window-excursion
|
||||
((lambda (result)
|
||||
(org-babel-result-cond (cdr (assoc :result-params params))
|
||||
(let ((print-level nil)
|
||||
(print-length nil))
|
||||
(if (or (member "scalar" (cdr (assoc :result-params params)))
|
||||
(member "verbatim" (cdr (assoc :result-params params))))
|
||||
(format "%S" result)
|
||||
(format "%s" result)))
|
||||
(org-babel-reassemble-table
|
||||
result
|
||||
(org-babel-pick-name (cdr (assoc :colname-names params))
|
||||
(cdr (assoc :colnames params)))
|
||||
(org-babel-pick-name (cdr (assoc :rowname-names params))
|
||||
(cdr (assoc :rownames params))))))
|
||||
(eval (read (format (if (member "output"
|
||||
(cdr (assoc :result-params params)))
|
||||
"(with-output-to-string %s)"
|
||||
"(progn %s)")
|
||||
(org-babel-expand-body:emacs-lisp body params)))))))
|
||||
(let ((result
|
||||
(eval (read (format (if (member "output"
|
||||
(cdr (assoc :result-params params)))
|
||||
"(with-output-to-string %s)"
|
||||
"(progn %s)")
|
||||
(org-babel-expand-body:emacs-lisp
|
||||
body params))))))
|
||||
(org-babel-result-cond (cdr (assoc :result-params params))
|
||||
(let ((print-level nil)
|
||||
(print-length nil))
|
||||
(if (or (member "scalar" (cdr (assoc :result-params params)))
|
||||
(member "verbatim" (cdr (assoc :result-params params))))
|
||||
(format "%S" result)
|
||||
(format "%s" result)))
|
||||
(org-babel-reassemble-table
|
||||
result
|
||||
(org-babel-pick-name (cdr (assoc :colname-names params))
|
||||
(cdr (assoc :colnames params)))
|
||||
(org-babel-pick-name (cdr (assoc :rowname-names params))
|
||||
(cdr (assoc :rownames params))))))))
|
||||
|
||||
(provide 'ob-emacs-lisp)
|
||||
|
||||
|
@ -69,6 +69,8 @@ be executed."
|
||||
('otherwise
|
||||
(error "Requested export buffer when `org-current-export-file' is nil"))))
|
||||
|
||||
(defvar org-link-search-inhibit-query)
|
||||
|
||||
(defmacro org-babel-exp-in-export-file (lang &rest body)
|
||||
(declare (indent 1))
|
||||
`(let* ((lang-headers (intern (concat "org-babel-default-header-args:" ,lang)))
|
||||
@ -374,7 +376,7 @@ replaced with its value."
|
||||
(cons (substring (symbol-name (car pair)) 1)
|
||||
(format "%S" (cdr pair))))
|
||||
(nth 2 info))
|
||||
("flags" . ,((lambda (f) (when f (concat " " f))) (nth 3 info)))
|
||||
("flags" . ,(let ((f (nth 3 info))) (when f (concat " " f))))
|
||||
("name" . ,(or (nth 4 info) "")))))
|
||||
|
||||
(defun org-babel-exp-results (info type &optional silent hash)
|
||||
|
@ -60,20 +60,20 @@
|
||||
(mapconcat 'identity
|
||||
(if (listp flags) flags (list flags)) " ")
|
||||
(org-babel-process-file-name tmp-src-file)) ""))))
|
||||
((lambda (results)
|
||||
(org-babel-reassemble-table
|
||||
(org-babel-result-cond (cdr (assoc :result-params params))
|
||||
(org-babel-read results)
|
||||
(let ((tmp-file (org-babel-temp-file "f-")))
|
||||
(with-temp-file tmp-file (insert results))
|
||||
(org-babel-import-elisp-from-file tmp-file)))
|
||||
(org-babel-pick-name
|
||||
(cdr (assoc :colname-names params)) (cdr (assoc :colnames params)))
|
||||
(org-babel-pick-name
|
||||
(cdr (assoc :rowname-names params)) (cdr (assoc :rownames params)))))
|
||||
(org-babel-trim
|
||||
(org-babel-eval
|
||||
(concat tmp-bin-file (if cmdline (concat " " cmdline) "")) "")))))
|
||||
(let ((results
|
||||
(org-babel-trim
|
||||
(org-babel-eval
|
||||
(concat tmp-bin-file (if cmdline (concat " " cmdline) "")) ""))))
|
||||
(org-babel-reassemble-table
|
||||
(org-babel-result-cond (cdr (assoc :result-params params))
|
||||
(org-babel-read results)
|
||||
(let ((tmp-file (org-babel-temp-file "f-")))
|
||||
(with-temp-file tmp-file (insert results))
|
||||
(org-babel-import-elisp-from-file tmp-file)))
|
||||
(org-babel-pick-name
|
||||
(cdr (assoc :colname-names params)) (cdr (assoc :colnames params)))
|
||||
(org-babel-pick-name
|
||||
(cdr (assoc :rowname-names params)) (cdr (assoc :rownames params)))))))
|
||||
|
||||
(defun org-babel-expand-body:fortran (body params)
|
||||
"Expand a block of fortran or fortran code with org-babel according to
|
||||
|
@ -79,12 +79,12 @@
|
||||
(cdr (member org-babel-haskell-eoe
|
||||
(reverse (mapcar #'org-babel-trim raw)))))))
|
||||
(org-babel-reassemble-table
|
||||
((lambda (result)
|
||||
(org-babel-result-cond (cdr (assoc :result-params params))
|
||||
result (org-babel-haskell-table-or-string result)))
|
||||
(case result-type
|
||||
('output (mapconcat #'identity (reverse (cdr results)) "\n"))
|
||||
('value (car results))))
|
||||
(let ((result
|
||||
(case result-type
|
||||
(output (mapconcat #'identity (reverse (cdr results)) "\n"))
|
||||
(value (car results)))))
|
||||
(org-babel-result-cond (cdr (assoc :result-params params))
|
||||
result (org-babel-haskell-table-or-string result)))
|
||||
(org-babel-pick-name (cdr (assoc :colname-names params))
|
||||
(cdr (assoc :colname-names params)))
|
||||
(org-babel-pick-name (cdr (assoc :rowname-names params))
|
||||
@ -148,6 +148,7 @@ specifying a variable of the same value."
|
||||
(format "%S" var)))
|
||||
|
||||
(defvar org-src-preserve-indentation)
|
||||
(defvar org-export-copy-to-kill-ring)
|
||||
(declare-function org-export-to-file "ox"
|
||||
(backend file
|
||||
&optional async subtreep visible-only body-only ext-plist))
|
||||
|
@ -94,12 +94,11 @@ in BODY as elisp."
|
||||
(value (let* ((src-file (org-babel-temp-file "io-"))
|
||||
(wrapper (format org-babel-io-wrapper-method body)))
|
||||
(with-temp-file src-file (insert wrapper))
|
||||
((lambda (raw)
|
||||
(org-babel-result-cond result-params
|
||||
raw
|
||||
(org-babel-io-table-or-string raw)))
|
||||
(org-babel-eval
|
||||
(concat org-babel-io-command " " src-file) ""))))))
|
||||
(let ((raw (org-babel-eval
|
||||
(concat org-babel-io-command " " src-file) "")))
|
||||
(org-babel-result-cond result-params
|
||||
raw
|
||||
(org-babel-io-table-or-string raw)))))))
|
||||
|
||||
|
||||
(defun org-babel-prep-session:io (session params)
|
||||
|
@ -55,19 +55,18 @@
|
||||
;; created package-name directories if missing
|
||||
(unless (or (not packagename) (file-exists-p packagename))
|
||||
(make-directory packagename 'parents))
|
||||
((lambda (results)
|
||||
(org-babel-reassemble-table
|
||||
(org-babel-result-cond (cdr (assoc :result-params params))
|
||||
(org-babel-read results)
|
||||
(let ((tmp-file (org-babel-temp-file "c-")))
|
||||
(with-temp-file tmp-file (insert results))
|
||||
(org-babel-import-elisp-from-file tmp-file)))
|
||||
(org-babel-pick-name
|
||||
(cdr (assoc :colname-names params)) (cdr (assoc :colnames params)))
|
||||
(org-babel-pick-name
|
||||
(cdr (assoc :rowname-names params)) (cdr (assoc :rownames params)))))
|
||||
(org-babel-eval (concat org-babel-java-command
|
||||
" " cmdline " " classname) ""))))
|
||||
(let ((results (org-babel-eval (concat org-babel-java-command
|
||||
" " cmdline " " classname) "")))
|
||||
(org-babel-reassemble-table
|
||||
(org-babel-result-cond (cdr (assoc :result-params params))
|
||||
(org-babel-read results)
|
||||
(let ((tmp-file (org-babel-temp-file "c-")))
|
||||
(with-temp-file tmp-file (insert results))
|
||||
(org-babel-import-elisp-from-file tmp-file)))
|
||||
(org-babel-pick-name
|
||||
(cdr (assoc :colname-names params)) (cdr (assoc :colnames params)))
|
||||
(org-babel-pick-name
|
||||
(cdr (assoc :rowname-names params)) (cdr (assoc :rownames params)))))))
|
||||
|
||||
(provide 'ob-java)
|
||||
|
||||
|
@ -200,7 +200,6 @@ FILE-NAME is full path to lilypond (.ly) file"
|
||||
(let ((arg-1 (ly-determine-ly-path)) ;program
|
||||
(arg-2 nil) ;infile
|
||||
(arg-3 "*lilypond*") ;buffer
|
||||
(arg-4 t) ;display
|
||||
(arg-4 t) ;display
|
||||
(arg-5 (if ly-gen-png "--png" "")) ;&rest...
|
||||
(arg-6 (if ly-gen-html "--html" ""))
|
||||
|
@ -75,6 +75,7 @@ current directory string."
|
||||
"Execute a block of Common Lisp code with Babel."
|
||||
(require 'slime)
|
||||
(org-babel-reassemble-table
|
||||
<<<<<<< HEAD
|
||||
((lambda (result)
|
||||
(org-babel-result-cond (cdr (assoc :result-params params))
|
||||
result
|
||||
@ -99,6 +100,26 @@ current directory string."
|
||||
(buffer-substring-no-properties
|
||||
(point-min) (point-max)))))
|
||||
(cdr (assoc :package params))))))
|
||||
=======
|
||||
(let ((result
|
||||
(with-temp-buffer
|
||||
(insert (org-babel-expand-body:lisp body params))
|
||||
(slime-eval `(swank:eval-and-grab-output
|
||||
,(let ((dir (if (assoc :dir params)
|
||||
(cdr (assoc :dir params))
|
||||
default-directory)))
|
||||
(format
|
||||
(if dir (format org-babel-lisp-dir-fmt dir)
|
||||
"(progn %s)")
|
||||
(buffer-substring-no-properties
|
||||
(point-min) (point-max)))))
|
||||
(cdr (assoc :package params))))))
|
||||
(org-babel-result-cond (cdr (assoc :result-params params))
|
||||
(car result)
|
||||
(condition-case nil
|
||||
(read (org-babel-lisp-vector-to-list (cadr result)))
|
||||
(error (cadr result)))))
|
||||
>>>>>>> maint
|
||||
(org-babel-pick-name (cdr (assoc :colname-names params))
|
||||
(cdr (assoc :colnames params)))
|
||||
(org-babel-pick-name (cdr (assoc :rowname-names params))
|
||||
|
@ -1,6 +1,6 @@
|
||||
;;; ob-makefile.el --- org-babel functions for makefile evaluation
|
||||
|
||||
;; Copyright (C) 2009-2012 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2009-2013 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Eric Schulte and Thomas S. Dye
|
||||
;; Keywords: literate programming, reproducible research
|
||||
|
@ -65,8 +65,8 @@
|
||||
"\n")))
|
||||
|
||||
(defun org-babel-execute:maxima (body params)
|
||||
"Execute a block of Maxima entries with org-babel. This function is
|
||||
called by `org-babel-execute-src-block'."
|
||||
"Execute a block of Maxima entries with org-babel.
|
||||
This function is called by `org-babel-execute-src-block'."
|
||||
(message "executing Maxima source code block")
|
||||
(let ((result-params (split-string (or (cdr (assoc :results params)) "")))
|
||||
(result
|
||||
@ -76,18 +76,18 @@ called by `org-babel-execute-src-block'."
|
||||
org-babel-maxima-command in-file cmdline)))
|
||||
(with-temp-file in-file (insert (org-babel-maxima-expand body params)))
|
||||
(message cmd)
|
||||
((lambda (raw) ;; " | grep -v batch | grep -v 'replaced' | sed '/^$/d' "
|
||||
(mapconcat
|
||||
#'identity
|
||||
(delq nil
|
||||
(mapcar (lambda (line)
|
||||
(unless (or (string-match "batch" line)
|
||||
(string-match "^rat: replaced .*$" line)
|
||||
(string-match "^;;; Loading #P" line)
|
||||
(= 0 (length line)))
|
||||
line))
|
||||
(split-string raw "[\r\n]"))) "\n"))
|
||||
(org-babel-eval cmd "")))))
|
||||
;; " | grep -v batch | grep -v 'replaced' | sed '/^$/d' "
|
||||
(let ((raw (org-babel-eval cmd "")))
|
||||
(mapconcat
|
||||
#'identity
|
||||
(delq nil
|
||||
(mapcar (lambda (line)
|
||||
(unless (or (string-match "batch" line)
|
||||
(string-match "^rat: replaced .*$" line)
|
||||
(string-match "^;;; Loading #P" line)
|
||||
(= 0 (length line)))
|
||||
line))
|
||||
(split-string raw "[\r\n]"))) "\n")))))
|
||||
(if (org-babel-maxima-graphical-output-file params)
|
||||
nil
|
||||
(org-babel-result-cond result-params
|
||||
|
@ -135,21 +135,21 @@ return the value of the last statement in BODY, as elisp."
|
||||
(tmp-file (org-babel-temp-file "perl-"))
|
||||
(tmp-babel-file (org-babel-process-file-name
|
||||
tmp-file 'noquote)))
|
||||
((lambda (results)
|
||||
(when results
|
||||
(org-babel-result-cond result-params
|
||||
(org-babel-eval-read-file tmp-file)
|
||||
(org-babel-import-elisp-from-file tmp-file '(16)))))
|
||||
(case result-type
|
||||
(output
|
||||
(with-temp-file tmp-file
|
||||
(insert
|
||||
(org-babel-eval org-babel-perl-command body))
|
||||
(buffer-string)))
|
||||
(value
|
||||
(org-babel-eval org-babel-perl-command
|
||||
(format org-babel-perl-wrapper-method
|
||||
body tmp-babel-file)))))))
|
||||
(let ((results
|
||||
(case result-type
|
||||
(output
|
||||
(with-temp-file tmp-file
|
||||
(insert
|
||||
(org-babel-eval org-babel-perl-command body))
|
||||
(buffer-string)))
|
||||
(value
|
||||
(org-babel-eval org-babel-perl-command
|
||||
(format org-babel-perl-wrapper-method
|
||||
body tmp-babel-file))))))
|
||||
(when results
|
||||
(org-babel-result-cond result-params
|
||||
(org-babel-eval-read-file tmp-file)
|
||||
(org-babel-import-elisp-from-file tmp-file '(16)))))))
|
||||
|
||||
(provide 'ob-perl)
|
||||
|
||||
|
@ -99,16 +99,16 @@
|
||||
called by `org-babel-execute-src-block'"
|
||||
(message "executing Picolisp source code block")
|
||||
(let* (
|
||||
;; name of the session or "none"
|
||||
;; Name of the session or "none".
|
||||
(session-name (cdr (assoc :session params)))
|
||||
;; set the session if the session variable is non-nil
|
||||
;; Set the session if the session variable is non-nil.
|
||||
(session (org-babel-picolisp-initiate-session session-name))
|
||||
;; either OUTPUT or VALUE which should behave as described above
|
||||
;; Either OUTPUT or VALUE which should behave as described above.
|
||||
(result-type (cdr (assoc :result-type params)))
|
||||
(result-params (cdr (assoc :result-params params)))
|
||||
;; expand the body with `org-babel-expand-body:picolisp'
|
||||
;; Expand the body with `org-babel-expand-body:picolisp'.
|
||||
(full-body (org-babel-expand-body:picolisp body params))
|
||||
;; wrap body appropriately for the type of evaluation and results
|
||||
;; Wrap body appropriately for the type of evaluation and results.
|
||||
(wrapped-body
|
||||
(cond
|
||||
((or (member "code" result-params)
|
||||
@ -118,53 +118,54 @@
|
||||
(format "(print (out \"/dev/null\" %s))" full-body))
|
||||
((member "value" result-params)
|
||||
(format "(out \"/dev/null\" %s)" full-body))
|
||||
(t full-body))))
|
||||
|
||||
((lambda (result)
|
||||
(org-babel-result-cond result-params
|
||||
result
|
||||
(read result)))
|
||||
(if (not (string= session-name "none"))
|
||||
;; session based evaluation
|
||||
(mapconcat ;; <- joins the list back together into a single string
|
||||
#'identity
|
||||
(butlast ;; <- remove the org-babel-picolisp-eoe line
|
||||
(delq nil
|
||||
(mapcar
|
||||
(lambda (line)
|
||||
(org-babel-chomp ;; remove trailing newlines
|
||||
(when (> (length line) 0) ;; remove empty lines
|
||||
(cond
|
||||
;; remove leading "-> " from return values
|
||||
((and (>= (length line) 3)
|
||||
(string= "-> " (substring line 0 3)))
|
||||
(substring line 3))
|
||||
;; remove trailing "-> <<return-value>>" on the
|
||||
;; last line of output
|
||||
((and (member "output" result-params)
|
||||
(string-match-p "->" line))
|
||||
(substring line 0 (string-match "->" line)))
|
||||
(t line)
|
||||
)
|
||||
;; (if (and (>= (length line) 3) ;; remove leading "<- "
|
||||
;; (string= "-> " (substring line 0 3)))
|
||||
;; (substring line 3)
|
||||
;; line)
|
||||
)))
|
||||
;; returns a list of the output of each evaluated expression
|
||||
(org-babel-comint-with-output (session org-babel-picolisp-eoe)
|
||||
(insert wrapped-body) (comint-send-input)
|
||||
(insert "'" org-babel-picolisp-eoe) (comint-send-input)))))
|
||||
"\n")
|
||||
;; external evaluation
|
||||
(let ((script-file (org-babel-temp-file "picolisp-script-")))
|
||||
(with-temp-file script-file
|
||||
(insert (concat wrapped-body "(bye)")))
|
||||
(org-babel-eval
|
||||
(format "%s %s"
|
||||
org-babel-picolisp-cmd
|
||||
(org-babel-process-file-name script-file))
|
||||
""))))))
|
||||
(t full-body)))
|
||||
(result
|
||||
(if (not (string= session-name "none"))
|
||||
;; Session based evaluation.
|
||||
(mapconcat ;; <- joins the list back into a single string
|
||||
#'identity
|
||||
(butlast ;; <- remove the org-babel-picolisp-eoe line
|
||||
(delq nil
|
||||
(mapcar
|
||||
(lambda (line)
|
||||
(org-babel-chomp ;; Remove trailing newlines.
|
||||
(when (> (length line) 0) ;; Remove empty lines.
|
||||
(cond
|
||||
;; Remove leading "-> " from return values.
|
||||
((and (>= (length line) 3)
|
||||
(string= "-> " (substring line 0 3)))
|
||||
(substring line 3))
|
||||
;; Remove trailing "-> <<return-value>>" on the
|
||||
;; last line of output.
|
||||
((and (member "output" result-params)
|
||||
(string-match-p "->" line))
|
||||
(substring line 0 (string-match "->" line)))
|
||||
(t line)
|
||||
)
|
||||
;;(if (and (>= (length line) 3);Remove leading "<-"
|
||||
;; (string= "-> " (substring line 0 3)))
|
||||
;; (substring line 3)
|
||||
;; line)
|
||||
)))
|
||||
;; Returns a list of the output of each evaluated exp.
|
||||
(org-babel-comint-with-output
|
||||
(session org-babel-picolisp-eoe)
|
||||
(insert wrapped-body) (comint-send-input)
|
||||
(insert "'" org-babel-picolisp-eoe)
|
||||
(comint-send-input)))))
|
||||
"\n")
|
||||
;; external evaluation
|
||||
(let ((script-file (org-babel-temp-file "picolisp-script-")))
|
||||
(with-temp-file script-file
|
||||
(insert (concat wrapped-body "(bye)")))
|
||||
(org-babel-eval
|
||||
(format "%s %s"
|
||||
org-babel-picolisp-cmd
|
||||
(org-babel-process-file-name script-file))
|
||||
"")))))
|
||||
(org-babel-result-cond result-params
|
||||
result
|
||||
(read result))))
|
||||
|
||||
(defun org-babel-picolisp-initiate-session (&optional session-name)
|
||||
"If there is not a current inferior-process-buffer in SESSION
|
||||
|
@ -143,13 +143,12 @@ specifying a variable of the same value."
|
||||
"Convert RESULTS into an appropriate elisp value.
|
||||
If the results look like a list or tuple, then convert them into an
|
||||
Emacs-lisp table, otherwise return the results as a string."
|
||||
((lambda (res)
|
||||
(if (listp res)
|
||||
(mapcar (lambda (el) (if (equal el 'None)
|
||||
org-babel-python-None-to el))
|
||||
res)
|
||||
res))
|
||||
(org-babel-script-escape results)))
|
||||
(let ((res (org-babel-script-escape results)))
|
||||
(if (listp res)
|
||||
(mapcar (lambda (el) (if (equal el 'None)
|
||||
org-babel-python-None-to el))
|
||||
res)
|
||||
res)))
|
||||
|
||||
(defvar org-babel-python-buffers '((:default . "*Python*")))
|
||||
|
||||
@ -172,6 +171,8 @@ Emacs-lisp table, otherwise return the results as a string."
|
||||
name)))
|
||||
|
||||
(defvar py-default-interpreter)
|
||||
(defvar py-which-bufname)
|
||||
(defvar python-shell-buffer-name)
|
||||
(defun org-babel-python-initiate-session-by-key (&optional session)
|
||||
"Initiate a python session.
|
||||
If there is not a current inferior-process-buffer in SESSION
|
||||
@ -252,34 +253,34 @@ open('%s', 'w').write( pprint.pformat(main()) )")
|
||||
If RESULT-TYPE equals 'output then return standard output as a
|
||||
string. If RESULT-TYPE equals 'value then return the value of the
|
||||
last statement in BODY, as elisp."
|
||||
((lambda (raw)
|
||||
(org-babel-result-cond result-params
|
||||
raw
|
||||
(org-babel-python-table-or-string (org-babel-trim raw))))
|
||||
(case result-type
|
||||
(output (org-babel-eval org-babel-python-command
|
||||
(concat (if preamble (concat preamble "\n") "")
|
||||
body)))
|
||||
(value (let ((tmp-file (org-babel-temp-file "python-")))
|
||||
(org-babel-eval
|
||||
org-babel-python-command
|
||||
(concat
|
||||
(if preamble (concat preamble "\n") "")
|
||||
(format
|
||||
(if (member "pp" result-params)
|
||||
org-babel-python-pp-wrapper-method
|
||||
org-babel-python-wrapper-method)
|
||||
(mapconcat
|
||||
(lambda (line) (format "\t%s" line))
|
||||
(split-string
|
||||
(org-remove-indentation
|
||||
(org-babel-trim body))
|
||||
"[\r\n]") "\n")
|
||||
(org-babel-process-file-name tmp-file 'noquote))))
|
||||
(org-babel-eval-read-file tmp-file))))))
|
||||
(let ((raw
|
||||
(case result-type
|
||||
(output (org-babel-eval org-babel-python-command
|
||||
(concat (if preamble (concat preamble "\n"))
|
||||
body)))
|
||||
(value (let ((tmp-file (org-babel-temp-file "python-")))
|
||||
(org-babel-eval
|
||||
org-babel-python-command
|
||||
(concat
|
||||
(if preamble (concat preamble "\n") "")
|
||||
(format
|
||||
(if (member "pp" result-params)
|
||||
org-babel-python-pp-wrapper-method
|
||||
org-babel-python-wrapper-method)
|
||||
(mapconcat
|
||||
(lambda (line) (format "\t%s" line))
|
||||
(split-string
|
||||
(org-remove-indentation
|
||||
(org-babel-trim body))
|
||||
"[\r\n]") "\n")
|
||||
(org-babel-process-file-name tmp-file 'noquote))))
|
||||
(org-babel-eval-read-file tmp-file))))))
|
||||
(org-babel-result-cond result-params
|
||||
raw
|
||||
(org-babel-python-table-or-string (org-babel-trim raw)))))
|
||||
|
||||
(defun org-babel-python-evaluate-session
|
||||
(session body &optional result-type result-params)
|
||||
(session body &optional result-type result-params)
|
||||
"Pass BODY to the Python process in SESSION.
|
||||
If RESULT-TYPE equals 'output then return standard output as a
|
||||
string. If RESULT-TYPE equals 'value then return the value of the
|
||||
@ -296,39 +297,41 @@ last statement in BODY, as elisp."
|
||||
(format "open('%s', 'w').write(pprint.pformat(_))"
|
||||
(org-babel-process-file-name tmp-file 'noquote)))
|
||||
(list (format "open('%s', 'w').write(str(_))"
|
||||
(org-babel-process-file-name tmp-file 'noquote)))))))
|
||||
(org-babel-process-file-name tmp-file
|
||||
'noquote)))))))
|
||||
(input-body (lambda (body)
|
||||
(mapc (lambda (line) (insert line) (funcall send-wait))
|
||||
(split-string body "[\r\n]"))
|
||||
(funcall send-wait))))
|
||||
((lambda (results)
|
||||
(unless (string= (substring org-babel-python-eoe-indicator 1 -1) results)
|
||||
(org-babel-result-cond result-params
|
||||
results
|
||||
(org-babel-python-table-or-string results))))
|
||||
(case result-type
|
||||
(output
|
||||
(mapconcat
|
||||
#'org-babel-trim
|
||||
(butlast
|
||||
(org-babel-comint-with-output
|
||||
(session org-babel-python-eoe-indicator t body)
|
||||
(funcall input-body body)
|
||||
(funcall send-wait) (funcall send-wait)
|
||||
(insert org-babel-python-eoe-indicator)
|
||||
(funcall send-wait))
|
||||
2) "\n"))
|
||||
(value
|
||||
(let ((tmp-file (org-babel-temp-file "python-")))
|
||||
(org-babel-comint-with-output
|
||||
(session org-babel-python-eoe-indicator nil body)
|
||||
(let ((comint-process-echoes nil))
|
||||
(funcall input-body body)
|
||||
(funcall dump-last-value tmp-file (member "pp" result-params))
|
||||
(funcall send-wait) (funcall send-wait)
|
||||
(insert org-babel-python-eoe-indicator)
|
||||
(funcall send-wait)))
|
||||
(org-babel-eval-read-file tmp-file)))))))
|
||||
(funcall send-wait)))
|
||||
(results
|
||||
(case result-type
|
||||
(output
|
||||
(mapconcat
|
||||
#'org-babel-trim
|
||||
(butlast
|
||||
(org-babel-comint-with-output
|
||||
(session org-babel-python-eoe-indicator t body)
|
||||
(funcall input-body body)
|
||||
(funcall send-wait) (funcall send-wait)
|
||||
(insert org-babel-python-eoe-indicator)
|
||||
(funcall send-wait))
|
||||
2) "\n"))
|
||||
(value
|
||||
(let ((tmp-file (org-babel-temp-file "python-")))
|
||||
(org-babel-comint-with-output
|
||||
(session org-babel-python-eoe-indicator nil body)
|
||||
(let ((comint-process-echoes nil))
|
||||
(funcall input-body body)
|
||||
(funcall dump-last-value tmp-file
|
||||
(member "pp" result-params))
|
||||
(funcall send-wait) (funcall send-wait)
|
||||
(insert org-babel-python-eoe-indicator)
|
||||
(funcall send-wait)))
|
||||
(org-babel-eval-read-file tmp-file))))))
|
||||
(unless (string= (substring org-babel-python-eoe-indicator 1 -1) results)
|
||||
(org-babel-result-cond result-params
|
||||
results
|
||||
(org-babel-python-table-or-string results)))))
|
||||
|
||||
(defun org-babel-python-read-string (string)
|
||||
"Strip 's from around Python string."
|
||||
|
@ -139,13 +139,12 @@ specifying a variable of the same value."
|
||||
"Convert RESULTS into an appropriate elisp value.
|
||||
If RESULTS look like a table, then convert them into an
|
||||
Emacs-lisp table, otherwise return the results as a string."
|
||||
((lambda (res)
|
||||
(if (listp res)
|
||||
(mapcar (lambda (el) (if (equal el 'nil)
|
||||
org-babel-ruby-nil-to el))
|
||||
res)
|
||||
res))
|
||||
(org-babel-script-escape results)))
|
||||
(let ((res (org-babel-script-escape results)))
|
||||
(if (listp res)
|
||||
(mapcar (lambda (el) (if (equal el 'nil)
|
||||
org-babel-ruby-nil-to el))
|
||||
res)
|
||||
res)))
|
||||
|
||||
(defun org-babel-ruby-initiate-session (&optional session params)
|
||||
"Initiate a ruby session.
|
||||
@ -204,12 +203,11 @@ return the value of the last statement in BODY, as elisp."
|
||||
org-babel-ruby-pp-wrapper-method
|
||||
org-babel-ruby-wrapper-method)
|
||||
body (org-babel-process-file-name tmp-file 'noquote)))
|
||||
((lambda (raw)
|
||||
(if (or (member "code" result-params)
|
||||
(member "pp" result-params))
|
||||
raw
|
||||
(org-babel-ruby-table-or-string raw)))
|
||||
(org-babel-eval-read-file tmp-file)))))
|
||||
(let ((raw (org-babel-eval-read-file tmp-file)))
|
||||
(if (or (member "code" result-params)
|
||||
(member "pp" result-params))
|
||||
raw
|
||||
(org-babel-ruby-table-or-string raw))))))
|
||||
;; comint session evaluation
|
||||
(case result-type
|
||||
(output
|
||||
|
@ -100,12 +100,11 @@ in BODY as elisp."
|
||||
(let* ((src-file (org-babel-temp-file "scala-"))
|
||||
(wrapper (format org-babel-scala-wrapper-method body)))
|
||||
(with-temp-file src-file (insert wrapper))
|
||||
((lambda (raw)
|
||||
(org-babel-result-cond result-params
|
||||
raw
|
||||
(org-babel-scala-table-or-string raw)))
|
||||
(org-babel-eval
|
||||
(concat org-babel-scala-command " " src-file) ""))))))
|
||||
(let ((raw (org-babel-eval
|
||||
(concat org-babel-scala-command " " src-file) "")))
|
||||
(org-babel-result-cond result-params
|
||||
raw
|
||||
(org-babel-scala-table-or-string raw)))))))
|
||||
|
||||
|
||||
(defun org-babel-prep-session:scala (session params)
|
||||
|
131
lisp/ob-sh.el
131
lisp/ob-sh.el
@ -53,9 +53,9 @@ This will be passed to `shell-command-on-region'")
|
||||
This function is called by `org-babel-execute-src-block'."
|
||||
(let* ((session (org-babel-sh-initiate-session
|
||||
(cdr (assoc :session params))))
|
||||
(stdin ((lambda (stdin) (when stdin (org-babel-sh-var-to-string
|
||||
(org-babel-ref-resolve stdin))))
|
||||
(cdr (assoc :stdin params))))
|
||||
(stdin (let ((stdin (cdr (assoc :stdin params))))
|
||||
(when stdin (org-babel-sh-var-to-string
|
||||
(org-babel-ref-resolve stdin)))))
|
||||
(full-body (org-babel-expand-body:generic
|
||||
body params (org-babel-variable-assignments:sh params))))
|
||||
(org-babel-reassemble-table
|
||||
@ -135,68 +135,69 @@ Emacs-lisp table, otherwise return the results as a string."
|
||||
If RESULT-TYPE equals 'output then return a list of the outputs
|
||||
of the statements in BODY, if RESULT-TYPE equals 'value then
|
||||
return the value of the last statement in BODY."
|
||||
((lambda (results)
|
||||
(when results
|
||||
(let ((result-params (cdr (assoc :result-params params))))
|
||||
(org-babel-result-cond result-params
|
||||
results
|
||||
(let ((tmp-file (org-babel-temp-file "sh-")))
|
||||
(with-temp-file tmp-file (insert results))
|
||||
(org-babel-import-elisp-from-file tmp-file))))))
|
||||
(cond
|
||||
(stdin ; external shell script w/STDIN
|
||||
(let ((script-file (org-babel-temp-file "sh-script-"))
|
||||
(stdin-file (org-babel-temp-file "sh-stdin-"))
|
||||
(shebang (cdr (assoc :shebang params)))
|
||||
(padline (not (string= "no" (cdr (assoc :padline params))))))
|
||||
(with-temp-file script-file
|
||||
(when shebang (insert (concat shebang "\n")))
|
||||
(when padline (insert "\n"))
|
||||
(insert body))
|
||||
(set-file-modes script-file #o755)
|
||||
(with-temp-file stdin-file (insert stdin))
|
||||
(with-temp-buffer
|
||||
(call-process-shell-command
|
||||
(if shebang
|
||||
script-file
|
||||
(format "%s %s" org-babel-sh-command script-file))
|
||||
stdin-file
|
||||
(current-buffer))
|
||||
(buffer-string))))
|
||||
(session ; session evaluation
|
||||
(mapconcat
|
||||
#'org-babel-sh-strip-weird-long-prompt
|
||||
(mapcar
|
||||
#'org-babel-trim
|
||||
(butlast
|
||||
(org-babel-comint-with-output
|
||||
(session org-babel-sh-eoe-output t body)
|
||||
(mapc
|
||||
(lambda (line)
|
||||
(insert line)
|
||||
(comint-send-input nil t)
|
||||
(while (save-excursion
|
||||
(goto-char comint-last-input-end)
|
||||
(not (re-search-forward
|
||||
comint-prompt-regexp nil t)))
|
||||
(accept-process-output (get-buffer-process (current-buffer)))))
|
||||
(append
|
||||
(split-string (org-babel-trim body) "\n")
|
||||
(list org-babel-sh-eoe-indicator))))
|
||||
2)) "\n"))
|
||||
('otherwise ; external shell script
|
||||
(if (and (cdr (assoc :shebang params))
|
||||
(> (length (cdr (assoc :shebang params))) 0))
|
||||
(let ((script-file (org-babel-temp-file "sh-script-"))
|
||||
(shebang (cdr (assoc :shebang params)))
|
||||
(padline (not (string= "no" (cdr (assoc :padline params))))))
|
||||
(with-temp-file script-file
|
||||
(when shebang (insert (concat shebang "\n")))
|
||||
(when padline (insert "\n"))
|
||||
(insert body))
|
||||
(set-file-modes script-file #o755)
|
||||
(org-babel-eval script-file ""))
|
||||
(org-babel-eval org-babel-sh-command (org-babel-trim body)))))))
|
||||
(let ((results
|
||||
(cond
|
||||
(stdin ; external shell script w/STDIN
|
||||
(let ((script-file (org-babel-temp-file "sh-script-"))
|
||||
(stdin-file (org-babel-temp-file "sh-stdin-"))
|
||||
(shebang (cdr (assoc :shebang params)))
|
||||
(padline (not (string= "no" (cdr (assoc :padline params))))))
|
||||
(with-temp-file script-file
|
||||
(when shebang (insert (concat shebang "\n")))
|
||||
(when padline (insert "\n"))
|
||||
(insert body))
|
||||
(set-file-modes script-file #o755)
|
||||
(with-temp-file stdin-file (insert stdin))
|
||||
(with-temp-buffer
|
||||
(call-process-shell-command
|
||||
(if shebang
|
||||
script-file
|
||||
(format "%s %s" org-babel-sh-command script-file))
|
||||
stdin-file
|
||||
(current-buffer))
|
||||
(buffer-string))))
|
||||
(session ; session evaluation
|
||||
(mapconcat
|
||||
#'org-babel-sh-strip-weird-long-prompt
|
||||
(mapcar
|
||||
#'org-babel-trim
|
||||
(butlast
|
||||
(org-babel-comint-with-output
|
||||
(session org-babel-sh-eoe-output t body)
|
||||
(mapc
|
||||
(lambda (line)
|
||||
(insert line)
|
||||
(comint-send-input nil t)
|
||||
(while (save-excursion
|
||||
(goto-char comint-last-input-end)
|
||||
(not (re-search-forward
|
||||
comint-prompt-regexp nil t)))
|
||||
(accept-process-output
|
||||
(get-buffer-process (current-buffer)))))
|
||||
(append
|
||||
(split-string (org-babel-trim body) "\n")
|
||||
(list org-babel-sh-eoe-indicator))))
|
||||
2)) "\n"))
|
||||
('otherwise ; external shell script
|
||||
(if (and (cdr (assoc :shebang params))
|
||||
(> (length (cdr (assoc :shebang params))) 0))
|
||||
(let ((script-file (org-babel-temp-file "sh-script-"))
|
||||
(shebang (cdr (assoc :shebang params)))
|
||||
(padline (not (equal "no" (cdr (assoc :padline params))))))
|
||||
(with-temp-file script-file
|
||||
(when shebang (insert (concat shebang "\n")))
|
||||
(when padline (insert "\n"))
|
||||
(insert body))
|
||||
(set-file-modes script-file #o755)
|
||||
(org-babel-eval script-file ""))
|
||||
(org-babel-eval org-babel-sh-command (org-babel-trim body)))))))
|
||||
(when results
|
||||
(let ((result-params (cdr (assoc :result-params params))))
|
||||
(org-babel-result-cond result-params
|
||||
results
|
||||
(let ((tmp-file (org-babel-temp-file "sh-")))
|
||||
(with-temp-file tmp-file (insert results))
|
||||
(org-babel-import-elisp-from-file tmp-file)))))))
|
||||
|
||||
(defun org-babel-sh-strip-weird-long-prompt (string)
|
||||
"Remove prompt cruft from a string of shell output."
|
||||
|
@ -66,14 +66,14 @@ This function is called by `org-babel-execute-src-block'"
|
||||
(let* ((result-type (cdr (assoc :result-type params)))
|
||||
(result-params (cdr (assoc :result-params params)))
|
||||
(full-body (org-babel-expand-body:shen body params)))
|
||||
((lambda (results)
|
||||
(org-babel-result-cond result-params
|
||||
results
|
||||
(condition-case nil (org-babel-script-escape results)
|
||||
(error results))))
|
||||
(with-temp-buffer
|
||||
(insert full-body)
|
||||
(call-interactively #'shen-eval-defun)))))
|
||||
(let ((results
|
||||
(with-temp-buffer
|
||||
(insert full-body)
|
||||
(call-interactively #'shen-eval-defun))))
|
||||
(org-babel-result-cond result-params
|
||||
results
|
||||
(condition-case nil (org-babel-script-escape results)
|
||||
(error results))))))
|
||||
|
||||
(provide 'ob-shen)
|
||||
;;; ob-shen.el ends here
|
||||
|
@ -186,19 +186,17 @@ This function is called by `org-babel-execute-src-block'."
|
||||
(lambda (pair)
|
||||
(setq body
|
||||
(replace-regexp-in-string
|
||||
(format "\$%s" (car pair))
|
||||
((lambda (val)
|
||||
(if (listp val)
|
||||
((lambda (data-file)
|
||||
(with-temp-file data-file
|
||||
(insert (orgtbl-to-csv
|
||||
val '(:fmt (lambda (el) (if (stringp el)
|
||||
el
|
||||
(format "%S" el)))))))
|
||||
data-file)
|
||||
(org-babel-temp-file "sql-data-"))
|
||||
(if (stringp val) val (format "%S" val))))
|
||||
(cdr pair))
|
||||
(format "\$%s" (car pair)) ;FIXME: "\$" == "$"!
|
||||
(let ((val (cdr pair)))
|
||||
(if (listp val)
|
||||
(let ((data-file (org-babel-temp-file "sql-data-")))
|
||||
(with-temp-file data-file
|
||||
(insert (orgtbl-to-csv
|
||||
val '(:fmt (lambda (el) (if (stringp el)
|
||||
el
|
||||
(format "%S" el)))))))
|
||||
data-file)
|
||||
(if (stringp val) val (format "%S" val))))
|
||||
body)))
|
||||
vars)
|
||||
body)
|
||||
|
@ -114,23 +114,22 @@ This function is called by `org-babel-execute-src-block'."
|
||||
|
||||
(defun org-babel-sqlite-expand-vars (body vars)
|
||||
"Expand the variables held in VARS in BODY."
|
||||
;; FIXME: Redundancy with org-babel-sql-expand-vars!
|
||||
(mapc
|
||||
(lambda (pair)
|
||||
(setq body
|
||||
(replace-regexp-in-string
|
||||
(format "\$%s" (car pair))
|
||||
((lambda (val)
|
||||
(if (listp val)
|
||||
((lambda (data-file)
|
||||
(with-temp-file data-file
|
||||
(insert (orgtbl-to-csv
|
||||
val '(:fmt (lambda (el) (if (stringp el)
|
||||
el
|
||||
(format "%S" el)))))))
|
||||
data-file)
|
||||
(org-babel-temp-file "sqlite-data-"))
|
||||
(if (stringp val) val (format "%S" val))))
|
||||
(cdr pair))
|
||||
(format "\$%s" (car pair)) ;FIXME: "\$" == "$"!
|
||||
(let ((val (cdr pair)))
|
||||
(if (listp val)
|
||||
(let ((data-file (org-babel-temp-file "sqlite-data-")))
|
||||
(with-temp-file data-file
|
||||
(insert (orgtbl-to-csv
|
||||
val '(:fmt (lambda (el) (if (stringp el)
|
||||
el
|
||||
(format "%S" el)))))))
|
||||
data-file)
|
||||
(if (stringp val) val (format "%S" val))))
|
||||
body)))
|
||||
vars)
|
||||
body)
|
||||
|
@ -60,7 +60,7 @@ character and replace it with ellipses."
|
||||
(concat (substring string 0 (match-beginning 0))
|
||||
(if (match-string 1 string) "...")) string))
|
||||
|
||||
(defmacro sbe (source-block &rest variables)
|
||||
(defmacro sbe (source-block &rest variables) ;FIXME: Namespace prefix!
|
||||
"Return the results of calling SOURCE-BLOCK with VARIABLES.
|
||||
Each element of VARIABLES should be a two
|
||||
element list, whose first element is the name of the variable and
|
||||
@ -85,6 +85,7 @@ as shown in the example below.
|
||||
|
||||
| 1 | 2 | :file nothing.png | nothing.png |
|
||||
#+TBLFM: @1$4='(sbe test-sbe $3 (x $1) (y $2))"
|
||||
(declare (debug (form form)))
|
||||
(let* ((header-args (if (stringp (car variables)) (car variables) ""))
|
||||
(variables (if (stringp (car variables)) (cdr variables) variables)))
|
||||
(let* (quote
|
||||
@ -107,31 +108,31 @@ as shown in the example below.
|
||||
variables)))
|
||||
(unless (stringp source-block)
|
||||
(setq source-block (symbol-name source-block)))
|
||||
((lambda (result)
|
||||
(org-babel-trim (if (stringp result) result (format "%S" result))))
|
||||
(if (and source-block (> (length source-block) 0))
|
||||
(let ((params
|
||||
(eval `(org-babel-parse-header-arguments
|
||||
(concat
|
||||
":var results="
|
||||
,source-block
|
||||
"[" ,header-args "]"
|
||||
"("
|
||||
(mapconcat
|
||||
(lambda (var-spec)
|
||||
(if (> (length (cdr var-spec)) 1)
|
||||
(format "%S='%S"
|
||||
(car var-spec)
|
||||
(mapcar #'read (cdr var-spec)))
|
||||
(format "%S=%s"
|
||||
(car var-spec) (cadr var-spec))))
|
||||
',variables ", ")
|
||||
")")))))
|
||||
(org-babel-execute-src-block
|
||||
nil (list "emacs-lisp" "results" params)
|
||||
'((:results . "silent"))))
|
||||
"")))))
|
||||
(def-edebug-spec sbe (form form))
|
||||
(let ((result
|
||||
(if (and source-block (> (length source-block) 0))
|
||||
(let ((params
|
||||
;; FIXME: Why `eval'?!?!?
|
||||
(eval `(org-babel-parse-header-arguments
|
||||
(concat
|
||||
":var results="
|
||||
,source-block
|
||||
"[" ,header-args "]"
|
||||
"("
|
||||
(mapconcat
|
||||
(lambda (var-spec)
|
||||
(if (> (length (cdr var-spec)) 1)
|
||||
(format "%S='%S"
|
||||
(car var-spec)
|
||||
(mapcar #'read (cdr var-spec)))
|
||||
(format "%S=%s"
|
||||
(car var-spec) (cadr var-spec))))
|
||||
',variables ", ")
|
||||
")")))))
|
||||
(org-babel-execute-src-block
|
||||
nil (list "emacs-lisp" "results" params)
|
||||
'((:results . "silent"))))
|
||||
"")))
|
||||
(org-babel-trim (if (stringp result) result (format "%S" result)))))))
|
||||
|
||||
(provide 'ob-table)
|
||||
|
||||
|
@ -216,8 +216,8 @@ used to limit the exported source code blocks by language."
|
||||
(lambda (spec)
|
||||
(let ((get-spec (lambda (name) (cdr (assoc name (nth 4 spec))))))
|
||||
(let* ((tangle (funcall get-spec :tangle))
|
||||
(she-bang ((lambda (sheb) (when (> (length sheb) 0) sheb))
|
||||
(funcall get-spec :shebang)))
|
||||
(she-bang (let ((sheb (funcall get-spec :shebang)))
|
||||
(when (> (length sheb) 0) sheb)))
|
||||
(tangle-mode (funcall get-spec :tangle-mode))
|
||||
(base-name (cond
|
||||
((string= "yes" tangle)
|
||||
@ -230,9 +230,9 @@ used to limit the exported source code blocks by language."
|
||||
(if (and ext (string= "yes" tangle))
|
||||
(concat base-name "." ext) base-name))))
|
||||
(when file-name
|
||||
;; possibly create the parent directories for file
|
||||
(when ((lambda (m) (and m (not (string= m "no"))))
|
||||
(funcall get-spec :mkdirp))
|
||||
;; Possibly create the parent directories for file.
|
||||
(when (let ((m (funcall get-spec :mkdirp)))
|
||||
(and m (not (string= m "no"))))
|
||||
(make-directory (file-name-directory file-name) 'parents))
|
||||
;; delete any old versions of file
|
||||
(when (and (file-exists-p file-name)
|
||||
@ -334,9 +334,8 @@ that the appropriate major-mode is set. SPEC has the form:
|
||||
(string= comments "yes") (string= comments "noweb")))
|
||||
(link-data (mapcar (lambda (el)
|
||||
(cons (symbol-name el)
|
||||
((lambda (le)
|
||||
(if (stringp le) le (format "%S" le)))
|
||||
(eval el))))
|
||||
(let ((le (eval el)))
|
||||
(if (stringp le) le (format "%S" le)))))
|
||||
'(start-line file link source-name)))
|
||||
(insert-comment (lambda (text)
|
||||
(when (and comments (not (string= comments "no"))
|
||||
@ -429,11 +428,10 @@ list to be used by `org-babel-tangle' directly."
|
||||
(cref-fmt (or (and (string-match "-l \"\\(.+\\)\"" extra)
|
||||
(match-string 1 extra))
|
||||
org-coderef-label-format))
|
||||
(link ((lambda (link)
|
||||
(and (string-match org-bracket-link-regexp link)
|
||||
(match-string 1 link)))
|
||||
(org-no-properties
|
||||
(org-store-link nil))))
|
||||
(link (let ((link (org-no-properties
|
||||
(org-store-link nil))))
|
||||
(and (string-match org-bracket-link-regexp link)
|
||||
(match-string 1 link))))
|
||||
(source-name
|
||||
(intern (or (nth 4 info)
|
||||
(format "%s:%d"
|
||||
@ -445,28 +443,29 @@ list to be used by `org-babel-tangle' directly."
|
||||
(assignments-cmd
|
||||
(intern (concat "org-babel-variable-assignments:" src-lang)))
|
||||
(body
|
||||
((lambda (body) ;; Run the tangle-body-hook
|
||||
(with-temp-buffer
|
||||
(insert body)
|
||||
(when (string-match "-r" extra)
|
||||
(goto-char (point-min))
|
||||
(while (re-search-forward
|
||||
(replace-regexp-in-string "%s" ".+" cref-fmt) nil t)
|
||||
(replace-match "")))
|
||||
(run-hooks 'org-babel-tangle-body-hook)
|
||||
(buffer-string)))
|
||||
((lambda (body) ;; Expand the body in language specific manner
|
||||
(if (assoc :no-expand params)
|
||||
body
|
||||
(if (fboundp expand-cmd)
|
||||
(funcall expand-cmd body params)
|
||||
(org-babel-expand-body:generic
|
||||
body params
|
||||
(and (fboundp assignments-cmd)
|
||||
(funcall assignments-cmd params))))))
|
||||
(if (org-babel-noweb-p params :tangle)
|
||||
(org-babel-expand-noweb-references info)
|
||||
(nth 1 info)))))
|
||||
;; Run the tangle-body-hook.
|
||||
(let* ((body ;; Expand the body in language specific manner.
|
||||
(if (org-babel-noweb-p params :tangle)
|
||||
(org-babel-expand-noweb-references info)
|
||||
(nth 1 info)))
|
||||
(body
|
||||
(if (assoc :no-expand params)
|
||||
body
|
||||
(if (fboundp expand-cmd)
|
||||
(funcall expand-cmd body params)
|
||||
(org-babel-expand-body:generic
|
||||
body params
|
||||
(and (fboundp assignments-cmd)
|
||||
(funcall assignments-cmd params)))))))
|
||||
(with-temp-buffer
|
||||
(insert body)
|
||||
(when (string-match "-r" extra)
|
||||
(goto-char (point-min))
|
||||
(while (re-search-forward
|
||||
(replace-regexp-in-string "%s" ".+" cref-fmt) nil t)
|
||||
(replace-match "")))
|
||||
(run-hooks 'org-babel-tangle-body-hook)
|
||||
(buffer-string))))
|
||||
(comment
|
||||
(when (or (string= "both" (cdr (assoc :comments params)))
|
||||
(string= "org" (cdr (assoc :comments params))))
|
||||
@ -501,9 +500,8 @@ list to be used by `org-babel-tangle' directly."
|
||||
(source-name (nth 4 (or info (org-babel-get-src-block-info 'light))))
|
||||
(link-data (mapcar (lambda (el)
|
||||
(cons (symbol-name el)
|
||||
((lambda (le)
|
||||
(if (stringp le) le (format "%S" le)))
|
||||
(eval el))))
|
||||
(let ((le (eval el)))
|
||||
(if (stringp le) le (format "%S" le)))))
|
||||
'(start-line file link source-name))))
|
||||
(list (org-fill-template org-babel-tangle-comment-format-beg link-data)
|
||||
(org-fill-template org-babel-tangle-comment-format-end link-data))))
|
||||
|
@ -2840,6 +2840,8 @@ Pressing `<' twice means to restrict to the current subtree or region
|
||||
((equal org-keys "!") (customize-variable 'org-stuck-projects))
|
||||
(t (user-error "Invalid agenda key"))))))
|
||||
|
||||
(defvar org-agenda-multi)
|
||||
|
||||
(defun org-agenda-append-agenda ()
|
||||
"Append another agenda view to the current one.
|
||||
This function allows interactive building of block agendas.
|
||||
@ -3815,6 +3817,8 @@ generating a new one."
|
||||
'org-priority))
|
||||
(overlay-put ov 'org-type 'org-priority)))))
|
||||
|
||||
(defvar org-depend-tag-blocked)
|
||||
|
||||
(defun org-agenda-dim-blocked-tasks (&optional invisible)
|
||||
"Dim currently blocked TODO's in the agenda display.
|
||||
When INVISIBLE is non-nil, hide currently blocked TODO instead of
|
||||
@ -3983,6 +3987,7 @@ This check for agenda markers in all agenda buffers currently active."
|
||||
;;; Agenda timeline
|
||||
|
||||
(defvar org-agenda-only-exact-dates nil) ; dynamically scoped
|
||||
(defvar org-agenda-show-log-scoped) ;; dynamically scope in `org-timeline' or `org-agenda-list'
|
||||
|
||||
(defun org-timeline (&optional dotodo)
|
||||
"Show a time-sorted view of the entries in the current org file.
|
||||
@ -5763,7 +5768,6 @@ please use `org-class' instead."
|
||||
dayname skip-weeks)))
|
||||
(make-obsolete 'org-diary-class 'org-class "")
|
||||
|
||||
(defvar org-agenda-show-log-scoped) ;; dynamically scope in `org-timeline' or `org-agenda-list'
|
||||
(defalias 'org-get-closed 'org-agenda-get-progress)
|
||||
(defun org-agenda-get-progress ()
|
||||
"Return the logged TODO entries for agenda display."
|
||||
|
@ -293,12 +293,13 @@ This variable is relevant only if `org-bibtex-export-tags-as-keywords' is t."
|
||||
|
||||
;;; Utility functions
|
||||
(defun org-bibtex-get (property)
|
||||
((lambda (it) (when it (org-babel-trim it)))
|
||||
(let ((org-special-properties
|
||||
(delete "FILE" (copy-sequence org-special-properties))))
|
||||
(or
|
||||
(org-entry-get (point) (upcase property))
|
||||
(org-entry-get (point) (concat org-bibtex-prefix (upcase property)))))))
|
||||
(let ((it (let ((org-special-properties
|
||||
(delete "FILE" (copy-sequence org-special-properties))))
|
||||
(or
|
||||
(org-entry-get (point) (upcase property))
|
||||
(org-entry-get (point) (concat org-bibtex-prefix
|
||||
(upcase property)))))))
|
||||
(when it (org-babel-trim it))))
|
||||
|
||||
(defun org-bibtex-put (property value)
|
||||
(let ((prop (upcase (if (keywordp property)
|
||||
@ -384,8 +385,8 @@ This variable is relevant only if `org-bibtex-export-tags-as-keywords' is t."
|
||||
(princ (cdr (assoc field org-bibtex-fields))))
|
||||
(with-current-buffer buf-name (visual-line-mode 1))
|
||||
(org-fit-window-to-buffer (get-buffer-window buf-name))
|
||||
((lambda (result) (when (> (length result) 0) result))
|
||||
(read-from-minibuffer (format "%s: " name))))))
|
||||
(let ((result (read-from-minibuffer (format "%s: " name))))
|
||||
(when (> (length result) 0) result)))))
|
||||
|
||||
(defun org-bibtex-autokey ()
|
||||
"Generate an autokey for the current headline."
|
||||
@ -539,20 +540,21 @@ Headlines are exported using `org-bibtex-export-headline'."
|
||||
"Bibtex file: " nil nil nil
|
||||
(file-name-nondirectory
|
||||
(concat (file-name-sans-extension (buffer-file-name)) ".bib")))))
|
||||
((lambda (error-point)
|
||||
(when error-point
|
||||
(goto-char error-point)
|
||||
(message "Bibtex error at %S" (nth 4 (org-heading-components)))))
|
||||
(catch 'bib
|
||||
(let ((bibtex-entries (remove nil (org-map-entries
|
||||
(lambda ()
|
||||
(condition-case foo
|
||||
(org-bibtex-headline)
|
||||
(error (throw 'bib (point)))))))))
|
||||
(with-temp-file filename
|
||||
(insert (mapconcat #'identity bibtex-entries "\n")))
|
||||
(message "Successfully exported %d BibTeX entries to %s"
|
||||
(length bibtex-entries) filename) nil))))
|
||||
(let ((error-point
|
||||
(catch 'bib
|
||||
(let ((bibtex-entries
|
||||
(remove nil (org-map-entries
|
||||
(lambda ()
|
||||
(condition-case foo
|
||||
(org-bibtex-headline)
|
||||
(error (throw 'bib (point)))))))))
|
||||
(with-temp-file filename
|
||||
(insert (mapconcat #'identity bibtex-entries "\n")))
|
||||
(message "Successfully exported %d BibTeX entries to %s"
|
||||
(length bibtex-entries) filename) nil))))
|
||||
(when error-point
|
||||
(goto-char error-point)
|
||||
(message "Bibtex error at %S" (nth 4 (org-heading-components))))))
|
||||
|
||||
(defun org-bibtex-check (&optional optional)
|
||||
"Check the current headline for required fields.
|
||||
@ -560,8 +562,8 @@ With prefix argument OPTIONAL also prompt for optional fields."
|
||||
(interactive "P")
|
||||
(save-restriction
|
||||
(org-narrow-to-subtree)
|
||||
(let ((type ((lambda (name) (when name (intern (concat ":" name))))
|
||||
(org-bibtex-get org-bibtex-type-property-name))))
|
||||
(let ((type (let ((name (org-bibtex-get org-bibtex-type-property-name)))
|
||||
(when name (intern (concat ":" name))))))
|
||||
(when type (org-bibtex-fleshout type optional)))))
|
||||
|
||||
(defun org-bibtex-check-all (&optional optional)
|
||||
|
@ -1114,6 +1114,7 @@ so long."
|
||||
|
||||
(defvar org-clock-current-task nil "Task currently clocked in.")
|
||||
(defvar org-clock-out-time nil) ; store the time of the last clock-out
|
||||
(defvar org--msg-extra)
|
||||
|
||||
;;;###autoload
|
||||
(defun org-clock-in (&optional select start-time)
|
||||
@ -1133,7 +1134,7 @@ make this the default behavior.)"
|
||||
(catch 'abort
|
||||
(let ((interrupting (and (not org-clock-resolving-clocks-due-to-idleness)
|
||||
(org-clocking-p)))
|
||||
ts selected-task target-pos (msg-extra "")
|
||||
ts selected-task target-pos (org--msg-extra "")
|
||||
(leftover (and (not org-clock-resolving-clocks)
|
||||
org-clock-leftover-time)))
|
||||
|
||||
@ -1305,7 +1306,7 @@ make this the default behavior.)"
|
||||
(setq org-clock-idle-timer nil))
|
||||
(setq org-clock-idle-timer
|
||||
(run-with-timer 60 60 'org-resolve-clocks-if-idle))
|
||||
(message "Clock starts at %s - %s" ts msg-extra)
|
||||
(message "Clock starts at %s - %s" ts org--msg-extra)
|
||||
(run-hooks 'org-clock-in-hook)))))))
|
||||
|
||||
;;;###autoload
|
||||
@ -1351,7 +1352,6 @@ for a todo state to switch to, overriding the existing value
|
||||
(org-back-to-heading t)
|
||||
(move-marker org-clock-default-task (point))))
|
||||
|
||||
(defvar msg-extra)
|
||||
(defun org-clock-get-sum-start ()
|
||||
"Return the time from which clock times should be counted.
|
||||
This is for the currently running clock as it is displayed
|
||||
@ -1364,9 +1364,10 @@ decides which time to use."
|
||||
(lr (org-entry-get nil "LAST_REPEAT")))
|
||||
(cond
|
||||
((equal cmt "current")
|
||||
(setq msg-extra "showing time in current clock instance")
|
||||
(setq org--msg-extra "showing time in current clock instance")
|
||||
(current-time))
|
||||
((equal cmt "today")
|
||||
<<<<<<< HEAD
|
||||
(setq msg-extra "showing today's task time.")
|
||||
(let* ((dt (decode-time (current-time)))
|
||||
(hour (nth 2 dt))
|
||||
@ -1374,16 +1375,23 @@ decides which time to use."
|
||||
(if (< hour org-extend-today-until) (setf (nth 3 dt) (1- day)))
|
||||
(setf (nth 2 dt) org-extend-today-until)
|
||||
(setq dt (append (list 0 0) (nthcdr 2 dt)))
|
||||
=======
|
||||
(setq org--msg-extra "showing today's task time.")
|
||||
(let* ((dt (decode-time (current-time))))
|
||||
(setq dt (append (list 0 0 0) (nthcdr 3 dt)))
|
||||
(if org-extend-today-until
|
||||
(setf (nth 2 dt) org-extend-today-until))
|
||||
>>>>>>> maint
|
||||
(apply 'encode-time dt)))
|
||||
((or (equal cmt "all")
|
||||
(and (or (not cmt) (equal cmt "auto"))
|
||||
(not lr)))
|
||||
(setq msg-extra "showing entire task time.")
|
||||
(setq org--msg-extra "showing entire task time.")
|
||||
nil)
|
||||
((or (equal cmt "repeat")
|
||||
(and (or (not cmt) (equal cmt "auto"))
|
||||
lr))
|
||||
(setq msg-extra "showing task time since last repeat.")
|
||||
(setq org--msg-extra "showing task time since last repeat.")
|
||||
(if (not lr)
|
||||
nil
|
||||
(org-time-string-to-time lr)))
|
||||
|
@ -416,6 +416,10 @@ If yes, throw an error indicating that changing it does not make sense."
|
||||
(org-columns-next-allowed-value)
|
||||
(org-columns-edit-value "TAGS")))
|
||||
|
||||
(defvar org-agenda-overriding-columns-format nil
|
||||
"When set, overrides any other format definition for the agenda.
|
||||
Don't set this, this is meant for dynamic scoping.")
|
||||
|
||||
(defun org-columns-edit-value (&optional key)
|
||||
"Edit the value of the property at point in column view.
|
||||
Where possible, use the standard interface for changing this line."
|
||||
@ -901,10 +905,6 @@ display, or in the #+COLUMNS line of the current buffer."
|
||||
(insert-before-markers "#+COLUMNS: " fmt "\n")))
|
||||
(org-set-local 'org-columns-default-format fmt))))))
|
||||
|
||||
(defvar org-agenda-overriding-columns-format nil
|
||||
"When set, overrides any other format definition for the agenda.
|
||||
Don't set this, this is meant for dynamic scoping.")
|
||||
|
||||
(defun org-columns-get-autowidth-alist (s cache)
|
||||
"Derive the maximum column widths from the format and the cache."
|
||||
(let ((start 0) rtn)
|
||||
|
@ -5,6 +5,8 @@
|
||||
;; Author: Nicolas Goaziou <n.goaziou@gmail.com>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs is free software: you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
|
@ -844,8 +844,9 @@ with \",*\", \",#+\", \",,*\" and \",,#+\"."
|
||||
(let ((session (cdr (assoc :session (nth 2 info)))))
|
||||
(and session (not (string= session "none"))
|
||||
(org-babel-comint-buffer-livep session)
|
||||
((lambda (f) (and (fboundp f) (funcall f session)))
|
||||
(intern (format "org-babel-%s-associate-session" (nth 0 info)))))))
|
||||
(let ((f (intern (format "org-babel-%s-associate-session"
|
||||
(nth 0 info)))))
|
||||
(and (fboundp f) (funcall f session))))))
|
||||
|
||||
(defun org-src-babel-configure-edit-buffer ()
|
||||
(when org-src-babel-info
|
||||
@ -953,8 +954,9 @@ fontification of code blocks see `org-src-fontify-block' and
|
||||
LANG is a string, and the returned major mode is a symbol."
|
||||
(intern
|
||||
(concat
|
||||
((lambda (l) (if (symbolp l) (symbol-name l) l))
|
||||
(or (cdr (assoc lang org-src-lang-modes)) lang)) "-mode")))
|
||||
(let ((l (or (cdr (assoc lang org-src-lang-modes)) lang)))
|
||||
(if (symbolp l) (symbol-name l) l))
|
||||
"-mode")))
|
||||
|
||||
(provide 'org-src)
|
||||
|
||||
|
27
lisp/org.el
27
lisp/org.el
@ -82,7 +82,7 @@
|
||||
(require 'org-macs)
|
||||
(require 'org-compat)
|
||||
|
||||
;; `org-outline-regexp' ought to be a defconst but is let-binding in
|
||||
;; `org-outline-regexp' ought to be a defconst but is let-bound in
|
||||
;; some places -- e.g. see the macro `org-with-limited-levels'.
|
||||
;;
|
||||
;; In Org buffers, the value of `outline-regexp' is that of
|
||||
@ -306,13 +306,13 @@ When MESSAGE is non-nil, display a message with the version."
|
||||
org-install-dir
|
||||
(concat "mixed installation! " org-install-dir " and " org-dir))
|
||||
"org-loaddefs.el can not be found!")))
|
||||
(_version (if full version org-version)))
|
||||
(version1 (if full version org-version)))
|
||||
(if (org-called-interactively-p 'interactive)
|
||||
(if here
|
||||
(insert version)
|
||||
(message version))
|
||||
(if message (message _version))
|
||||
_version)))
|
||||
version1)))
|
||||
|
||||
(defconst org-version (org-version))
|
||||
|
||||
@ -4796,6 +4796,8 @@ This can be turned on/off through `org-toggle-tags-groups'."
|
||||
:group 'org-startup
|
||||
:type 'boolean)
|
||||
|
||||
(defvar org-inhibit-startup nil) ; Dynamically-scoped param.
|
||||
|
||||
(defun org-toggle-tags-groups ()
|
||||
"Toggle support for group tags.
|
||||
Support for group tags is controlled by the option
|
||||
@ -5249,7 +5251,6 @@ This variable is set by `org-before-change-function'.
|
||||
"Every change indicates that a table might need an update."
|
||||
(setq org-table-may-need-update t))
|
||||
(defvar org-mode-map)
|
||||
(defvar org-inhibit-startup nil) ; Dynamically-scoped param.
|
||||
(defvar org-inhibit-startup-visibility-stuff nil) ; Dynamically-scoped param.
|
||||
(defvar org-agenda-keep-modes nil) ; Dynamically-scoped param.
|
||||
(defvar org-inhibit-logging nil) ; Dynamically-scoped param.
|
||||
@ -6700,6 +6701,8 @@ in special contexts.
|
||||
(setq org-cycle-global-status 'overview)
|
||||
(run-hook-with-args 'org-cycle-hook 'overview)))))
|
||||
|
||||
(defvar org-called-with-limited-levels);Dyn-bound in ̀org-with-limited-levels'.
|
||||
|
||||
(defun org-cycle-internal-local ()
|
||||
"Do the local cycling action."
|
||||
(let ((goal-column 0) eoh eol eos has-children children-skipped struct)
|
||||
@ -7936,8 +7939,6 @@ even level numbers will become the next higher odd number."
|
||||
(define-obsolete-function-alias 'org-get-legal-level
|
||||
'org-get-valid-level "23.1")))
|
||||
|
||||
(defvar org-called-with-limited-levels nil) ;; Dynamically bound in
|
||||
;; ̀org-with-limited-levels'
|
||||
(defun org-promote ()
|
||||
"Promote the current heading higher up the tree.
|
||||
If the region is active in `transient-mark-mode', promote all headings
|
||||
@ -10323,6 +10324,7 @@ Functions in this hook must return t if they identify and follow
|
||||
a link at point. If they don't find anything interesting at point,
|
||||
they must return nil.")
|
||||
|
||||
(defvar org-link-search-inhibit-query nil) ;; dynamically scoped
|
||||
(defvar clean-buffer-list-kill-buffer-names) ; Defined in midnight.el
|
||||
(defun org-open-at-point (&optional arg reference-buffer)
|
||||
"Open link at or after point.
|
||||
@ -10685,7 +10687,6 @@ the window configuration before `org-open-at-point' was called using:
|
||||
|
||||
(set-window-configuration org-window-config-before-follow-link)")
|
||||
|
||||
(defvar org-link-search-inhibit-query nil) ;; dynamically scoped
|
||||
(defun org-link-search (s &optional type avoid-pos stealth)
|
||||
"Search for a link search option.
|
||||
If S is surrounded by forward slashes, it is interpreted as a
|
||||
@ -13095,6 +13096,9 @@ nil."
|
||||
(delete-region (point-at-bol)
|
||||
(min (point-max) (1+ (point-at-eol))))))))))
|
||||
|
||||
(defvar org-time-was-given) ; dynamically scoped parameter
|
||||
(defvar org-end-time-was-given) ; dynamically scoped parameter
|
||||
|
||||
(defun org-add-planning-info (what &optional time &rest remove)
|
||||
"Insert new timestamp with keyword in the line directly after the headline.
|
||||
WHAT indicates what kind of time stamp to add. TIME indicates the time to use.
|
||||
@ -16010,8 +16014,6 @@ Return the position where this entry starts, or nil if there is no such entry."
|
||||
(defvar org-last-changed-timestamp nil)
|
||||
(defvar org-last-inserted-timestamp nil
|
||||
"The last time stamp inserted with `org-insert-time-stamp'.")
|
||||
(defvar org-time-was-given) ; dynamically scoped parameter
|
||||
(defvar org-end-time-was-given) ; dynamically scoped parameter
|
||||
(defvar org-ts-what) ; dynamically scoped parameter
|
||||
|
||||
(defun org-time-stamp (arg &optional inactive)
|
||||
@ -16200,6 +16202,10 @@ So these are more for recording a certain time/date."
|
||||
map)
|
||||
"Keymap for minibuffer commands when using `org-read-date'.")
|
||||
|
||||
(defvar org-def)
|
||||
(defvar org-defdecode)
|
||||
(defvar org-with-time)
|
||||
|
||||
(defun org-read-date (&optional org-with-time to-time from-string prompt
|
||||
default-time default-input inactive)
|
||||
"Read a date, possibly a time, and make things smooth for the user.
|
||||
@ -16346,9 +16352,6 @@ user."
|
||||
(nth 2 final) (nth 1 final))
|
||||
(format "%04d-%02d-%02d" (nth 5 final) (nth 4 final) (nth 3 final))))))
|
||||
|
||||
(defvar org-def)
|
||||
(defvar org-defdecode)
|
||||
(defvar org-with-time)
|
||||
(defun org-read-date-display ()
|
||||
"Display the current date prompt interpretation in the minibuffer."
|
||||
(when org-read-date-display-live
|
||||
|
@ -1,10 +1,12 @@
|
||||
;;; ox-ascii.el --- ASCII Back-End for Org Export Engine
|
||||
|
||||
;; Copyright (C) 2012, 2013 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2012-2013 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Nicolas Goaziou <n.goaziou at gmail dot com>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs is free software: you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
|
@ -1,11 +1,13 @@
|
||||
;;; ox-beamer.el --- Beamer Back-End for Org Export Engine
|
||||
|
||||
;; Copyright (C) 2007-2013 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2007-2013 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Carsten Dominik <carsten.dominik AT gmail DOT com>
|
||||
;; Nicolas Goaziou <n.goaziou AT gmail DOT com>
|
||||
;; Keywords: org, wp, tex
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs is free software: you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
|
@ -1,11 +1,13 @@
|
||||
;;; ox-html.el --- HTML Back-End for Org Export Engine
|
||||
|
||||
;; Copyright (C) 2011-2013 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2011-2013 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Carsten Dominik <carsten at orgmode dot org>
|
||||
;; Jambunathan K <kjambunathan at gmail dot com>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs is free software: you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
@ -185,7 +187,7 @@ the headline itself.")
|
||||
@licstart The following is the entire license notice for the
|
||||
JavaScript code in this tag.
|
||||
|
||||
Copyright (C) 2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012-2013 Free Software Foundation, Inc.
|
||||
|
||||
The JavaScript code in this tag is free software: you can
|
||||
redistribute it and/or modify it under the terms of the GNU
|
||||
@ -382,7 +384,7 @@ means to use the maximum value consistent with other options."
|
||||
* @licstart The following is the entire license notice for the
|
||||
* JavaScript code in %SCRIPT_PATH.
|
||||
*
|
||||
* Copyright (C) 2012-2013 Sebastian Rose
|
||||
* Copyright (C) 2012-2013 Free Software Foundation, Inc.
|
||||
*
|
||||
*
|
||||
* The JavaScript code in this tag is free software: you can
|
||||
|
@ -1,12 +1,14 @@
|
||||
;;; ox-icalendar.el --- iCalendar Back-End for Org Export Engine
|
||||
|
||||
;; Copyright (C) 2004-2012 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2004-2013 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Carsten Dominik <carsten at orgmode dot org>
|
||||
;; Nicolas Goaziou <n dot goaziou at gmail dot com>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Homepage: http://orgmode.org
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs is free software: you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
|
@ -5,6 +5,8 @@
|
||||
;; Author: Nicolas Goaziou <n.goaziou at gmail dot com>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs is free software: you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
|
@ -1,10 +1,12 @@
|
||||
;;; ox-md.el --- Markdown Back-End for Org Export Engine
|
||||
|
||||
;; Copyright (C) 2012, 2013 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2012-2013 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Nicolas Goaziou <n.goaziou@gmail.com>
|
||||
;; Keywords: org, wp, markdown
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs is free software: you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
|
@ -3126,12 +3126,11 @@ and prefix with \"OrgSrc\". For example,
|
||||
`font-lock-function-name-face' is associated with
|
||||
\"OrgSrcFontLockFunctionNameFace\"."
|
||||
(let* ((css-list (hfy-face-to-style fn))
|
||||
(style-name ((lambda (fn)
|
||||
(concat "OrgSrc"
|
||||
(mapconcat
|
||||
'capitalize (split-string
|
||||
(hfy-face-or-def-to-name fn) "-")
|
||||
""))) fn))
|
||||
(style-name (concat "OrgSrc"
|
||||
(mapconcat
|
||||
'capitalize (split-string
|
||||
(hfy-face-or-def-to-name fn) "-")
|
||||
"")))
|
||||
(color-val (cdr (assoc "color" css-list)))
|
||||
(background-color-val (cdr (assoc "background" css-list)))
|
||||
(style (and org-odt-create-custom-styles-for-srcblocks
|
||||
|
@ -1,10 +1,12 @@
|
||||
;;; ox-org.el --- Org Back-End for Org Export Engine
|
||||
|
||||
;; Copyright (C) 2013 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2013 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Nicolas Goaziou <n.goaziou@gmail.com>
|
||||
;; Keywords: org, wp
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs is free software: you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
|
@ -1,6 +1,6 @@
|
||||
;;; ox-texinfo.el --- Texinfo Back-End for Org Export Engine
|
||||
|
||||
;; Copyright (C) 2012, 2013 Jonathan Leech-Pepin
|
||||
;; Copyright (C) 2012-2013 Free Software Foundation, Inc.
|
||||
;; Author: Jonathan Leech-Pepin <jonathan.leechpepin at gmail dot com>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
|
||||
|
@ -1,10 +1,12 @@
|
||||
;;; ox.el --- Generic Export Engine for Org Mode
|
||||
|
||||
;; Copyright (C) 2012, 2013 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2012-2013 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Nicolas Goaziou <n.goaziou at gmail dot com>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs is free software: you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
|
Loading…
Reference in New Issue
Block a user