Trying to understand ledger-mode

70 views
Skip to first unread message

Oliver Hardy

unread,
Jul 27, 2020, 4:02:20 PM7/27/20
to Ledger
Following the ledger-mode docs, in emacs I do C-c C-a.  This brings up a calendar with today's date highlighted. I'm then instructed
to type a close match to the payee. Hitting enter then enters the date in my ~/journal.ledger file and that's it. No further details even
though the payee I'm entering appears several times through out the file.

What am I doing Wrong?

Thank you.

Ghanashyam Prabhu

unread,
Jul 27, 2020, 7:39:47 PM7/27/20
to ledge...@googlegroups.com
On my Emacs setup, I have company mode enabled and typing a part of the Payee automatically completes the Payee entry. 
I tried disabling Company mode and typing in part of the Payee name, this time I have to Tab to initiate completion. 
Tabbing further then cycles through different existing Payees. I have the following in my .emacs 

(add-hook 'ledger-mode-hook 
    (lambda ()
        (setq-local tab-always-indent 'complete) ;; I guess this does the job of completion of Payee Entries.. 
        (setq-local completion-cycle-threshold t)
        (setq-local ledger-complete-in-steps t) 
        (setq-local ledger-clear-whole-transaction t)
    )
)

- Ghanashyam


--

---
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 ledger-cli+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ledger-cli/17a37eb7-20ee-41ac-938e-973c27297b9co%40googlegroups.com.

Oliver Hardy

unread,
Jul 28, 2020, 9:05:02 AM7/28/20
to Ledger
I thank you for that but it still doesn't work. Company mode enabled, company mode disabled. Tab, no tab. Partial payee name, complete payee name.
All I ever get is today's date with C-c C-a.

In addition to being new to ledger I'm also new to emacs so I'm sure I'm making some simple beginner mistake.

On Monday, July 27, 2020 at 11:39:47 PM UTC, Ghanashyam Prabhu wrote:
On my Emacs setup, I have company mode enabled and typing a part of the Payee automatically completes the Payee entry. 
I tried disabling Company mode and typing in part of the Payee name, this time I have to Tab to initiate completion. 
Tabbing further then cycles through different existing Payees. I have the following in my .emacs 

(add-hook 'ledger-mode-hook 
    (lambda ()
        (setq-local tab-always-indent 'complete) ;; I guess this does the job of completion of Payee Entries.. 
        (setq-local completion-cycle-threshold t)
        (setq-local ledger-complete-in-steps t) 
        (setq-local ledger-clear-whole-transaction t)
    )
)

- Ghanashyam


On Mon, 27 Jul 2020 at 13:02, Oliver Hardy <ohar...@gmail.com> wrote:
Following the ledger-mode docs, in emacs I do C-c C-a.  This brings up a calendar with today's date highlighted. I'm then instructed
to type a close match to the payee. Hitting enter then enters the date in my ~/journal.ledger file and that's it. No further details even
though the payee I'm entering appears several times through out the file.

What am I doing Wrong?

Thank you.

--

---
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 ledge...@googlegroups.com.

Ghanashyam Prabhu

unread,
Jul 28, 2020, 10:58:47 AM7/28/20
to ledge...@googlegroups.com
I tried using a new init.el file on my Emacs so that I start with a fresh initialization file without any of my personal customization. 
I used the below contents in my init.el. 

;; use init file as the one provided under --load-init
(setq user-init-file (or load-file-name (buffer-file-name)))
(setq user-emacs-directory (file-name-directory user-init-file))
;; setup ledger mode
(add-to-list 'load-path (expand-file-name "~/.emacs.d/elpa/ledger-mode-20200530.1710/"))
(require 'ledger-mode)
(autoload 'ledger-mode "ledger-mode" "A major mode for Ledger" t)
(add-to-list 'auto-mode-alist '("\\.ledger$" . ledger-mode))
;; some handy ledger mode hooks
(add-hook 'ledger-mode-hook
          (lambda ()
                  (setq-local tab-always-indent 'complete)
                  (setq-local completion-cycle-threshold t)
                  (setq-local ledger-complete-in-steps t)
                  (setq-local ledger-clear-whole-transaction t)

Note that I've used the ledger-mode elisp package downloaded from melpa. You may find it here https://melpa.org/#/ledger-mode
With the init.el setup, I invoke emacs using the following command to load this init.el file while invoking Emacs. 
emacs -q --load init.el 

I wrote a sample example.ledger file for your reference 
2019/10/23 * Opening Balance
    Assets:Checking:bofa                                                  $25.00
    Liabilities:cc-visabofa                                                $0.00
    Equity:
2020/07/26 * Salary
    Income:Salary:biweekly                                             -$1000.00
    Assets:Checking:bofa
2020/07/28 * Ralphs Purchase
    Expenses:Food:Grocery:ralphs                                         $100.00
    Assets:Checking:bofa
2020/07/28 * Vonns Shopping
    Expenses:Food:Grocery:vonns                                          $200.00
    Assets:Checking:bofa
2020/07/28 * Chevron Gas
    Expenses:Transportation:Auto:Gas:chevron                              $30.00
    Assets:Checking:bofa

With this example file, if I type in a new entry with C-c C-a, after the date is added I type in * for indicating a "completed" transaction and then if I type in V and tab it, it auto-completes to Vonns Shopping. 
Hope you find this useful. 

Thanks
Ghanashyam
 

To unsubscribe from this group and stop receiving emails from it, send an email to ledger-cli+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ledger-cli/77cbc79c-0bbd-4396-aa01-8da11bc1f422o%40googlegroups.com.

Oliver Hardy

unread,
Jul 28, 2020, 3:16:43 PM7/28/20
to Ledger
I thinK I've finally gotten it to work.

I deleted emacs off my laptop as well as anything having to do with emacs. Shut everything down, unplugged and walked away for a few hours.
Came back, restarted, reinstalled emacs, ledger-mode and the rest. Following your examples step by step and then editing for my own set up
things seem to be working  - at least for the 3 transactions I've entered so far.

I sincerely appreciate the time and effort you put into trying to help me with this.

Thank you very much
Reply all
Reply to author
Forward
0 new messages