emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Daniel Gonzalez <gonvaled@gonvaled.com>
To: emacs-orgmode@gnu.org
Subject: Bug: Problems with integration between asmyptote and org mode [7.7]
Date: Wed, 10 Aug 2011 11:08:05 +0200	[thread overview]
Message-ID: <CAAOi-OEicmEgbmyMGKqty86MbvD1sC0veoGT+OA10X9o4Ruffg@mail.gmail.com> (raw)

Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See
     http://orgmode.org/manual/Feedback.html#Feedback
Your bug report will be posted to the Org-mode mailing list.
------------------------------------------------------------------------
I have this code to activate asymptote:
; Activate asymptote
(setq org-export-blocks
      (cons '(asy org-export-blocks-format-asy) org-export-blocks))
(defun org-export-blocks-format-asy (body &rest headers)
  "Pass block BODY to the asy utility creating an image.
Specify the path at which the image should be saved as the first
element of headers, any additional elements of headers will be
passed to the asy utility as command line arguments. The default
output format is pdf, but you can specify any format supported by
Imagemagick convert program with '-f outformat'."
  (message "asy-formatting...")
  (let* ((out-file (if headers (car headers)))
         (format (or (and (string-match ".+\\.\\(.+\\)" out-file)
                          (match-string 1 out-file))
                     "pdf"))
         (args (if (cdr headers) (mapconcat 'identity (cdr headers) " ")))
         (data-file (make-temp-file "org-asy")))
    (setq body (if (string-match "^\\([^:\\|:[^ ]\\)" body)
                   body
                 (mapconcat (lambda (x) (substring x (if (> (length x) 1) 2 1)))
                            (org-split-string body "\n")
                            "\n")))
    (cond
     ((or t)
      (with-temp-file data-file (insert body))
      (message (concat "asy -globalwrite -f " format " -o " out-file "
" args " " data-file))
      (shell-command (concat "asy -globalwrite -f " format " -o "
out-file " " args " " data-file))
      (format "\n[[file:%s]]\n" out-file))
     (t (concat
         "\n#+BEGIN_EXAMPLE\n"
         body (if (string-match "\n$" body) "" "\n")
         "#+END_EXAMPLE\n")))))
(Originally the (or t) statement was (or htmlp latexp), but I was
getting an error about htmlp.)
This is the org source that I am using to call asymptote:
#+begin_asy asymptote.png
// This comment is needed, because emacs is swallowing the first non-empty line
import graph;
size(0,4cm);
real f(real t) {return 1+cos(t);}
path g=polargraph(f,0,2pi,operator ..)--cycle;
filldraw(g,pink);
xaxis("$x$",above=true);
yaxis("$y$",above=true);
dot("$(a,0)$",(1,0),N);
dot("$(2a,0)$",(2,0),N+E);
#+end_asy
There are several problems here
 - Problems writing to a subdirectory:
  : asy -globalwrite -f png -o generated/asymptote.png  ~/ii
  :   /usr/share/asymptote/plain_xasy.asy: 93.7: runtime: Cannot write
to generated/generated/asymptote_.tex
 - The first non-empty statement in the asymptote source gets
 "swallowed" by emacs.
So for the time being, a comment must be added at the beginning, and
no subdirectory can be used. This is annoying, because I place my
generated images into a generated directory, so as to keep them out of
version control.
Emacs  : GNU Emacs 23.1.1 (i486-pc-linux-gnu, GTK+ Version 2.20.1)
 of 2011-03-04 on palmer, modified by Debian
Package: Org-mode version 7.7
current state:
==============
(setq
 org-export-latex-after-initial-vars-hook '(org-beamer-after-initial-vars)
 org-speed-command-hook '(org-speed-command-default-hook
org-babel-speed-command-hook)
 org-src-fontify-natively t
 org-plantuml-jar-path "~/.java/plantuml.jar"
 org-babel-load-languages '((emacs-lisp . t) (dot . t) (ditaa . t) (R
. t) (python . t) (ruby . t) (gnuplot . t)
                            (clojure . t) (sh . t) (ledger . t) (org .
t) (plantuml . t) (latex . t))
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-babel-tangle-lang-exts '(("latex" . "tex") ("clojure" . "clj")
("ruby" . "rb") ("python" . "py")
                              ("emacs-lisp" . "el"))
 org-startup-folded nil
 org-export-blocks-postblock-hook '(org-exp-res/src-name-cleanup)
 org-publish-use-timestamps-flag nil
 org-export-latex-format-toc-function 'org-export-latex-format-toc-default
 org-tab-first-hook '(org-hide-block-toggle-maybe
org-src-native-tab-command-maybe
                      org-babel-hide-result-toggle-maybe)
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
org-src-mode-configure-edit-buffer)
 org-confirm-shell-link-function 'yes-or-no-p
 org-export-first-hook '(org-beamer-initialize-open-trackers)
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-babel-pre-tangle-hook '(save-buffer)
 org-cycle-hook '(org-cycle-hide-archived-subtrees
org-cycle-hide-drawers org-cycle-show-empty-lines
                  org-optimize-window-after-visibility-change)
 org-publish-project-alist '(...)
 org-export-preprocess-before-normalizing-links-hook
'(org-remove-file-link-modifiers)
 org-mode-hook '(#[nil "\300\301\302\303\304$\207"
                   [org-add-hook change-major-mode-hook
org-show-block-all append local] 5]
                 #[nil "\300\301\302\303\304$\207"
                   [org-add-hook change-major-mode-hook
org-babel-show-result-all append local] 5]
                 org-babel-result-hide-spec org-babel-hide-all-hashes)
 org-export-htmlize-output-type 'css
 org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point
org-babel-execute-safely-maybe)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-export-interblocks '((lob org-babel-exp-lob-one-liners) (src
org-babel-exp-inline-src-blocks))
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 org-babel-after-execute-hook '(org-display-inline-images)
 org-occur-hook '(org-first-headline-recenter)
 org-from-is-user-regexp "\\<gonvaled\\>"
 org-export-preprocess-before-selecting-backend-code-hook
'(org-beamer-select-beamer-code)
 org-confirm-babel-evaluate nil
 org-use-sub-superscripts '{}
 org-export-latex-final-hook '(org-beamer-amend-header
org-beamer-fix-toc org-beamer-auto-fragile-frames
                               org-beamer-place-default-actions-for-lists)
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-export-blocks '((asy org-export-blocks-format-asy) (src
org-babel-exp-src-block nil)
                     (comment org-export-blocks-format-comment t)
(ditaa org-export-blocks-format-ditaa nil)
                     (dot org-export-blocks-format-dot nil))
 )

             reply	other threads:[~2011-08-10  9:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-10  9:08 Daniel Gonzalez [this message]
2011-08-11 14:54 ` Bug: Problems with integration between asmyptote and org mode [7.7] Nicolas Goaziou
2011-08-12  7:16   ` Daniel Gonzalez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAAOi-OEicmEgbmyMGKqty86MbvD1sC0veoGT+OA10X9o4Ruffg@mail.gmail.com \
    --to=gonvaled@gonvaled.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public 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).