Giter Club home page Giter Club logo

hledger-mode's People

Contributors

basil-conto avatar bsima avatar damiencassou avatar duxovni avatar erikmack avatar hectorae avatar ibizaman avatar jsl avatar mikaayil avatar narendraj9 avatar shivjm avatar syohex avatar youngfrog avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

hledger-mode's Issues

Error generating overall overview when using dollars instead of rupees

Versions

emacs: 26.1
hledger-mode: master branch

Reproduce

In config:

(setq hledger-currency-string "$")

In ~/.hledger.journal

2018/08/10 Income
    assets:bank:checking   $ 20    
    income:salary

And run M-x hledger-run-command RET overall

This results in:

Report :  15 Jul 2018 - 15 Aug 2018
══════════════════════════════════=

Income Statement 2018/07/15-2018/08/14

               || 2018/07/15-2018/08/14 
===============++=======================
 Revenues      ||                       
---------------++-----------------------
 income:salary ||                  $ 20 
---------------++-----------------------
               ||                  $ 20 
===============++=======================
 Expenses      ||                       
---------------++-----------------------
---------------++-----------------------
               ||                       
===============++=======================
 Net:          ||                  $ 20 


Balance changes in 2018/07/15-2018/08/14:

               || 2018/07/15-2018/08/14  Average 
===============++================================
 income:salary ||                 $ -20    $ -20 
---------------++--------------------------------
               ||                 $ -20    $ -20 

Expanded Running Report
=======================

Balance changes in 2018/07/15-2018/08/14:

              || 2018/07/15-2018/08/14  Average 
==============++================================
 assets       ||                  $ 20     $ 20 
   bank       ||                  $ 20     $ 20 
     checking ||                  $ 20     $ 20 
--------------++--------------------------------
              ||                  $ 20     $ 20 

and the error: let*: Wrong type argument: number-or-marker-p, $

Without the changed currency sign

Report :  15 Jul 2018 - 15 Aug 2018
══════════════════════════════════=

╔══════════════════════════════════════╦══════════════════════════════════════════╗

   Emergency Fund Ratio: inf               Savings Ratio: 1.00
   Current Ratio: inf                      Average Income: ₹ 2/month
   Debt Ratio: 0.00                        Average Expenses: ₹ 0/month
   ──────────────────────────────────────────────────────────────────
   Liquid Assets: ₹ 20.00                  Total Assets: ₹ 20.00
   Liabilities: ₹ 0.00                     Net Worth: ₹ 20.00
   ──────────────────────────────────────────────────────────────────
   Years to retirement: -inf               Retiring at: -inf
   Age:26                                  Life Expectancy: 80

╚══════════════════════════════════════╩══════════════════════════════════════════╝

════════════════════════════════════════════════════════════════════════════════
 • Your liquid assets would last nan and total assets nan with this lifestyle. 
 • Your liquid assets are inf times your liabilities/debt. 
 • 0.00% of your total assets are borrowed. 
 • For the past one year, you have been saving 100.00% of your average income. 
 • Your assets would roughly increase by ₹ 100 in the next 5 years making your
   net worth ₹ 120. If compounded every 4 months at 4.0% per annum, your net
   worth would become ₹ 130. 
════════════════════════════════════════════════════════════════════════════════


Income Statement 2018/07/15-2018/08/14

               || 2018/07/15-2018/08/14 
===============++=======================
 Revenues      ||                       
---------------++-----------------------
 income:salary ||                  ₹ 20 
---------------++-----------------------
               ||                  ₹ 20 
===============++=======================
 Expenses      ||                       
---------------++-----------------------
---------------++-----------------------
               ||                       
===============++=======================
 Net:          ||                  ₹ 20 


Balance changes in 2018/07/15-2018/08/14:

               || 2018/07/15-2018/08/14  Average 
===============++================================
 income:salary ||                 ₹ -20    ₹ -20 
---------------++--------------------------------
               ||                 ₹ -20    ₹ -20 

Expanded Running Report
=======================

Balance changes in 2018/07/15-2018/08/14:

              || 2018/07/15-2018/08/14  Average 
==============++================================
 assets       ||                  ₹ 20     ₹ 20 
   bank       ||                  ₹ 20     ₹ 20 
     checking ||                  ₹ 20     ₹ 20 
--------------++--------------------------------
              ||                  ₹ 20     ₹ 20 

and no errors.

Other currencies tried

This worked fine with other currency symbols: £, €, ¤, ¢, ¥, "randomstring".

