[OS X Emacs] Babel Help in Org 9

John Hutcheson hutchj at charter.net
Sat Sep 9 15:34:22 EDT 2017


I’ve been using an embedded lisp program for some time to produce Dot charts using org.  The code has saved me hours of fiddle time and is much easier to use than writing dot code due to the tabular format of the input data.  But with the arrival of org 9.0, the code no longer works.  I’ve read what I could find, but haven’t been able to get this into the right format for org 9.  Can someone please help?  I’ve got some experience with coding (not elisp), but don’t find the manual to be very helpful in this instance.  I believe the problem is the way the code is being called, not the lisp source code itself.  But can’t be sure.

Cutting and pasting the text below into an org document under version 8 works well.  In org 9 I get a backtrace complaining about (void-variable params), which I can provide if it would help with the troubles-shooting.

Thanks in advance for your time.


Here’s the text to make the org doc - cut and paste everything below into an org doc and then put cursor on the #+call line and hit C-c twice.:

This code uses Dot's dot program to generate this chart.
Mark up the tables below to describe the nodes and connections you
want for this flowchart.  Do a query replace for "flowchart.png" with
the name of the file you want to create. Do a query replace for the text "NAMI Dues Flowchart" using the new title. Then hit C-c C-c to create the new flowchart.  You can see it by clicking on the link created immediately below the call line. Change the horiz value from 'nil to 't to switch from vertical to horizontal orientation of the flow chart.

#+name: nodetable
| node  | label                      | shape     | fillcolor  |
|-------+----------------------------+-----------+------------|
| start | Start                      | oval      | yellow     |
| which | Which Membership?          | diamond   | aliceblue  |
| open  | Open Door Membership - $35 | box       | aquamarine |
| stnd  | Standard Membership - $3   | box       | crimson    |
| nno   | Nami National Dues - $1    | ellipsoid | grey       |
| sno   | NAMI State Dues - $1       | ellipsoid | grey       |
| nmo   | NAMI Midland - $1          | ellipsoid | grey       |
| nns   | NAMI National Dues - $10   | ellipsoid | grey       |
| sns   | NAMI State Dues - $12.50   | ellipsoid | grey       |
| nms   | NAMI Midland Dues - $12.50 | ellipsoid | grey       |


#+name: connectortable
| from  | to    | label | color | linestyle |
|-------+-------+-------+-------+-----------|
| start | which |       | grey  |           |
| which | open  |       |       | dashed    |
| open  | nno   |       |       | dashed    |
| open  | sno   |       |       | dashed    |
| open  | nmo   |       |       | dashed    |
| stnd  | nns   |       |       |           |
| stnd  | sns   |       |       |           |
| stnd  | nms   |       |       |           |

#+call: hutchdotdigraph[:file ~/documents/emacsdocs/NAMIDuesflowchart.png](nodes=nodetable[1:-1],graph=connectortable[1:-1],horiz='nil) :results file

#+RESULTS:
[[file:~/documents/emacsdocs/NAMIDuesflowchart.png]]

#+name: hutchdotdigraph
#+HEADER: :var nodes=nodetable[2:-1] graph=connectortable[2:-1] horiz='nil
#+BEGIN_SRC emacs-lisp :file ~/documents/emacsdocs/hutchdotout.png :colnames yes :exports results :cmd dot
;(defun hutchdot ()
;  " Run code to produce dot grphs from tables following the graph-from-tables code tutorial"
(org-babel-execute:dot
(concat
"graph {\n"
;"//rankdir=LR;\n"
"label=\"NAMI Dues Flowchart\";\n"
"labelloc=t;\n"
(when horiz "rankdir=LR;\n")
(mapconcat
(lambda (x)
(format "%s [label=\"%s\" shape = %s style=\"filled\" fillcolor=\"%s\"]"

(car x)
(nth 1 x)
(if (string="" (nth 2 x)) "box" (nth 2 x))
(if (string="" (nth 3 x)) "none" (nth 3 x))
)) nodes "\n")
"\n"
(mapconcat
(lambda (x)
(format "%s -- %s [label=\"%s\" color=\"%s\" style=\"%s\"]"
(car x) (nth 1 x) (nth 2 x) (nth 3 x) (nth 4 x))) graph "\n")
"}\n") params)

#+END_SRC



      John Hutcheson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://email.esm.psu.edu/pipermail/macosx-emacs/attachments/20170909/a477a9a5/attachment.html>


More information about the MacOSX-Emacs mailing list