Re: ledger.el *very* slow to load account names

2018-04-12 Thread Clément Pit-Claudel
Can you try adding the following to your .emacs?

(package-initialize)
(require 'ledger-mode)

(defun ledger-accounts-deduplicate-sorted (l)
  "Remove duplicates from a sorted list of strings L."
  (let ((current l))
(while (consp current)
  (if (string= (car current) (cadr current))
  (setcdr current (cddr current))
(pop current)))
l))

(defun ledger-accounts-list-in-buffer ()
  "Return a list of all known account names in the current buffer as strings.
Considers both accounts listed in postings and those declared with \"account\" 
directives."
  (save-excursion
(goto-char (point-min))
(let (results)
  (while (re-search-forward ledger-account-name-or-directive-regex nil t)
(setq results (cons (match-string-no-properties 2) results)))
  (ledger-accounts-deduplicate-sorted
   (sort results #'ledger-string-greaterp)

This patches ledger-accounts-list-in-buffer to use a linear-time deduplication 
(rather than quadratic).

Clément.

On 2018-04-12 19:44, John Rakestraw wrote:
> Thanks for this hint, Craig, and thanks for the confirmation that you've 
> observed the same problem, Alan.
> 
> 
> I deleted the elpa version of ledger-mode and cloned the git repo. I don't 
> have time to work with the regex now (especially since my regex-fu is 
> virtually non-existent), but I can confirm that commit 
> 42c48b34bcedf913eb368edf45adbcdf5207e2e3 on Dec 7, 2017 broke ledger-mode in 
> my set-up. 
> 
> 
> I'm happy to work with someone else who knows regex and the code to sort out 
> just what in my account structure is choking the later commits, but for now 
> I'm happy with commit 24b43e34dd34de23e54d7ddaa2a147efda6af03d from last 
> September. You might try that as well, Alan.
> 
> 
> --John
> 
> 
> 
> 
> On Monday, April 9, 2018 at 6:40:34 AM UTC-4, Craig Earls wrote:
> 
> From time to time well intentioned people try to improve the regexs.  I 
> don’t keep up with the latest code any more because my workflow is fine and I 
> am more worried about breaking it than keeping up with new features.  Check 
> to see if there has been a change to the regexs. Several years ago Thierry 
> Bouton was having a similar problem and I spent a few months optimizing them 
> to get them faster.  I necessarily left out some corner case to get a 
> performance improvement. 
> 
> Craig 
> 
> On Mon, Apr 9, 2018 at 03:44 Alan Schmitt  > wrote:
> 
> Hello,
> 
> On 2018-04-07 14:30, John Rakestraw  > writes:
> 
> > - I tab to autocomplete an account name. For example, if I type 
> "Expe" and
> > then hit tab, it takes literally 10 seconds to complete to 
> "Expenses:".
> 
> I have observed the same thing. It changed suddenly from being
> instantaneous to taking a long time a couple months ago.
> 
> Alan
> 
> --
> OpenPGP Key ID : 040D0A3B4ED2E5C7
> Monthly Athmospheric CO₂, Mauna Loa Obs. 2018-02: 408.35, 2017-02: 
> 406.42
> 
> --
> 
> ---
> 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 .
> For more options, visit https://groups.google.com/d/optout 
> .
> 
> -- 
> Craig, Corona De Tucson, AZ
> missile_flyout
> enderw88.wordpress.com 
> 
> -- 
> 
> ---
> 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+unsubscr...@googlegroups.com 
> .
> For more options, visit https://groups.google.com/d/optout.

-- 

--- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: ledger.el *very* slow to load account names

2018-04-12 Thread Clément Pit-Claudel
What makes you think regexps are involved?
>From the profile you posted earlier, the culprit (duplicate removal in 
>completion candidates) seems clear.

Clément.

On 2018-04-12 19:44, John Rakestraw wrote:
> Thanks for this hint, Craig, and thanks for the confirmation that you've 
> observed the same problem, Alan.
> 
> 
> I deleted the elpa version of ledger-mode and cloned the git repo. I don't 
> have time to work with the regex now (especially since my regex-fu is 
> virtually non-existent), but I can confirm that commit 
> 42c48b34bcedf913eb368edf45adbcdf5207e2e3 on Dec 7, 2017 broke ledger-mode in 
> my set-up. 
> 
> 
> I'm happy to work with someone else who knows regex and the code to sort out 
> just what in my account structure is choking the later commits, but for now 
> I'm happy with commit 24b43e34dd34de23e54d7ddaa2a147efda6af03d from last 
> September. You might try that as well, Alan.
> 
> 
> --John
> 
> 
> 
> 
> On Monday, April 9, 2018 at 6:40:34 AM UTC-4, Craig Earls wrote:
> 
> From time to time well intentioned people try to improve the regexs.  I 
> don’t keep up with the latest code any more because my workflow is fine and I 
> am more worried about breaking it than keeping up with new features.  Check 
> to see if there has been a change to the regexs. Several years ago Thierry 
> Bouton was having a similar problem and I spent a few months optimizing them 
> to get them faster.  I necessarily left out some corner case to get a 
> performance improvement. 
> 
> Craig 
> 
> On Mon, Apr 9, 2018 at 03:44 Alan Schmitt  > wrote:
> 
> Hello,
> 
> On 2018-04-07 14:30, John Rakestraw  > writes:
> 
> > - I tab to autocomplete an account name. For example, if I type 
> "Expe" and
> > then hit tab, it takes literally 10 seconds to complete to 
> "Expenses:".
> 
> I have observed the same thing. It changed suddenly from being
> instantaneous to taking a long time a couple months ago.
> 
> Alan
> 
> --
> OpenPGP Key ID : 040D0A3B4ED2E5C7
> Monthly Athmospheric CO₂, Mauna Loa Obs. 2018-02: 408.35, 2017-02: 
> 406.42
> 
> --
> 
> ---
> 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 .
> For more options, visit https://groups.google.com/d/optout 
> .
> 
> -- 
> Craig, Corona De Tucson, AZ
> missile_flyout
> enderw88.wordpress.com 
> 
> -- 
> 
> ---
> 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+unsubscr...@googlegroups.com 
> .
> For more options, visit https://groups.google.com/d/optout.

-- 

--- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: ledger.el *very* slow to load account names

2018-04-12 Thread John Rakestraw


Thanks for this hint, Craig, and thanks for the confirmation that you've 
observed the same problem, Alan.


I deleted the elpa version of ledger-mode and cloned the git repo. I don't 
have time to work with the regex now (especially since my regex-fu is 
virtually non-existent), but I can confirm that commit 
42c48b34bcedf913eb368edf45adbcdf5207e2e3 on Dec 7, 2017 broke ledger-mode 
in my set-up. 


I'm happy to work with someone else who knows regex and the code to sort 
out just what in my account structure is choking the later commits, but for 
now I'm happy with commit 24b43e34dd34de23e54d7ddaa2a147efda6af03d from 
last September. You might try that as well, Alan.


--John



On Monday, April 9, 2018 at 6:40:34 AM UTC-4, Craig Earls wrote:
>
> From time to time well intentioned people try to improve the regexs.  I 
> don’t keep up with the latest code any more because my workflow is fine and 
> I am more worried about breaking it than keeping up with new features.  
> Check to see if there has been a change to the regexs. Several years ago 
> Thierry Bouton was having a similar problem and I spent a few months 
> optimizing them to get them faster.  I necessarily left out some corner 
> case to get a performance improvement. 
>
> Craig 
>
> On Mon, Apr 9, 2018 at 03:44 Alan Schmitt  > wrote:
>
>> Hello,
>>
>> On 2018-04-07 14:30, John Rakestraw  
>> writes:
>>
>> > - I tab to autocomplete an account name. For example, if I type "Expe" 
>> and
>> > then hit tab, it takes literally 10 seconds to complete to "Expenses:".
>>
>> I have observed the same thing. It changed suddenly from being
>> instantaneous to taking a long time a couple months ago.
>>
>> Alan
>>
>> --
>> OpenPGP Key ID : 040D0A3B4ED2E5C7
>> Monthly Athmospheric CO₂, Mauna Loa Obs. 2018-02: 408.35, 2017-02: 406.42
>>
>> --
>>
>> ---
>> 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 .
>> For more options, visit https://groups.google.com/d/optout.
>>
> -- 
> Craig, Corona De Tucson, AZ
> [image: missile_flyout]
> enderw88.wordpress.com
>

-- 

--- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Monthly balance position

2018-04-12 Thread John Wiegley
> "RL" == Richard Lawrence  writes:

RL> I don't think so, at least not with regular ledger. I'd be happy to be
RL> proven wrong, though! I have also wanted this feature.

You can use:

ledger --group-by 'format_date(date, "%Y/%m")' bal

John

-- 

--- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Monthly balance position

2018-04-12 Thread Klauss Hass
Thanks for the heads up.

Did a quick test and it seems that it helps a lot. Though hledger commodity 
directive isn’t working very well. My final checking account balance shows 7 
decimal cases, similar problem as the one found here 
https://github.com/simonmichael/hledger/issues/295 
 and 
https://github.com/simonmichael/hledger/issues/262 
 I’m using hledger 1.9 from 
homebrew.

Tried using the commodity directive found here 
http://hledger.org/journal.html#commodity-directive 
 by putting the line 

commodity R$ 1.000,00

In the beginning of the file that pulls my other ledger files but it didn’t 
seem to work. I’ll keep trying though I’ve never given hledger much thought, 
though it feels much slower than ledger.


> On 12 Apr 2018, at 15:01, Richard Lawrence  wrote:
> 
> Hi Klauss,
> Klauss Hass  writes:
> 
>> Is there any way to use the argument —monthly or --weekly for bal 
>> transactions?  I value my assets weekly and it would be useful to see the 
>> month ending value variation of my assets:investments accounts along with 
>> the -V argument.
> 
> I don't think so, at least not with regular ledger.  I'd be happy to be 
> proven wrong, though! I have also wanted this feature.
> 
> hledger (hledger.org), however, does allow --monthly (and similar flags) with 
> the balance command.  You might want to check that out.
> 
> -- 
> Best,
> Richard

-- 

--- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Monthly balance position

2018-04-12 Thread Richard Lawrence

Hi Klauss,

Klauss Hass  writes:

Is there any way to use the argument —monthly or --weekly for 
bal transactions?  I value my assets weekly and it would be 
useful to see the month ending value variation of my 
assets:investments accounts along with the -V argument.


I don't think so, at least not with regular ledger.  I'd be happy 
to be proven wrong, though! I have also wanted this feature.


hledger (hledger.org), however, does allow --monthly (and similar 
flags) with the balance command.  You might want to check that 
out.


--
Best,
Richard

--

--- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Monthly balance position

2018-04-12 Thread Klauss Hass
Is there any way to use the argument —monthly or --weekly for bal transactions?
I value my assets weekly and it would be useful to see the month ending value 
variation of my assets:investments accounts along with the -V argument.

Now I have to manually collect the position using the argument -e “date”, save 
it on Excel and analyze in order to analyze them and there is probably a better 
way to do it.

Thanks

-- 

--- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.