Suggest hledger new entry templates based on frequency of old entries

I have found myself entering the same kinds of entries again and again. So, it makes sense to group these entries : a set of account names with a normalized description by the frequencies they occur with. One can then make good suggestions for the account names based on fuzzy matches with the partial description string.

Exclamation point status prevents indention.

When I attempt to use the exclamation point as a status mark (pending transactions), the next line (the first account adjustment) does not indent until I fill it in completely.

You can work around this; once you finish typing the first line (including the number) and press <Tab>, the line will then indent properly.

appendig currency string

i am using the currency symbol ( INR ) to append after value.
my ledger file is three years old.

setting (setq hledger-currency-string "INR") is prepending INR before value.
can we change this behaviour ?

expected : 

2021-12-20  purchase of rice
     Assets:Current:Cash       20.00 INR
what is happening : 

2021-12-20  purchase of rice
     Assets:Current:Cash       INR 20.00

Design user interface for convenient currency and date inputs

I can easily modify the indent functions to ask for a date when the user hits tab more than once. I can use org-reschedule which in turn uses org-read-date. It would be more convenient if the user could type at (point) itself and the resulting date would be shown in an overlay in front of the input text and hitting [Enter] would just insert the date in the right format.

M-q, fill-paragraph, like ledger-mode

In ledger-mode, if user presses M-q, it will clean up the "paragraph", that is, it will realign amounts, etc.

Would this be a good feature for hledger-mode? Users may be bringing in data added by other ledger data entry tools (like my mobile app), and may want to clean up their data once they're back at desktop. (I would put amounts all at the same column in my app, but currently, the view does not parse and present transactions in a formatted way, so I try to input the columns to a minimum for now.)

Test Execution Issues

Hello,

I initiated Emacs in a clean state using emacs -Q. While executing the test cases, I observed that not all of them passed as expected.

