syl20bnr / spacemacs

A community-driven Emacs distribution - The best editor is neither Emacs nor Vim, it's Emacs *and* Vim!
http://spacemacs.org
GNU General Public License v3.0
23.58k stars 4.9k forks source link

can we have the choice of hledger or ledger as the basis for the finance layer? #16237

Open Abu-Daud opened 6 months ago

Abu-Daud commented 6 months ago

I have been trying to add a keybinding for the hledger-balancesheet* command

I used the template on the spacemacs man page. (spacemacs/declare-prefix-for-mode 'hledger-mode "mo" "custom") (spacemacs/set-leader-keys-for-major-mode 'hledger-mode "os" 'hledger-balancesheet*)

of course I wanted SPC-b-s but that is the scratch buffer. Anyway to make a minor mode keybinding override a universal keybinding? I think mule does. Sorry if this is the wrong place. Probably should have tried stack overflow. Is there a system for suggesting layers if we come up with a good personal layer? I guess a pull request? Love your work, I've probably been with you about 4 years.

bcc32 commented 6 months ago

spacemacs/set-leader-keys-for-major-mode puts keys under dotspacemacs-major-mode-leader-key (by default that's `).

So, the key binding you made with that snippet is:

, o s hledger-balancesheet*

As for layers, I think there is probably not too much in common that hledger and ledger would have (at least in terms of the Emacs configuration side). Perhaps it should just be a separate hledger layer (and arguably finance should be called ledger instead).

Kuba-Jasinski commented 5 months ago

Finance layer wraps ledger-mode.
As hledger-mode is also actively developed https://github.com/narendraj9/hledger-mode, we would be better off having just one Finance layer with option to choose the implementation (hledger is basically ledger's implementation written in Haskell with some minor differences and added features like csv import out of the box).

bcc32 commented 5 months ago

Why force users to choose between having ledger-mode and hledger-mode installed (by having a mutually exclusive backend variable)? They are two slightly different file formats, with different implementations, and it seems reasonable for a user to want both to be configured at the same time.

(In particular, the file formats are not compatible---I have used ledger for a long time and was not able to use hledger out of the box, without significant modifications to my files that degraded the experience with ledger).

Kuba-Jasinski commented 5 months ago

It's not about forcing a choice, it's about giving choice and not excluding all of those who use hledger.

A normal use case is that someone uses either one or the other, a migration between ledger and hledger shouldn't be in scope of the layer.

Of course, it's easy to see what is actually installed on the user system and auto-configure the right backend. If both hledger and ledger are installed, then I agree that user would be forced to choice.

Just to emphasize my point again, what I imagine is not switching back and forth between them, but just a possibility for the users who would like to use hledger to set a hledger backend as a default .

Abu-Daud commented 5 months ago

like doesn't the mail layer let you choose between mutt and mu4e? or is it opinionated?


From: Kuba-Jasinski @.> Sent: Sunday, January 28, 2024 2:32 PM To: syl20bnr/spacemacs @.> Cc: Payne, Brandon @.>; Author @.> Subject: Re: [syl20bnr/spacemacs] can we have the choice of hledger or ledger as the basis for the finance layer? (Issue #16237)

It's not about forcing a choice, it's about giving choice and not excluding all of those who use hledger.

A normal use case is that someone uses either one or the other, a migration between ledger and hledger shouldn't be in scope of the layer.

Of course, it's easy to see what is actually installed on the user system and auto-configure the right backend. If both hledger and ledger are installed, then I agree that user would be forced to choice.

Just to emphasize my point again, what I imagine is not switching back and forth between them, but just a possibility for the users who would like to use hledger to set a hledger backend as a default .

— Reply to this email directly, view it on GitHubhttps://github.com/syl20bnr/spacemacs/issues/16237#issuecomment-1913698744, or unsubscribehttps://github.com/notifications/unsubscribe-auth/APXKAAAMQKHNXD7KPUDBEL3YQ2RWLAVCNFSM6AAAAABBNZF5SOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMJTGY4TQNZUGQ. You are receiving this because you authored the thread.Message ID: @.***>

bcc32 commented 5 months ago

There's no mail layer, but there are separate mu4e and notmuch and gnus layers (I don't think Spacemacs has any particular mutt support).

Of course, it's easy to see what is actually installed on the user system and auto-configure the right backend. If both hledger and ledger are installed, then I agree that user would be forced to choice.

hledger and ledger aren't just different backends, though, they also have different frontend Emacs packages. hledger-mode and ledger-mode do not have sufficiently similar sets of (Emacs) commands, as far as I'm aware. The user would not be able to easily switch between them, and there would be lots of incompatible key bindings.

It's not about forcing a choice, it's about giving choice and not excluding all of those who use hledger.

My suggestion was not to exclude those who use hledger, but rather to create a separate hledger layer, in the same way that the different mail clients each have their own layer. I guess I just don't see the benefit in combining the ledger and hledger support in the same layer. There doesn't seem to be any configuration, key bindings, or even documentation to share between them.

And if a user wants to switch between the two programs, they can always disable one layer and enable the other.

davidpiano commented 5 months ago

Are there other packages in the Finance layer right now? Or just Ledger?

I think if Finance is already a collection of packages, all carefully configured to work together, it wouldn't be so simple to mess around with. But if Finance currently just means Ledger, and if Ledger and Hledger both have enough users, I think having two different layers (with those names) probably makes more sense.