Merge branch 'master' of git+ssh://repo.or.cz/srv/git/org-mode
This commit is contained in:
commit
0766085d9a
1
Makefile
1
Makefile
|
@ -125,6 +125,7 @@ LISPF = org.el \
|
|||
ob-eval.el \
|
||||
ob-keys.el \
|
||||
ob-C.el \
|
||||
ob-calc.el \
|
||||
ob-ditaa.el \
|
||||
ob-haskell.el \
|
||||
ob-perl.el \
|
||||
|
|
|
@ -286,11 +286,85 @@ are optional.
|
|||
#+begin_src python
|
||||
a
|
||||
#+end_src
|
||||
|
||||
#+srcname: python-add(a=1, b=2)
|
||||
#+begin_src python
|
||||
a + b
|
||||
#+end_src
|
||||
* GANTT Charts
|
||||
|
||||
|
||||
|
||||
The =elispgantt= source block was sent to the mailing list by Eric
|
||||
Fraga. It was modified slightly by Tom Dye.
|
||||
|
||||
#+source: elispgantt
|
||||
#+begin_src emacs-lisp :var table=gantttest
|
||||
(let ((dates "")
|
||||
(entries (nthcdr 2 table))
|
||||
(milestones "")
|
||||
(nmilestones 0)
|
||||
(ntasks 0)
|
||||
(projecttime 0)
|
||||
(tasks "")
|
||||
(xlength 1))
|
||||
(message "Initial: %s\n" table)
|
||||
(message "Entries: %s\n" entries)
|
||||
(while entries
|
||||
(let ((entry (first entries)))
|
||||
(if (listp entry)
|
||||
(let ((id (first entry))
|
||||
(type (nth 1 entry))
|
||||
(label (nth 2 entry))
|
||||
(task (nth 3 entry))
|
||||
(dependencies (nth 4 entry))
|
||||
(start (nth 5 entry))
|
||||
(duration (nth 6 entry))
|
||||
(end (nth 7 entry))
|
||||
(alignment (nth 8 entry)))
|
||||
(if (> start projecttime) (setq projecttime start))
|
||||
(if (string= type "task")
|
||||
(let ((end (+ start duration))
|
||||
(textposition (+ start (/ duration 2)))
|
||||
(flush ""))
|
||||
(if (string= alignment "left")
|
||||
(progn
|
||||
(setq textposition start)
|
||||
(setq flush "[left]"))
|
||||
(if (string= alignment "right")
|
||||
(progn
|
||||
(setq textposition end)
|
||||
(setq flush "[right]"))))
|
||||
(setq tasks
|
||||
(format "%s \\gantttask{%s}{%s}{%d}{%d}{%d}{%s}\n"
|
||||
tasks label task start end textposition flush))
|
||||
(setq ntasks (+ 1 ntasks))
|
||||
(if (> end projecttime)
|
||||
(setq projecttime end)))
|
||||
(if (string= type "milestone")
|
||||
(progn
|
||||
(setq milestones
|
||||
(format
|
||||
"%s \\ganttmilestone{$\\begin{array}{c}\\mbox{%s}\\\\ \\mbox{%s}\\end{array}$}{%d}\n"
|
||||
milestones label task start))
|
||||
(setq nmilestones (+ 1 nmilestones)))
|
||||
(if (string= type "date")
|
||||
(setq dates (format "%s \\ganttdateline{%s}{%d}\n"
|
||||
dates label start))
|
||||
(message "Ignoring entry with type %s\n" type)))))
|
||||
(message "Ignoring non-list entry %s\n" entry)) ; end if list entry
|
||||
(setq entries (cdr entries)))) ; end while entries left
|
||||
(format "\\pgfdeclarelayer{background}
|
||||
\\pgfdeclarelayer{foreground}
|
||||
\\pgfsetlayers{background,foreground}
|
||||
\\renewcommand{\\ganttprojecttime}{%d}
|
||||
\\renewcommand{\\ganttntasks}{%d}
|
||||
\\noindent
|
||||
\\begin{tikzpicture}[y=-0.75cm,x=0.75\\textwidth]
|
||||
\\begin{pgfonlayer}{background}
|
||||
\\draw[very thin, red!10!white] (0,1+\\ganttntasks) grid [ystep=0.75cm,xstep=1/\\ganttprojecttime] (1,0);
|
||||
\\draw[\\ganttdatelinecolour] (0,0) -- (1,0);
|
||||
\\draw[\\ganttdatelinecolour] (0,1+\\ganttntasks) -- (1,1+\\ganttntasks);
|
||||
\\end{pgfonlayer}
|
||||
%s
|
||||
%s
|
||||
%s
|
||||
\\end{tikzpicture}" projecttime ntasks tasks milestones dates))
|
||||
#+end_src
|
||||
|
|
|
@ -40,6 +40,8 @@
|
|||
|
||||
(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)))
|
||||
|
@ -48,7 +50,7 @@
|
|||
(calc-push-list (list (cdr pair)))
|
||||
(calc-store-into (car pair)))
|
||||
vars)
|
||||
(mapcar
|
||||
(mapc
|
||||
(lambda (line)
|
||||
(when (> (length line) 0)
|
||||
(cond
|
||||
|
@ -80,13 +82,13 @@
|
|||
(calc-pop 1)))
|
||||
el))
|
||||
;; parse line into calc objects
|
||||
(first (math-read-exprs line))))))))
|
||||
(car (math-read-exprs line))))))))
|
||||
(calc-eval line))))))))
|
||||
(mapcar #'org-babel-trim
|
||||
(split-string (org-babel-expand-body:calc body params) "[\n\r]"))))
|
||||
(save-excursion
|
||||
(set-buffer (get-buffer "*Calculator*"))
|
||||
(calc-eval (calc-top 1))))
|
||||
(with-current-buffer (get-buffer "*Calculator*")
|
||||
(calc-eval (calc-top 1)))))
|
||||
|
||||
(provide 'ob-calc)
|
||||
|
||||
|
|
|
@ -41,13 +41,18 @@
|
|||
(require 'ob-ref)
|
||||
(require 'ob-comint)
|
||||
(require 'ob-eval)
|
||||
(require 'slime)
|
||||
|
||||
(declare-function slime-eval "ext:slime" (sexp &optional package))
|
||||
(declare-function slime-process "ext:slime" (&optional connection))
|
||||
(declare-function slime-connected-p "ext:slime" ())
|
||||
|
||||
(defvar org-babel-default-header-args:lisp '()
|
||||
"Default header arguments for lisp code blocks.")
|
||||
|
||||
(defcustom org-babel-lisp-cmd "sbcl --script"
|
||||
"Name of command used to evaluate lisp blocks.")
|
||||
"Name of command used to evaluate lisp blocks."
|
||||
:group 'org-babel
|
||||
:type 'string)
|
||||
|
||||
(defun org-babel-expand-body:lisp (body params)
|
||||
"Expand BODY according to PARAMS, return the expanded body."
|
||||
|
@ -63,6 +68,7 @@
|
|||
(defun org-babel-execute:lisp (body params)
|
||||
"Execute a block of Lisp code with org-babel.
|
||||
This function is called by `org-babel-execute-src-block'"
|
||||
(require 'slime)
|
||||
(message "executing Lisp source code block")
|
||||
(let* ((session (org-babel-lisp-initiate-session
|
||||
(cdr (assoc :session params))))
|
||||
|
@ -94,6 +100,7 @@ This function is called by `org-babel-execute-src-block'"
|
|||
(defun org-babel-lisp-initiate-session (&optional session)
|
||||
"If there is not a current inferior-process-buffer in SESSION
|
||||
then create. Return the initialized session."
|
||||
(require 'slime)
|
||||
(unless (string= session "none")
|
||||
(save-window-excursion
|
||||
(or (slime-connected-p)
|
||||
|
|
|
@ -201,9 +201,6 @@ which defaults to the value of `org-export-blocks-witheld'."
|
|||
(interblock start (point-max))
|
||||
(run-hooks 'org-export-blocks-postblock-hook)))))
|
||||
|
||||
(add-hook 'org-export-preprocess-after-include-files-hook
|
||||
'org-export-blocks-preprocess)
|
||||
|
||||
;;================================================================================
|
||||
;; type specific functions
|
||||
|
||||
|
|
|
@ -1080,6 +1080,9 @@ on this string to produce the exported version."
|
|||
;; Mark end of lists
|
||||
(org-export-mark-list-ending backend)
|
||||
|
||||
;; Export code blocks
|
||||
(org-export-blocks-preprocess)
|
||||
|
||||
;; Handle source code snippets
|
||||
(org-export-replace-src-segments-and-examples backend)
|
||||
|
||||
|
|
Loading…
Reference in New Issue