@shivjm: Can you provide some insights regarding these errors? (#53)

Selector: t
Passed:  9
Failed:  5 (5 unexpected)
Skipped: 0
Total:   14/14

Started at:   2023-09-10 17:21:16+0200
Finished.
Finished at:  2023-09-10 17:21:16+0200

F.........FFFF

F ert-hledger-account-bounds-is-correct
    (void-function hledger-bounds-of-account-at-point)

F hledger-accounts-should-not-update
    With ‘hledger-invalidate-completions’ set to ‘on-idle’, saving or
    (void-function hledger-mode)

F hledger-accounts-should-update-on-edit
    With ‘hledger-invalidate-completions’ set to ‘(on-idle
    (void-function hledger-mode)

F hledger-accounts-should-update-on-save
    With ‘hledger-invalidate-completions’ set to ‘(on-idle
    (void-function hledger-mode)

F hledger-date-manipulation-works
    (void-function hledger-add-days-to-entry-date)

Consistently quote arguments when running hledger

There are many places that call hledger, and for the most part, the arguments are a simple string. This usually isn’t an issue, but, for instance, running M-x hledger-run-command RET balance RET some account with spaces produces something along the lines of hledger balance some account with spaces, i.e. four separate arguments to the balance command. It would be good to consistently escape user input (unless it’s specifying hledger options, of course).

Sort of related to #50.

docs: ledger-mode comparison

Thanks for maintaining this!

As a user of ledger-mode, I'm curious how they compare. What's the same, what can I do in one but not the other, why did you start this one etc. Could you add this to the docs ?

Keeping state in text properties

Currently, most of the state of the major-mode is stored in global variables. This state is relevant only until the next report is generated post which it is updated. It makes sense to store this information in a more structured from in the buffer itself using text properties.

Refactor most of the code

Mainly report generating code is redundant at a lot of places. It needs to be refactored.

Study Hledger implementation and see the amount of effort that would be required to implement an Emacs Lisp alternative. I would want to do this to remove dependency on hledger and better integration with Emacs.

`hledger-update-accounts` not working

When using hledger-mode with company support, I noticed that the hledger-accounts-cache was never filled up. I traced the issue back to this:


When running (hledger-update-accounts) on a journal file, it throws Wrong type argument: stringp, nil. A buffer must be specified for the function to work, even though it's marked as an optional argument, and is used without an argument throughout the code. Therefore, hledger-accounts-cache is never set.

I guess the function was supposed to default to the current-buffer if no argument is provided, but it currently runs the function only if the buffer is nil or equal to current-buffer:

(when (or (null buffer)
(eql (current-buffer) buffer))
(setq hledger-accounts-cache (hledger-get-accounts nil buffer)
hledger-must-update-accounts nil)))

`indent-region` is indenting date line.

I'm not sure if this is specific to Emacs 29.1, or if it's just coincidental with the new version release, but it seems like indent-region is now causing the date line to indent as well as the account lines.

2023-11-04-140314_screenshot

Failing balance assertions interfere with autocompletion

It’ll work fine if the accounts have been cached, but will fail the next time hledger-mode attempts to update the list. I think it would make sense to add -I to hledger accounts. I’m not aware of any other checks that are enabled by default; I would assume that only malformed data prevents autocompletion otherwise.

Monetary Symbol Tab Events interfere with Yasnippet

Every time a tab event occurs on a line with an account, the monetary symbol appears at the end (in my case, it's the US dollar sign: "$"). By itself, it's nothing major, and can be convenient. However, when using Yasnippet, every line seems to act as if the tab is pressed. For the main line (with the transaction name and date), this does not seem to be a problem.

Additionally, every account line will cause the monetary symbol to swap (the symbol is added to lines that don't have it, and removed from lines that do have it). Again, no big deal, in the snippet, I just place the symbol on those lines that I do not want the symbol to appear, and all is fine.

However, the problem happens when I have a line that, in the yasnippet, ends with a placeholder and a monetary symbol. When the symbol is removed, it is replaced with nothing, and Yasnippet complains because it can't find the placeholder anymore, because the search regex ends with [:space:], and that space was removed.

I'm thinking that it might be helpful to, when removing a monetary symbol using a tab event, at least put a space in its place, to ensure such regular expressions don't fail.

center-text-for-reading

Hi there,

center-text-for-reading in your use-package definition does nothing here, and I cannot find it on the web. This is maybe something just in your config? Maybe it shouldn't be here in the readme, it can cause problems.

But maybe you can just paste your definition for that here? I'm curios about it.
//Martin

Make `hledger-run-command` more flexible

Something I keep wishing for is a way to edit the command line that hledger-run-command runs. It would be useful if one could call it with a prefix argument to see and edit the final command before it was run, similarly to what M-x grep presents.

One alternative I can think of is to build a transient-based interface for hledger commands. This would probably be even more helpful, but also a big undertaking.

Need advice on making hledger completion work with Corfu/capf

Hi, I need some advice on making auto-completion work with Corfu. Corfu, unlike Company uses the built-in cap functions. I can see that the docs mention using Company and auto-complete, but it's not clear how to make it work with Corfu. Any advice will be appreciated. Thanks.

Lacking documentation

Hi,

thank you for your package. I think the project lacks some documentation. For example:

  1. the animated GIF in the README looks great but the features it demonstrates are not described anywhere. Would it be possible to have a list of the commands used in the demo?
  2. I don't see any list of features that the package supports nor how to use any feature.

error on keybinding

hello. I tried your keybinding
(global-set-key (kbd "C-c j") 'hledger-run-command)
it produces this error

command-execute: Wrong type argument: commandp, hledger-run-command

same error if I use
(spacemacs/set-leader-keys "hbb" 'hledger-run-command)
(spacemacs/set-leader-keys "hbb" 'hledger-balancesheet)
or
(spacemacs/set-leader-keys "hbb" 'hledger-balancesheet*)

Thank you for this great project. I find it useful.

How to add custom reports

Hi,

I maintain budget accounts and would appreciate seeing a report showing them. With ledger-mode, I configure ledger-reports with an item such as:

("Budget" "%(binary) -f %(ledger-file) balance --empty --sort account ^Budget and not \\(Unbudgeted\\)")

Is there a way to configure user-specific reports?

couldn't find package - hledger-input

i have installed hledger-mode using straight package manager.

i am getting the following error :

 error: Could not find package hledger-input. Updating recipe repositories: (org-elpa melpa gnu-elpa-mirror el-get emacsmirror-mirror) with ‘straight-pull-recipe-repositories’ may fix this

straight-pull-recipe-repositories is not able to fix this error.

there is no error with removing following bit from configuration.

(use-package hledger-input
  :load-path "straight/build/hledger-mode/"
  :bind (("C-c e" . hledger-capture)
         :map hledger-input-mode-map
         ("C-c C-b" . popup-balance-at-point))
  :preface
  (defun popup-balance-at-point ()
    "Show balance for account at point in a popup."
    (interactive)
    (if-let ((account (thing-at-point 'hledger-account)))
        (message (hledger-shell-command-to-string (format " balance -N %s "
                                                          account)))
      (message "No account at point")))

  :config
  (setq hledger-input-buffer-height 20)
  (add-hook 'hledger-input-post-commit-hook #'hledger-show-new-balances)
  (add-hook 'hledger-input-mode-hook #'auto-fill-mode)
  (add-hook 'hledger-input-mode-hook
            (lambda ()

one more difficulty is with entering account names, as company mode is not working in hledger-mode.

my company-mode configuration looks like this :

;; company mode
(use-package company
  :diminish company-mode
  :hook ((prog-mode LaTeX-mode latex-mode org-mode ledger-mode hledger-mode) . company-mode)
  :bind
  (:map company-active-map
        ([tab] . smarter-tab-to-complete)
        ("TAB" . smarter-tab-to-complete))
  :custom
  (company-minimum-prefix-length 1)
  (company-tooltip-align-annotations t)
  (company-require-match 'never)
  ;; Don't use company in the following modes
  (company-global-modes '(not shell-mode eaf-mode))

is there any configuration change needed for using with straight package manager ?

Problem with encrypting the journal file

Hi,
I was able to setup Hledger in Emacs and it works fine. But as the journals will contain all my financials wanted to encrypt them so I did a basic setup as described in [1]. Hledger capture works fine for me but none of the other functions in Emacs work. I get an error that hldeger is failing to encrypt. I did skim through the hledger code and it seems like encryption using GPG is not supported out-of-the-box for reports. Wanted to check if my understanding is right? If yes, can you provide some pointers on how I could fix this?

[1]: https://pzel.name/2016/07/18/Encrypted-hledger-with-emacs-and-gnupg.html

Thanks,
-Sumit

Minor mode for rules file

Hi there,

I'm just creating this issue as a reminder to myself to add a major-mode for hledger rules files. Atm I'm just hacking some font-lock rules with .dir-locals but expanding this into a full major-mode is a goal.

(font-lock-add-keywords
 nil
 `((,(rx bol (* space) (group "#" (* any)) eol)
    1 font-lock-comment-face t)
   (,(rx bol (* space)
         (group word-start
                (or "if"
                    "fields"
                    "date-format"
                    "skip")
                word-end))
    1 font-lock-keyword-face t)
   (,(rx bol (* space)
         (group word-start
                (or "date"
                    "reference"
                    "description"
                    (and (or "date"
                             "amount"
                             "account"
                             "comment")
                         (one-or-more digit)))
                word-end))
    1 font-lock-builtin-face t)
   (,(rx (group word-start "%" (one-or-more alnum) word-end))
    1 font-lock-variable-name-face t)))

exec-path issue. zsh:1: command not found: hledger

I've installed hledger in ~/<user>/.local/bin/ :

$ hledger --version                                    
hledger 1.15.2
$ where hledger 
/home/<user>/.local/bin/hledger

Doing hledger-run-command gave me zsh:1: command not found: in the report buffer.

Here is the relevant configuration :

(add-to-list 'exec-path "/home/<user>/.local/bin")
;; ...
(use-package hledger-mode
:ensure t
:mode ("\\.journal\\'" "\\.hledger\\'")
:init
(setq hledger-jfile "~/personal/accounting.journal")

and the weird part is if I eval-expression

(executable-find "hledger")

I get

"/home/<user>/.local/bin/hledger"

If I move all hledger-* binaries in /usr/bin, all command work fine. I'm missing something,
how should I specify the binary's path ?

Add feature to handle multiple commodities

It would be great if we can make entering various commodities easier for the user, maybe through a list of completions or cycling through the commodities that have been entered so far. Currently, there is support only for the hledger-currency-string. Hitting tab after an account name causes the insertion of the currency symbol defined that is hledger-currency-string.

Missing -pkg.el file

There's no hledger-mode-pkg.el file. IIUC Melpa creates one for us but it seems broken (see also melpa/melpa#4680).

That's the generated file:

(define-package "hledger-mode" "20170402.1110" "A mode for writing journal entries for hledger."
'((emacs "24.4")
(popup "0.5.3")
(async "1.9")
(htmlize "1.47"))
:url "https://github.com/narendraj9/hledger-mode.git" :keywords
'("data"))

Note how it does not mention emlib, which is required by hledger-suggest.el. This leads to a compilation failure when installing hledger-mode without emlib installed.

I believe a proper -pkg.el file should be committed to the repo.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.