From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Thomas S. Dye" Subject: [PATCH] Addition to Library of Babel Date: Thu, 11 Nov 2010 10:50:18 -1000 Message-ID: <92DBEE47-51F6-40CE-8CC4-56AB069E963F@tsdye.com> Mime-Version: 1.0 (Apple Message framework v936) Content-Type: multipart/mixed; boundary="===============1830702186==" Return-path: Received: from [140.186.70.92] (port=48933 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PGe6M-0001cr-US for emacs-orgmode@gnu.org; Thu, 11 Nov 2010 15:50:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PGe6L-0002BL-0f for emacs-orgmode@gnu.org; Thu, 11 Nov 2010 15:50:34 -0500 Received: from oproxy1-pub.bluehost.com ([66.147.249.253]:46224) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1PGe6K-0002BB-Mp for emacs-orgmode@gnu.org; Thu, 11 Nov 2010 15:50:32 -0500 Received: from cpe-66-91-68-127.hawaii.res.rr.com ([66.91.68.127] helo=[192.168.1.4]) by box472.bluehost.com with esmtpa (Exim 4.69) (envelope-from ) id 1PGe6F-0000lP-V9 for emacs-orgmode@gnu.org; Thu, 11 Nov 2010 13:50:28 -0700 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Emacs Org mode mailing list --===============1830702186== Content-Type: multipart/alternative; boundary=Apple-Mail-22--183710710 --Apple-Mail-22--183710710 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Add Eric Fraga's GANTT chart code to the Library of Babel. Thomas S. Dye, Ph.D. T. S. Dye & Colleagues, Archaeologists, Inc. Phone: (808) 529-0866 Fax: (808) 529-0884 http://www.tsdye.com --Apple-Mail-22--183710710 Content-Type: multipart/mixed; boundary=Apple-Mail-23--183710710 --Apple-Mail-23--183710710 Content-Type: text/html; charset=US-ASCII Content-Transfer-Encoding: 7bit Add Eric Fraga's GANTT chart code to the Library of Babel.

--Apple-Mail-23--183710710 Content-Disposition: attachment; filename=gantt.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="gantt.patch" Content-Transfer-Encoding: 7bit Changes from master to gantt Modified contrib/babel/library-of-babel.org diff --git a/contrib/babel/library-of-babel.org b/contrib/babel/library-of-babel.org index 07c40aa..0f2173e 100644 --- a/contrib/babel/library-of-babel.org +++ b/contrib/babel/library-of-babel.org @@ -286,11 +286,98 @@ 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 +(defun esf/generate-gantt-chart (table) + (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) + ) + ) +(esf/generate-gantt-chart table) +#+end_src --Apple-Mail-23--183710710 Content-Type: text/html; charset=US-ASCII Content-Transfer-Encoding: quoted-printable

=

Thomas S. Dye, Ph.D.

T. S. Dye & Colleagues, = Archaeologists, Inc.

Phone: (808) 529-0866 Fax: (808) 529-0884

=

= --Apple-Mail-23--183710710-- --Apple-Mail-22--183710710-- --===============1830702186== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --===============1830702186==--