Hi,

I was experiencing the same issue with reports when using EasyPG. You 
probably came with up with a solution to this. I have too and I figured I'd 
share it for reference. To get ledger reports to work, just wrap the 
`ledger-report-cmd` using an advice function, like this:

(defadvice ledger-report-cmd (around ledger-report-gpg)
  (let ((ledger-reports
         (if (string= (file-name-extension (or (buffer-file-name 
ledger-buf) "")) "gpg")
             (mapcar
              (lambda (report)
                (list (car report)
                      (concat
                       "gpg2 --no-tty --quiet -d %(ledger-file) | ledger -f 
- "
                       (mapconcat 'identity (cdddr (split-string (cadr 
report))) " "))))
              ledger-reports)
           ledger-reports)))
   ad-do-it))

(ad-activate 'ledger-report-cmd)


This function basically rebinds the `ledger-reports` variable if the file 
name extension ends with 'gpg'. And it maps over the existing list of 
report commands, stripping the ledger command and file argument and 
prepending it with a command that pipes the decrypted data into ledger.


On Wednesday, February 16, 2011 1:52:48 AM UTC-8, Mortimer wrote:
>
> hi all, 
>
> I am still new to ledger, but I wanted to explain how I do encryption 
> of the journal and maybe get some input from you all. 
>
> So, I have one ledger file that I share between computers with 
> Dropbox. Mainly one computer at home running OSX and one at work with 
> Ubuntu. The journal is in a directory in Dropbox, encrypted 
> symetrically with gpg. 
>
> I use Emacs to edit the file and org-capture to enter entries quickly, 
> with easypg (http://www.emacswiki.org/emacs/EasyPG), Emacs deals 
> transparently with the encryption, so it asks for the keyphrase when I 
> try to enter a new entry via org-capture or when I open the file. 
>
> ledger-report mode gets confused with this setup and  I haven't yet 
> found how to get it to work nice with it. In the meantime, I use it 
> from the command line, what I do is: 
>
> > gpg -d pathtomyjournal.gpg | ledger -f - any following arguments 
>
> I have done an alias to have this available quickly: 
>
> alias gledger='gpg -d pathtotheledger | ledger -f -' 
>
> I can then do simple things like: 
>
> gledger bal 
> gledger reg 
> etc. 
>
> I will be prompted for the password and then see the report. 
>
> Some drawbacks of this setup: 
>   - I still have to get the report-mode in emacs to play nice with 
> this 
>   - on the OS X machine, I have Ledger 3 and it seems to get sometimes 
> confused with the command line parameters in this setup 
>   - as you get the file from the standard input, the ledger commands 
> for writing in the file will be confused. 
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to