Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ledger-cli support #36

Open
djp opened this issue Mar 22, 2012 · 11 comments
Open

ledger-cli support #36

djp opened this issue Mar 22, 2012 · 11 comments

Comments

@djp
Copy link

djp commented Mar 22, 2012

ledger is an amazingly good command-line accounting program. It is comprehensive, has an active community and maintains all transaction data in simple text-files. The core developers are also orgmode fans and developers, and have been working with ledger data in orgmode for quite some time. I'm jealous, and I think it would be great if VimOrganizer could take advantage of previous work by the ledger team.

http://ledger-cli.org/
http://ledger-cli.org/3.0/doc/ledger3.html#Emacs-org-mode

@hsitz
Copy link
Owner

hsitz commented Mar 22, 2012

On Thu, Mar 22, 2012 at 12:41 PM, djp
[email protected]
wrote:

ledger is an amazingly good command-line accounting program. It is comprehensive, has an active community and maintains all transaction data in simple text-files. The core developers are also orgmode fans and developers, and have been working with ledger data in orgmode for quite some time. I'm jealous, and I think it would be great if VimOrganizer could take advantage of previous work by the ledger team.

 http://ledger-cli.org/
http://ledger-cli.org/3.0/doc/ledger3.html#Emacs-org-mode

I think this should already work in VimOrganizer. All of the Babel
stuff should work (nearly?) problem free, since all of the source
blocks are evaluated in Emacs. You do need to have the Emacs
connection set up. Then just choose 'Do Emacs eval' or press ,v with
cursor in a source code block to have VimOrganizer send it to Emacs
and come back with the output. Alternatively, the source code blocks
are by default evaluated on export, so just do export to html and view
the results.

Best way would probably be to get it going in Org first to make sure
you know how to do it. Then do it in VimOrganizer.

-- Herb

@djp
Copy link
Author

djp commented Mar 25, 2012

If I knew how to do that, I might not be such a candidate for VimOrganizer user.. ;-)

How do I know when my Emacs connection is set up properly?
(emacs gui runs fine on this ubuntu natty box)

perhaps the feature-request should be titled "explain Babel use in vimorg, using ledger as an example", as I have not so much idea of what the setup for Babel functions might entail. I've been cutting and pasting various things into my .vimrc, my .emacs file and into my sandbox.org, without success.

considering http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-ledger.html
(Using Ledger for Accounting in Org-mode with Babel) with my cursor on the first line of a "#+begin" (of an example block from page above)

#+name: balance
#+begin_src ledger :cmdline -f ~/Documents/accounts/master.ledger -s bal :noweb yes
<>
<>
#+end_src

#+results: balance

",v" seems to do nothing. but menu Org > Do Emacs Eval, seems to do some processing but rather than results I see

"~/org-src-block.org" 7L, 154C
7 fewer lines
Press ENTER or type command to continue

and the block is copied to a text file..
I may not have set up the <> properly..
I'm confused..

@djp
Copy link
Author

djp commented Mar 25, 2012

the #+begin block I entered above lost something in the github translation, the "income" and "expense" targets, and yes, the ledger command I'm using produces a result at the CLI once de-org-ified.

@hsitz
Copy link
Owner

hsitz commented Mar 25, 2012

On Sun, Mar 25, 2012 at 12:53 PM, djp
[email protected]
wrote:

If I knew how to do that, I might not be such a candidate for VimOrganizer user.. ;-)

How do I know when my Emacs connection is set up properly?
(emacs gui runs fine on this ubuntu natty box)

If you can export via Emacs then it's set up right. Help on how to
set that up is in ':h vimorg-emacs-setup' and ':h vimorg-export'

perhaps the feature-request should be titled "explain Babel use in vimorg, using ledger as an example", as I have not so much idea of what the setup for Babel functions might entail. I've been cutting and pasting various things into my .vimrc, my .emacs file and into my sandbox.org, without success.

Babel source code blocks in VimOrganizer will be identical to what
they are in Emacs/Org, so you will want to check the Org documentation
on that. As a start, see
http://orgmode.org/manual/Working-With-Source-Code.html#Working-With-Source-Code

considering http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-ledger.html
(Using Ledger for Accounting in Org-mode with Babel) with my cursor on the first line of a "#+begin" (of an example block from page above)

#+name: balance
#+begin_src ledger :cmdline -f ~/Documents/accounts/master.ledger -s bal :noweb yes
<>
<>
#+end_src

#+results: balance

 ",v" seems to do nothing. but menu Org > Do Emacs Eval, seems to do some processing but rather than results I see

"~/org-src-block.org" 7L, 154C
7 fewer lines
Press ENTER or type command to continue

and the block is copied to a text file..
I may not have set up the <> properly..
I'm confused..

The block that gets copied to the text file is just a temporary work
file that Emacs uses. You can check if ,v is mapped correctly by
looking at result of this command ':map ,v' (Should show ..silent
call OrgEval())

