I am trying to include a ledger data file from an org-babel block. I am using Windows10 and the SciMax emacs distribution.

#+begin_src ledger :cmdline bal :results output :exports results
!include d:/Ledger/RLbook.dat
#+RESULTS  (this is all that appears regardless of the header options)

If I call the file using !include RLbook.dat in the org-block (see below), the block produces the word #+RESULTS but no actual numbers regardless of the header options. Using or excluding ! makes no difference.

My config file call ledgers (ledger . t) as required. The data in the external file produces results if I copy it directly into the org-babel block or if used directly in ledger-mode so I know the data is formatted properly.

I discovered that that although I specify this path in the block d:/Ledger/RLbook.ledger, its being interpreted as c:/Users\Arjay\AppData\Local\Temp\babel-16324iS0\d:/Ledger\RLbook.ledger according to my Messages buffer. I cannot figure out how this extra path data is being added or how to prevent it.

How can I avoid or correct the incorrect path data being added to the path name?

Note: I rebuilt the ledger executable using the instructions from https://gist.github.com/ngleb/944346a67960776371aab74149edf38c. This fixed a problem with ledger not understanding paths when used from the cmd line in a terminal window. It did not fix this problem.

  • can You edit an example of your transaction (formatted exactly the way it is typed in your code block) into your question? and also, do you have ledger installed and (ledger . t) included in the org-babel-do-load-languages 'org-babel-load-languages command in your .emacs? – manandearth Jun 23 '18 at 5:54
  • I have updated and refined my question based on more testing. Please review. – Arjay-El Jun 24 '18 at 7:42
  • I'm assuming that org-babel makes a mistake and interprets the path as relative. I haven't used Emacs on Windows in ages, so I don't remember what's the way to define absolute paths with a partition, and IIRC it depends on what kind of build you're using (native one built with mingw, cygwin or any other option). – DoMiNeLa10 Jan 1 at 13:58

You should add :noweb yes just after #+begin_src ledger. Then at least some form of include should work. Under my Linux system absolute file names work, relative paths from $HOME (i.e., ~/mydir/filename) work, but link to current directory (i.e., ./filename) does not work. Don't know about the Windows world, but in any case the :noweb yes-part is essential for inclusion to work at all.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.