Re: org-mode combined with beancount.el
> I got Emacs to work with the beancount.el file. It nicely color-codes > everything. However, if I activate org mode the colors disappear. I suspect > this is incorrect behavior and there must be something I'm doing wrong. No, it's expected behavior. > Any suggestions of what might not be working? Yes: Org-mode. The new beancount-mode is now a major mode rather than a minor mode, so you can't combine it with another major mode (like Org-mode). You can activate `outline-minor-mode` which will provide similar support for hiding/showing the structure based on your `** Foo` headings, but it's only a subset of what Org-mode provides of course. If there's some other functionality of Org-mode which you miss, let us know, Stefan -- You received this message because you are subscribed to the Google Groups "Beancount" group. To unsubscribe from this group and stop receiving emails from it, send an email to beancount+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/jwvbls0bcej.fsf-monnier%2Bgmane.comp.finance.beancount%40gnu.org.
Re: Patch for beancount.el
>> I finally got around to merging the patches I used to use with the old >> (minor-mode) version of beancount.el into the new version. > Thank you very much for the patch. Do you mind if I split it in a few > commits and I submit it with a few tweaks and your attribution as a > merge request on bitbucket, so that Martin can easily merge it? That would be very sweet. >> - New var `beancount-electricity` to control behavior of RET. >> When non-nil, RET at the end of a leg adds the currency if missing (or >> tries to anyway: I think it's done in a too naive way which doesn't >> account for the many ways to specify the amount). > I think this should be called `beancount-electric-currency` instead. When I introduced it I intended for it to do more: - do a bit of auto-indentation (that was when beancount-mode didn't have a line-indent-function) - re-align the amount (again, it's now done by electric-indent-mode) - auto-add the next account if it's always been the same so far (never implemented) But, yes, nowadays it's only the currency. I don't have any strong opinion on the name of the config var. > Can you be more specific about how this may not work for more complex > ways of specifying the amount? Not really: I only ever use simple amounts (no @ things and whatnot) so I not only haven't tested with anything more complex but I can't remember what those more complex cases can look like anyway. Oh I can give you one concrete case I bumped into and never fixed: Asset:Account (0.8 * 100) RET will not insert the currency because the code doesn't recognize "(0.8 * 100)" as an amount. >> - Add a M-RET binding that inserts the date part of a new transaction. > I don't enter many transactions manually, but this addition seems > reasonable. Yeah, it's not super useful, admittedly. Stefano's suggestion to use the date of the previous transaction might be a good alternative. I don't have strong feelings about it should do. I find the key-binding intuitive and the idea of the functionality appealing, although the practice of it is rather underwhelming. Thank you for your rewrite into a major mode: it fixed most of the annoyances I encountered in the old mode. Stefan -- You received this message because you are subscribed to the Google Groups "Beancount" group. To unsubscribe from this group and stop receiving emails from it, send an email to beancount+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/jwvimmddmw6.fsf-monnier%2Bgmane.comp.finance.beancount%40gnu.org.
Patch for beancount.el
I finally got around to merging the patches I used to use with the old (minor-mode) version of beancount.el into the new version. Most of the tweaks I was using aren't needed any more so all that's left is the patch below: - Remove the redundant `:group`s (since they default to the last `defgroup` anyway). - New var `beancount-electricity` to control behavior of RET. When non-nil, RET at the end of a leg adds the currency if missing (or tries to anyway: I think it's done in a too naive way which doesn't account for the many ways to specify the amount). - Comment out a `defvar` of `beancount-directive-names` that doesn't do anything since it's preceded by a `defconst` of the same var. - Add a M-RET binding that inserts the date part of a new transaction. - Fix `beancount-collect`: the old code collects all matches and then its callers removed the entry found at point (because that entry is the one we're in the process of completing so it's presumably not (yet) valid) but that misbehaves when the entry at point is actually already valid, in which case that entry is incorrectly removed from the possible completions. So instead I changed `beancount-collect` so it ignores matches around point which usually gives the same result except when the match around point is *also* found elsewhere (in which case the new code keeps that completion whereas the old one incorrectly discarded it). Stefan diff --git a/editors/emacs/beancount.el b/editors/emacs/beancount.el index 37e7eed0..d1a8cf22 100644 --- a/editors/emacs/beancount.el +++ b/editors/emacs/beancount.el @@ -40,82 +40,72 @@ (defcustom beancount-transaction-indent 2 "Transaction indent." - :type 'integer - :group 'beancount) + :type 'integer) (defcustom beancount-number-alignment-column 52 "Column to which align numbers in postinng definitions. Set to 0 to automatically determine the minimum column that will allow to align all amounts." - :type 'integer - :group 'beancount) + :type 'integer) (defcustom beancount-highlight-transaction-at-point nil "If t highlight transaction under point." - :type 'boolean - :group 'beancount) + :type 'boolean) (defcustom beancount-use-ido t "If non-nil, use ido-style completion rather than the standard." - :type 'boolean - :group 'beancount) + :type 'boolean) + +(defcustom beancount-electricity t + "If non-nil, make some self-inserting keys electric. +Currently, only `newline' is electric, to add missing currency." + :type 'boolean) (defgroup beancount-faces nil "Beancount mode highlighting" :group 'beancount) (defface beancount-directive `((t :inherit font-lock-keyword-face)) - "Face for Beancount directives." - :group 'beancount-faces) + "Face for Beancount directives.") (defface beancount-tag `((t :inherit font-lock-type-face)) - "Face for Beancount tags." - :group 'beancount-faces) + "Face for Beancount tags.") (defface beancount-link `((t :inherit font-lock-type-face)) - "Face for Beancount links." - :group 'beancount-faces) + "Face for Beancount links.") (defface beancount-date `((t :inherit font-lock-constant-face)) - "Face for Beancount dates." - :group 'beancount-faces) + "Face for Beancount dates.") (defface beancount-account `((t :inherit font-lock-builtin-face)) - "Face for Beancount account names." - :group 'beancount-faces) + "Face for Beancount account names.") (defface beancount-amount `((t :inherit font-lock-default-face)) - "Face for Beancount amounts." - :group 'beancount-faces) + "Face for Beancount amounts.") (defface beancount-narrative `((t :inherit font-lock-builtin-face)) - "Face for Beancount transactions narrative." - :group 'beancount-faces) + "Face for Beancount transactions narrative.") (defface beancount-narrative-cleared `((t :inherit font-lock-string-face)) - "Face for Beancount cleared transactions narrative." - :group 'beancount-faces) + "Face for Beancount cleared transactions narrative.") (defface beancount-narrative-pending `((t :inherit font-lock-keyword-face)) - "Face for Beancount pending transactions narrative." - :group 'beancount-faces) + "Face for Beancount pending transactions narrative.") (defface beancount-metadata `((t :inherit font-lock-type-face)) - "Face for Beancount metadata." - :group 'beancount-faces) + "Face for Beancount metadata.") (defface beancount-highlight `((t :inherit highlight)) - "Face to highlight Beancount transaction at point." - :group 'beancount-faces) + "Face to highlight Beancount transaction at point.") (defconst beancount-account-directive-names '("balance" @@ -147,10 +137,10 @@ to align all amounts." "pushtag") "Directive names that can appear at the beginning of a line.") -(defvar beancount-directive-names - (append beancount-directive-names - beancount-timestamped-directive-names) - "A list of the directive names.") +;; (defvar
Re: [Bitbucket] Issue #392: Booking method not applied when used in included file (blais/beancount)
>> > BTW, as a quick note, purely textual include should be doable with >> > a simple wrapper script that invokes the c++ preprocessor frontend. >> Wouldn't that mess up line numbers and error messages? > Ahh yes. Beancount would have to honor the #line directives. There can be other surprises with CPP, since it's specifically designed for C/C++ and not for Beancount. We used to use CPP to generate Emacs's Makefile and there were a few oddities we had to work around (can't remember the details, but at least there were a few predefined CPP constants which caused undesired substitutions). Stefan -- You received this message because you are subscribed to the Google Groups "Beancount" group. To unsubscribe from this group and stop receiving emails from it, send an email to beancount+unsubscr...@googlegroups.com. To post to this group, send email to beancount@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/jwvr29awenm.fsf-monnier%2Bgmane.comp.finance.beancount%40gnu.org. For more options, visit https://groups.google.com/d/optout.
Re: [emacs] using ledger-mode for beancount
> I would like to upstream my changes, however, now that I know how I > would like the code to look like at the end, I would need to break up my > changes in a patchset and submit if for inclusion. This would require > some time investment. I haven't seen any interested from Martin about > those changes, thus am I reluctant to put that last bit of work in. Please please pretty please, Stefan -- You received this message because you are subscribed to the Google Groups "Beancount" group. To unsubscribe from this group and stop receiving emails from it, send an email to beancount+unsubscr...@googlegroups.com. To post to this group, send email to beancount@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/jwv1s350ymo.fsf-monnier%2Bgmane.comp.finance.beancount%40gnu.org. For more options, visit https://groups.google.com/d/optout.
Re: beancount-mode as a major mode
> mode into a major mode and use outline-minor-mode to preserve the > section folding functionality used by some. I adapted some code from > outshine-mode to allow headlines visibility cycling ala org-mode. Looks great, thank you. Could you submit `outline-cycle` as a patch to outline.el (via M-x report-emacs-bug) since it seems to be applicable to pretty much all outline-minor-modes? Stefan -- You received this message because you are subscribed to the Google Groups "Beancount" group. To unsubscribe from this group and stop receiving emails from it, send an email to beancount+unsubscr...@googlegroups.com. To post to this group, send email to beancount@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/jwvmunrmctz.fsf-monnier%2Bgmane.comp.finance.beancount%40gnu.org. For more options, visit https://groups.google.com/d/optout.
Re: beancount-mode as a major mode
> I renamed the two variables that control alignment. Now they are > beancount-transaction-indent and beancount-number-alignment-column. I recommend you preserve backward compatibility with `define-obsolete-variable-alias` (make sure you call it *before* you declare the new var name). Stefan -- You received this message because you are subscribed to the Google Groups "Beancount" group. To unsubscribe from this group and stop receiving emails from it, send an email to beancount+unsubscr...@googlegroups.com. To post to this group, send email to beancount@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/jwvsgxjmd28.fsf-monnier%2Bgmane.comp.finance.beancount%40gnu.org. For more options, visit https://groups.google.com/d/optout.
Re: [emacs] using ledger-mode for beancount
> problem you were seeing. What I would like to do now is to get rid of > the need for beancount-init-accounts Yes, please. > but I am afraid completion would slow down considerably in very > large buffers. If needed, judicious use of caching should do the trick. Stefan -- You received this message because you are subscribed to the Google Groups "Beancount" group. To unsubscribe from this group and stop receiving emails from it, send an email to beancount+unsubscr...@googlegroups.com. To post to this group, send email to beancount@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/jwvy37bmd5z.fsf-monnier%2Bgmane.comp.finance.beancount%40gnu.org. For more options, visit https://groups.google.com/d/optout.
Re: [emacs] using ledger-mode for beancount
> Is there a way to have basic org functionality (folding) with it as a major > mode? If so happy to convert You can try and call org-mode's folding command from some other major mode. I haven't tried it, so I don't know how well that would work. But that puts you right back to the original problem with TAB, I think (unless you want to use another key-binding). I think a lot of people would appreciate if someone were to add org-style "fold cycling" to outline-(minor-)-mode, so that could be another approach. Stefan > On Jan 7, 2019 06:24, "Stefano Zacchiroli" wrote: > > Hi Stefan, > > > On Sun, Jan 06, 2019 at 12:37:14PM -0500, Stefan Monnier wrote: >> AFAIK, this is because your major mode is org-mode which does its own >> thing with TAB. > > Right. > > Do you have any advice (and/or related work examples) on how to make > beancount-mode works both as a major and minor mode? > > I've never seen anything of the sort (and I know well that Martin is > keen in keeping beancount available as minor mode), but it should be > easy to do with different top-level entry points (M-x > beancount-{minor,major}-mode) that reuse most of the common code behind > the scenes, right? > > > Cheers > -- > Stefano Zacchiroli . z...@upsilon.cc . upsilon.cc/zack . . o . . . o . o > Computer Science Professor . CTO Software Heritage . . . . . o . . . o o > Former Debian Project Leader & OSI Board Director . . . o o o . . . o . > « the first rule of tautology club is the first rule of tautology club » > > -- > You received this message because you are subscribed to the Google Groups > "Beancount" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to beancount+unsubscr...@googlegroups.com. > To post to this group, send email to beancount@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/beancount/20190106192425.rnl2n7y3kaxncb4x%40upsilon.cc > . > > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Beancount" group. To unsubscribe from this group and stop receiving emails from it, send an email to beancount+unsubscr...@googlegroups.com. To post to this group, send email to beancount@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/jwv5zv0391p.fsf-monnier%2Bgmane.comp.finance.beancount%40gnu.org. For more options, visit https://groups.google.com/d/optout.
Re: [emacs] using ledger-mode for beancount
> - completion: I'm not sure how that is supposed to work. beancount-tab > as a function works well for accounts and tags (but not metadata > key/values, apparently), but if I bind it to TAB I lose indentation, > whereas in ledger-mode the two seems to work well together. Maybe I'm > not using it right AFAIK, this is because your major mode is org-mode which does its own thing with TAB. If beancount-mode is made into a major mode, you don't need beancount-tab at all, `completion-at-point` works for it (and setting `tab-always-indent` to `complete` will let the normal indent-for-tab-command do the completion). Stefan -- You received this message because you are subscribed to the Google Groups "Beancount" group. To unsubscribe from this group and stop receiving emails from it, send an email to beancount+unsubscr...@googlegroups.com. To post to this group, send email to beancount@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/jwva7kd4roe.fsf-monnier%2Bgmane.comp.finance.beancount%40gnu.org. For more options, visit https://groups.google.com/d/optout.
Re: is Beancount GPL2 or GPL2+ ?
> Yes, it's v2. No strong opinions about moving it to v3, I just don't > have time to review the implications. FWIW, long earlier discussions and analysis of the problem of "GPLv2-only for Linux" concluded that the GPL is one of the very rare licenses which doesn't *automatically/implicitly* say "or further versions". So if you don't have a strong opinion, I suggest you go with "or later", which is the recommended choice for the GPL and the apparently only choice for most other licenses. Stefan "firmly headed towards offtopic" -- You received this message because you are subscribed to the Google Groups "Beancount" group. To unsubscribe from this group and stop receiving emails from it, send an email to beancount+unsubscr...@googlegroups.com. To post to this group, send email to beancount@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/jwvk2c6m89z.fsf-monnier%2Bgmane.comp.finance.beancount%40gnu.org. For more options, visit https://groups.google.com/d/optout.
Re: beancount.el vs emacs keybinding conventions
> I've heard about the GNU prescription but in practice I've witnessed other > packages using the C-c key and it seems like it depends a bit on how > ominously package implementors have taken the word of GNU to the letter :-) Note that the issue is not with "the C-c key". It's with "C-c ", where `letter` doesn't mean "any event" but "a plain un-modified letter" as in "something that matches [[:alpha:]]". It's true that a fair number of modes use "C-c ", against the conventions, but I think it's still a minority. > (Stefan will probably want to weigh in at this point.) Hi Martin! Stefan "who thinks beancount-mode should be a major-mode" -- You received this message because you are subscribed to the Google Groups "Beancount" group. To unsubscribe from this group and stop receiving emails from it, send an email to beancount+unsubscr...@googlegroups.com. To post to this group, send email to beancount@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/jwvinrsnw1n.fsf-monnier%2Bgmane.comp.finance.beancount%40gnu.org. For more options, visit https://groups.google.com/d/optout.
Re: Is Python >=3.5 okay?
> I just realized Python 3.5.1 was released almost a year ago (12/7/2015). According to https://www.debian.org/releases/ The current "stable" distribution of Debian is version 8, codenamed jessie. It was initially released as version 8 on April 25th, 2015 and its latest update, version 8.6, was released on September 17th, 2016. so it seems 3.5 didn't even exist when the last `stable` was released (updates to a release focus mainly on security bugs). So "huge lag" sounds a bit harsh. Stefan > On Wed, Oct 26, 2016 at 9:42 AM, Stefan Monnier <monn...@iro.umontreal.ca> > wrote: >> > However, this would coerce everyone up to Python 3.5. >> >> That's annoying on Debian stable (about half my machines, including the >> one which I use most often with Beancount) which is still at 3.4. >> >> >> Stefan >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Beancount" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to beancount+unsubscr...@googlegroups.com. >> To post to this group, send email to beancount@googlegroups.com. >> To view this discussion on the web visit https://groups.google.com/d/ >> msgid/beancount/jwveg33tehl.fsf-monnier%2Bgmane.comp. >> finance.beancount%40gnu.org. >> For more options, visit https://groups.google.com/d/optout. >> > -- > You received this message because you are subscribed to the Google Groups > "Beancount" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to beancount+unsubscr...@googlegroups.com. > To post to this group, send email to beancount@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/beancount/CAK21%2BhOTLUJ9cgi5gxDbJvRBy6%2BXn_s-EMfhJUCRV_qajp4Akw%40mail.gmail.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Beancount" group. To unsubscribe from this group and stop receiving emails from it, send an email to beancount+unsubscr...@googlegroups.com. To post to this group, send email to beancount@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/jwv60oclg5p.fsf-monnier%2Bgmane.comp.finance.beancount%40gnu.org. For more options, visit https://groups.google.com/d/optout.
Re: Is Python >=3.5 okay?
> However, this would coerce everyone up to Python 3.5. That's annoying on Debian stable (about half my machines, including the one which I use most often with Beancount) which is still at 3.4. Stefan -- You received this message because you are subscribed to the Google Groups "Beancount" group. To unsubscribe from this group and stop receiving emails from it, send an email to beancount+unsubscr...@googlegroups.com. To post to this group, send email to beancount@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/jwveg33tehl.fsf-monnier%2Bgmane.comp.finance.beancount%40gnu.org. For more options, visit https://groups.google.com/d/optout.