I think you may need to put the ":exports results" option into your
source code block header. I.e.,
#+begin_src ledger [. . . ] :exports results (or :exports both). See here:
http://orgmode.org/manual/Exporting-code-blocks.html#Exporting-code-blocks

Like I said, best to test your code block in Emacs/Org before you use
it in VimOrganizer, takes several variables out of play.

-- Herb

@hsitz
Copy link
Owner

hsitz commented Mar 25, 2012

On Sun, Mar 25, 2012 at 4:07 PM, Herbert Sitz [email protected] wrote:

On Sun, Mar 25, 2012 at 12:53 PM, djp

perhaps the feature-request should be titled "explain Babel use in vimorg, using ledger as an example", as I have not so much idea of what the setup for Babel functions might entail. I've been cutting and pasting various things into my .vimrc, my .emacs file and into my sandbox.org, without success.

The first step is to get Babel working for Ledger in Org. Once you've
confirmed that's working it should work in VimOrganizer. Org and
ledger documentation is where you go for that.

I think I forgot one step before, which is that you have to make sure
to have to make sure the ledger module for babel is loaded in your
.emacs file. See this for some more info and/or do a search in
archives at http://news.gmane.org/gmane.emacs.orgmode:
http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-ledger.html

You don't really have to "know" Emacs to get it working with
VimOrganizer and with Ledger. But you do need to go through the basic
configuration steps, since VimOrganizer outsources all of exporting
and evaluation stuff to Emacs. I don't know any Emacs key combos; I
alway use the Org menu to point and click my way through. . .

-- Herb

@hsitz
Copy link
Owner

hsitz commented Mar 25, 2012

On Sun, Mar 25, 2012 at 4:18 PM, Herbert Sitz [email protected] wrote:

You don't really have to "know" Emacs to get it working with
VimOrganizer and with Ledger.  But you do need to go through the basic
configuration steps, since VimOrganizer outsources all of exporting
and evaluation stuff to Emacs.  I don't know any Emacs key combos; I
alway use the Org menu to point and click my way through. . .

Plus I edit my .emacs file in Vim. ;)

-- Herb

@hsitz
Copy link
Owner

hsitz commented Mar 25, 2012

On Sun, Mar 25, 2012 at 4:07 PM, Herbert Sitz [email protected] wrote:

Like I said, best to test your code block in Emacs/Org before you use
it in VimOrganizer, takes several variables out of play.

I would also add: First step in testing with VimOrganizer should be
to view results you get by doing an export to pdf or html. If that
works, only then go to using ',v' or "Do Emacs Eval' from the menu.
Again, this takes one more variable out of the mix when testing.

-- Herb

@djp
Copy link
Author

djp commented Mar 26, 2012

I have another question about exporting, because when I hit ",x" and then select an export, it seems to grid away in a convincing fashion, positive looking feedback, but if it worked I have no idea what it does with the file.. or what it would be called by default.. I've never located the output, if it exists.

@hsitz
Copy link
Owner

hsitz commented Mar 26, 2012

On Sun, Mar 25, 2012 at 5:57 PM, djp
[email protected]
wrote:

I have another question about exporting, because when I hit ",x" and then select an export, it seems to grid away in a convincing fashion, but if it worked I have no idea what it does with the file.. or what it would be called by default.. I've never located the output, if it exists.

All of the exported files should be in same directory as the .org file
you're working with. (Or maybe it's just current Vim working
directory, not sure.) In any case, try ,xb to automatically open
html in a browser or ,xd to automatically open the pdf.

As always, troubleshoot first by opening doc in Emacs and doing Org
export there.

Then, if on Linux, make sure that you have a working Emacs server,
which requires doing the 'server-start' command either in .emacs or
manually doing server-start in running Emacs.

Then try in VimOrganizer.

-- Herb

@hsitz
Copy link
Owner

hsitz commented Mar 26, 2012

On Sun, Mar 25, 2012 at 6:13 PM, Herbert Sitz [email protected] wrote:

On Sun, Mar 25, 2012 at 5:57 PM, djp
[email protected]
wrote:

I have another question about exporting, because when I hit ",x" and then select an export, it seems to grid away in a convincing fashion, but if it worked I have no idea what it does with the file.. or what it would be called by default.. I've never located the output, if it exists.

Exported file will have same name with different prefix. E.g.,
myfile.org exported to html will be myfile.html. Should be in same
directory as original file. -- Herb

@hsitz
Copy link
Owner

hsitz commented Mar 26, 2012

On Sun, Mar 25, 2012 at 6:15 PM, Herbert Sitz [email protected] wrote:

Exported file will have same name with different prefix.  E.g.,
myfile.org exported to html will be myfile.html.  Should be in same
directory as original file.  -- Herb

Sorry, that should have been "same name with different EXTENSION".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants