emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* bug#26467: 25.2; [Org mode] Call dot babel from elisp generate invalid image
       [not found] <CAG8dOtnen=BG8c3u8ouQTXcEy=oqFUHyHRNtA81rCFxun6vfaQ@mail.gmail.com>
@ 2017-04-12 19:14 ` Glenn Morris
  2018-04-15  7:59 ` Nicolas Goaziou
  1 sibling, 0 replies; 3+ messages in thread
From: Glenn Morris @ 2017-04-12 19:14 UTC (permalink / raw)
  To: 26467; +Cc: wang jinjian


Reassigned to org-mode.

wang jinjian wrote:

> Use case is call dot babel from elisp code block. refer to
> http://orgmode.org/worg/org-tutorials/org-dot-diagrams.html
>
> Below is a more minimal example:
>
> #+NAME: nodes
> | From | To | Weight |
> |------+----+--------|
> | A    | B  |      3 |
> | A    | C  |      2 |
> | B    | D  |      4 |
> | B    | E  |      5 |
> | C    | F  |     10 |
>
> #+BEGIN_SRC elisp :file a.png :var nodes=nodes
>     (defun rowfun(x)
>         (format "%s -> %s [label=%s];" (nth 0 x) (nth 1 x) (nth 2 x))
>         )
>       (defun dotgen(nodes)
>         (let ((dotbegin "digraph {\nnode [shape=circle]\n")
>               (dotend "\n}"))
>           (concat dotbegin
>                   (mapconcat #'rowfun nodes "\n")
>                   dotend)))
> (setq params (nth 2 (org-babel-get-src-block-info)))
>   (org-babel-execute:dot (dotgen nodes) params)
> #+END_SRC
>
> If run this block with C-c C-c, it will generate a image a.png with
> "nil" string in it. so it's a invalid image file.
>
> The issue is introduced by below commit:
>
> 041ca4b6f ob-core: Do not return results on writing to file
>
> After revert this commit, it works fine. Sounds like this change will
> cause the function return "nil" string but not nil variable.
>
> Another probelm is the params variable is void in org 9.0.5. but we can
> replace it with (nth 2 (org-babel-get-src-block-info)) as my example
> code.
>
> BRs
> J.J. Wang
>
> In GNU Emacs 25.2.1 (x86_64-apple-darwin16.0.0, NS appkit-1504.00 Version
> 10.12 (Build 16A323))
> of 2017-04-03 built on e12714-mac01
> Windowing system distributor 'Apple', version 10.3.1504
> Configured using:
> 'configure --disable-dependency-tracking --disable-silent-rules
> --enable-locallisppath=/usr/local/share/emacs/site-lisp
> --infodir=/usr/local/Cellar/emacs/25.2-rc2/share/info/emacs
> --prefix=/usr/local/Cellar/emacs/25.2-rc2 --without-x --with-xml2
> --with-dbus --with-gnutls --with-imagemagick --with-rsvg --without-pop
> --with-ns --disable-ns-self-contained'
>
> Configured features:
> JPEG RSVG IMAGEMAGICK DBUS NOTIFY ACL GNUTLS LIBXML2 ZLIB
> TOOLKIT_SCROLL_BARS NS
>
> Important settings:
>   value of $LC_CTYPE: en_US.UTF-8
>   value of $LANG: en_US.UTF-8
>   locale-coding-system: utf-8-unix
>
> Major mode: Org
>
> Minor modes in effect:
>   diff-auto-refine-mode: t
>   org-indent-mode: t
>   helm-mode: t
>   shell-dirtrack-mode: t
>   async-bytecomp-package-mode: t
>   yas-global-mode: t
>   yas-minor-mode: t
>   global-company-mode: t
>   company-mode: t
>   override-global-mode: t
>   show-paren-mode: t
>   tooltip-mode: t
>   global-eldoc-mode: t
>   electric-indent-mode: t
>   mouse-wheel-mode: t
>   file-name-shadow-mode: t
>   global-font-lock-mode: t
>   font-lock-mode: t
>   blink-cursor-mode: t
>   auto-composition-mode: t
>   auto-encryption-mode: t
>   auto-compression-mode: t
>   line-number-mode: t
>   auto-fill-function: yas--auto-fill
>   transient-mark-mode: t
>
> Recent messages:
> Code block evaluation complete.
> Edebug: org-babel-result-cond
> org-babel-result-cond
> executing Elisp code block...
>
> (nodes (quote (("A" "B" 3) ("A" "C" 2) ("B" "D" 4) ("B" "E" 5) ("C" "F"
> 10))))
>
> Wrote
> /var/folders/r0/58rd7gbs3pz3gsj48zdv8pwn00n31m/T/babel-30327L5l/ob-input-30327wiQ
> Code block evaluation complete.
> Mark set [2 times]
> Quit
>
> Load-path shadows:
> ~/.emacs.d/modules/org-mode/lisp/ox hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ox
> ~/.emacs.d/modules/org-mode/lisp/ox-texinfo hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ox-texinfo
> ~/.emacs.d/modules/org-mode/lisp/ox-publish hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ox-publish
> ~/.emacs.d/modules/org-mode/lisp/ox-org hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ox-org
> ~/.emacs.d/modules/org-mode/lisp/ox-odt hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ox-odt
> ~/.emacs.d/modules/org-mode/lisp/ox-md hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ox-md
> ~/.emacs.d/modules/org-mode/lisp/ox-man hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ox-man
> ~/.emacs.d/modules/org-mode/lisp/ox-latex hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ox-latex
> ~/.emacs.d/modules/org-mode/lisp/ox-icalendar hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ox-icalendar
> ~/.emacs.d/modules/org-mode/lisp/ox-html hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ox-html
> ~/.emacs.d/modules/org-mode/lisp/ox-beamer hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ox-beamer
> ~/.emacs.d/modules/org-mode/lisp/ox-ascii hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ox-ascii
> ~/.emacs.d/modules/org-mode/lisp/org hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/org
> ~/.emacs.d/modules/org-mode/lisp/org-w3m hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/org-w3m
> ~/.emacs.d/modules/org-mode/lisp/org-version hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/org-version
> ~/.emacs.d/modules/org-mode/lisp/org-timer hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/org-timer
> ~/.emacs.d/modules/org-mode/lisp/org-table hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/org-table
> ~/.emacs.d/modules/org-mode/lisp/org-src hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/org-src
> ~/.emacs.d/modules/org-mode/lisp/org-rmail hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/org-rmail
> ~/.emacs.d/modules/org-mode/lisp/org-protocol hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/org-protocol
> ~/.emacs.d/modules/org-mode/lisp/org-plot hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/org-plot
> ~/.emacs.d/modules/org-mode/lisp/org-pcomplete hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/org-pcomplete
> ~/.emacs.d/modules/org-mode/lisp/org-mouse hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/org-mouse
> ~/.emacs.d/modules/org-mode/lisp/org-mobile hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/org-mobile
> ~/.emacs.d/modules/org-mode/lisp/org-mhe hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/org-mhe
> ~/.emacs.d/modules/org-mode/lisp/org-macs hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/org-macs
> ~/.emacs.d/modules/org-mode/lisp/org-macro hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/org-macro
> ~/.emacs.d/modules/org-mode/lisp/org-loaddefs hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/org-loaddefs
> ~/.emacs.d/modules/org-mode/lisp/org-list hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/org-list
> ~/.emacs.d/modules/org-mode/lisp/org-irc hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/org-irc
> ~/.emacs.d/modules/org-mode/lisp/org-install hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/org-install
> ~/.emacs.d/modules/org-mode/lisp/org-inlinetask hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/org-inlinetask
> ~/.emacs.d/modules/org-mode/lisp/org-info hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/org-info
> ~/.emacs.d/modules/org-mode/lisp/org-indent hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/org-indent
> ~/.emacs.d/modules/org-mode/lisp/org-id hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/org-id
> ~/.emacs.d/modules/org-mode/lisp/org-habit hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/org-habit
> ~/.emacs.d/modules/org-mode/lisp/org-gnus hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/org-gnus
> ~/.emacs.d/modules/org-mode/lisp/org-footnote hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/org-footnote
> ~/.emacs.d/modules/org-mode/lisp/org-feed hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/org-feed
> ~/.emacs.d/modules/org-mode/lisp/org-faces hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/org-faces
> ~/.emacs.d/modules/org-mode/lisp/org-eshell hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/org-eshell
> ~/.emacs.d/modules/org-mode/lisp/org-entities hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/org-entities
> ~/.emacs.d/modules/org-mode/lisp/org-element hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/org-element
> ~/.emacs.d/modules/org-mode/lisp/org-docview hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/org-docview
> ~/.emacs.d/modules/org-mode/lisp/org-datetree hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/org-datetree
> ~/.emacs.d/modules/org-mode/lisp/org-ctags hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/org-ctags
> ~/.emacs.d/modules/org-mode/lisp/org-crypt hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/org-crypt
> ~/.emacs.d/modules/org-mode/lisp/org-compat hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/org-compat
> ~/.emacs.d/modules/org-mode/lisp/org-colview hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/org-colview
> ~/.emacs.d/modules/org-mode/lisp/org-clock hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/org-clock
> ~/.emacs.d/modules/org-mode/lisp/org-capture hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/org-capture
> ~/.emacs.d/modules/org-mode/lisp/org-bibtex hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/org-bibtex
> ~/.emacs.d/modules/org-mode/lisp/org-bbdb hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/org-bbdb
> ~/.emacs.d/modules/org-mode/lisp/org-attach hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/org-attach
> ~/.emacs.d/modules/org-mode/lisp/org-archive hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/org-archive
> ~/.emacs.d/modules/org-mode/lisp/org-agenda hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/org-agenda
> ~/.emacs.d/modules/org-mode/lisp/ob hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob
> ~/.emacs.d/modules/org-mode/lisp/ob-tangle hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob-tangle
> ~/.emacs.d/modules/org-mode/lisp/ob-table hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob-table
> ~/.emacs.d/modules/org-mode/lisp/ob-sqlite hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob-sqlite
> ~/.emacs.d/modules/org-mode/lisp/ob-sql hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob-sql
> ~/.emacs.d/modules/org-mode/lisp/ob-shen hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob-shen
> ~/.emacs.d/modules/org-mode/lisp/ob-screen hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob-screen
> ~/.emacs.d/modules/org-mode/lisp/ob-scheme hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob-scheme
> ~/.emacs.d/modules/org-mode/lisp/ob-scala hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob-scala
> ~/.emacs.d/modules/org-mode/lisp/ob-sass hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob-sass
> ~/.emacs.d/modules/org-mode/lisp/ob-ruby hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob-ruby
> ~/.emacs.d/modules/org-mode/lisp/ob-ref hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob-ref
> ~/.emacs.d/modules/org-mode/lisp/ob-R hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob-R
> ~/.emacs.d/modules/org-mode/lisp/ob-python hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob-python
> ~/.emacs.d/modules/org-mode/lisp/ob-plantuml hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob-plantuml
> ~/.emacs.d/modules/org-mode/lisp/ob-picolisp hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob-picolisp
> ~/.emacs.d/modules/org-mode/lisp/ob-perl hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob-perl
> ~/.emacs.d/modules/org-mode/lisp/ob-org hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob-org
> ~/.emacs.d/modules/org-mode/lisp/ob-octave hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob-octave
> ~/.emacs.d/modules/org-mode/lisp/ob-ocaml hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob-ocaml
> ~/.emacs.d/modules/org-mode/lisp/ob-mscgen hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob-mscgen
> ~/.emacs.d/modules/org-mode/lisp/ob-maxima hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob-maxima
> ~/.emacs.d/modules/org-mode/lisp/ob-matlab hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob-matlab
> ~/.emacs.d/modules/org-mode/lisp/ob-makefile hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob-makefile
> ~/.emacs.d/modules/org-mode/lisp/ob-lob hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob-lob
> ~/.emacs.d/modules/org-mode/lisp/ob-lisp hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob-lisp
> ~/.emacs.d/modules/org-mode/lisp/ob-lilypond hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob-lilypond
> ~/.emacs.d/modules/org-mode/lisp/ob-ledger hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob-ledger
> ~/.emacs.d/modules/org-mode/lisp/ob-latex hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob-latex
> ~/.emacs.d/modules/org-mode/lisp/ob-keys hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob-keys
> ~/.emacs.d/modules/org-mode/lisp/ob-js hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob-js
> ~/.emacs.d/modules/org-mode/lisp/ob-java hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob-java
> ~/.emacs.d/modules/org-mode/lisp/ob-io hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob-io
> ~/.emacs.d/modules/org-mode/lisp/ob-haskell hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob-haskell
> ~/.emacs.d/modules/org-mode/lisp/ob-gnuplot hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob-gnuplot
> ~/.emacs.d/modules/org-mode/lisp/ob-fortran hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob-fortran
> ~/.emacs.d/modules/org-mode/lisp/ob-exp hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob-exp
> ~/.emacs.d/modules/org-mode/lisp/ob-eval hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob-eval
> ~/.emacs.d/modules/org-mode/lisp/ob-emacs-lisp hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob-emacs-lisp
> ~/.emacs.d/modules/org-mode/lisp/ob-dot hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob-dot
> ~/.emacs.d/modules/org-mode/lisp/ob-ditaa hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob-ditaa
> ~/.emacs.d/modules/org-mode/lisp/ob-css hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob-css
> ~/.emacs.d/modules/org-mode/lisp/ob-core hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob-core
> ~/.emacs.d/modules/org-mode/lisp/ob-comint hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob-comint
> ~/.emacs.d/modules/org-mode/lisp/ob-clojure hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob-clojure
> ~/.emacs.d/modules/org-mode/lisp/ob-calc hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob-calc
> ~/.emacs.d/modules/org-mode/lisp/ob-C hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob-C
> ~/.emacs.d/modules/org-mode/lisp/ob-awk hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob-awk
> ~/.emacs.d/modules/org-mode/lisp/ob-asymptote hides
> /usr/local/Cellar/emacs/25.2-rc2/share/emacs/25.2/lisp/org/ob-asymptote
>
> Features:
> (shadow sort mail-extr emacsbug message rfc822 mml mml-sec epg mm-decode
> mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
> sendmail rfc2047 rfc2045 ietf-drums mail-utils ido helm-command
> helm-elisp helm-eval edebug misearch multi-isearch vc-git diff-mode
> winner org-table company-ispell ispell org-indent image-file org-rmail
> org-mhe org-irc org-info org-gnus org-docview doc-view jka-compr
> image-mode org-bibtex bibtex org-bbdb org-w3m company-oddmuse
> company-keywords company-etags etags xref project company-gtags
> company-dabbrev-code company-dabbrev company-files company-capf
> company-cmake company-xcode company-clang company-semantic company-eclim
> company-template company-css company-nxml company-bbdb ob-latex ob-C
> cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine
> cc-vars cc-defs ob-calc calc-store calc-trail calc-ext calc
> calc-loaddefs calc-macs ob-dot ob-plantuml ob-python org-crypt ox-gfm
> ox-md ox-odt rng-loc rng-uri rng-parse rng-match rng-dt rng-util
> rng-pttrn nxml-parse nxml-ns nxml-enc xmltok nxml-util ox-latex
> ox-icalendar ox-html table ox-ascii ox-publish ox org-element avl-tree
> org org-macro org-footnote org-pcomplete org-list org-faces org-entities
> noutline outline org-version ob-emacs-lisp ob ob-tangle org-src ob-ref
> ob-lob ob-table ob-keys ob-exp ob-comint ob-core ob-eval org-compat
> org-macs org-loaddefs find-func cal-menu calendar cal-loaddefs
> setup-helm-gtags helm-gtags subr-x pulse which-func imenu setup-helm
> helm-projectile projectile grep ibuf-ext ibuffer helm-mode helm-files rx
> image-dired tramp tramp-compat tramp-loaddefs trampver shell pcomplete
> format-spec dired-x dired-aux ffap thingatpt helm-buffers helm-elscreen
> helm-tags helm-bookmark helm-adaptive helm-info bookmark pp helm-locate
> helm-external helm-net browse-url xml url url-proxy url-privacy
> url-expand url-methods url-history url-cookie url-domsuf url-util
> url-parse auth-source gnus-util mm-util help-fns mail-prsvr
> password-cache url-vars mailcap helm-types helm-grep helm-regexp
> helm-utils compile comint ansi-color ring helm-help helm helm-source
> eieio-compat eieio eieio-core helm-multi-match helm-config helm-easymenu
> cl-macs async-bytecomp advice async helm-lib dired cl-seq yasnippet
> init-company-mode lazy-set-key company use-package diminish bind-key
> easy-mmode paren manoj-dark-theme misterioso-theme edmacro kmacro
> finder-inf info package epg-config seq byte-opt gv bytecomp byte-compile
> cl-extra help-mode easymenu cconv cl-loaddefs pcase cl-lib time-date
> mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
> lisp-float-type mwheel ns-win ucs-normalize term/common-win tool-bar dnd
> fontset image regexp-opt fringe tabulated-list newcomment elisp-mode
> lisp-mode prog-mode register page menu-bar rfn-eshadow timer select
> scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame
> cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai
> tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian
> slovak czech european ethiopic indian cyrillic chinese charscript
> case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer
> cl-preloaded nadvice loaddefs button faces cus-face macroexp files
> text-properties overlay sha1 md5 base64 format env code-pages mule
> custom widget hashtable-print-readable backquote dbusbind kqueue cocoa
> ns multi-tty make-network-process emacs)
>
> Memory information:
> ((conses 16 550219 22768)
> (symbols 48 48191 0)
> (miscs 40 216 1037)
> (strings 32 125351 17559)
> (string-bytes 1 3803442)
> (vectors 16 73192)
> (vector-slots 8 1151281 9870)
> (floats 8 921 370)
> (intervals 56 1485 323)
> (buffers 976 25))

^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#26467: 25.2; [Org mode] Call dot babel from elisp generate invalid image
       [not found] <CAG8dOtnen=BG8c3u8ouQTXcEy=oqFUHyHRNtA81rCFxun6vfaQ@mail.gmail.com>
  2017-04-12 19:14 ` bug#26467: 25.2; [Org mode] Call dot babel from elisp generate invalid image Glenn Morris
@ 2018-04-15  7:59 ` Nicolas Goaziou
  2018-07-07 11:20   ` Nicolas Goaziou
  1 sibling, 1 reply; 3+ messages in thread
From: Nicolas Goaziou @ 2018-04-15  7:59 UTC (permalink / raw)
  To: wang jinjian; +Cc: 26467

Hello,

wang jinjian <wjj1928@gmail.com> writes:

> Use case is call dot babel from elisp code block. refer to
> http://orgmode.org/worg/org-tutorials/org-dot-diagrams.html
>
> Below is a more minimal example:
>
> #+NAME: nodes
> | From | To | Weight |
>
> |------+----+--------|
> | A    | B  |      3 |
> | A    | C  |      2 |
> | B    | D  |      4 |
> | B    | E  |      5 |
> | C    | F  |     10 |
>
> #+BEGIN_SRC elisp :file a.png :var nodes=nodes
>     (defun rowfun(x)
>         (format "%s -> %s [label=%s];" (nth 0 x) (nth 1 x) (nth 2 x))
>         )
>       (defun dotgen(nodes)
>         (let ((dotbegin "digraph {\nnode [shape=circle]\n")
>               (dotend "\n}"))
>           (concat dotbegin
>                   (mapconcat #'rowfun nodes "\n")
>                   dotend)))
> (setq params (nth 2 (org-babel-get-src-block-info)))
>   (org-babel-execute:dot (dotgen nodes) params)
> #+END_SRC
>
> If run this block with C-c C-c, it will generate a image a.png with
> "nil" string in it. so it's a invalid image file.

I can achieve the desired effect with:

    #+name: nodes
    | From | To | Weight |
    |------+----+--------|
    | A    | B  |      3 |
    | A    | C  |      2 |
    | B    | D  |      4 |
    | B    | E  |      5 |
    | C    | F  |     10 |

    #+begin_src elisp :file /tmp/a.png :var nodes=nodes :results file
    (defun rowfun (x)
      (format "%s -> %s [label=%s];" (nth 0 x) (nth 1 x) (nth 2 x)))
    (defun dotgen (nodes)
      (format "digraph {\nnode [shape=circle]\n%s\n}"
              (mapconcat #'rowfun nodes "\n")))
    (dotgen nodes)
    #+end_src

I don't see why you would need to call `org-babel-execute:dot'.

Does it fix your issue?

Regards,

-- 
Nicolas Goaziou                                                0x80A93738

^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#26467: 25.2; [Org mode] Call dot babel from elisp generate invalid image
  2018-04-15  7:59 ` Nicolas Goaziou
@ 2018-07-07 11:20   ` Nicolas Goaziou
  0 siblings, 0 replies; 3+ messages in thread
From: Nicolas Goaziou @ 2018-07-07 11:20 UTC (permalink / raw)
  To: wang jinjian; +Cc: 26467-done

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> I can achieve the desired effect with:
>
>     #+name: nodes
>     | From | To | Weight |
>     |------+----+--------|
>     | A    | B  |      3 |
>     | A    | C  |      2 |
>     | B    | D  |      4 |
>     | B    | E  |      5 |
>     | C    | F  |     10 |
>
>     #+begin_src elisp :file /tmp/a.png :var nodes=nodes :results file
>     (defun rowfun (x)
>       (format "%s -> %s [label=%s];" (nth 0 x) (nth 1 x) (nth 2 x)))
>     (defun dotgen (nodes)
>       (format "digraph {\nnode [shape=circle]\n%s\n}"
>               (mapconcat #'rowfun nodes "\n")))
>     (dotgen nodes)
>     #+end_src
>
> I don't see why you would need to call `org-babel-execute:dot'.
>
> Does it fix your issue?

Since the OP didn't answer, I assume this is now fixed.

I'm closing this report.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-07-07 11:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CAG8dOtnen=BG8c3u8ouQTXcEy=oqFUHyHRNtA81rCFxun6vfaQ@mail.gmail.com>
2017-04-12 19:14 ` bug#26467: 25.2; [Org mode] Call dot babel from elisp generate invalid image Glenn Morris
2018-04-15  7:59 ` Nicolas Goaziou
2018-07-07 11:20   ` Nicolas Goaziou

Code repositories for project(s) associated with this inbox:

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).