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 <alan.s...@polytechnique.org 
> <javascript:>> wrote:
> 
>         Hello,
> 
>         On 2018-04-07 14:30, John Rakestraw <john.a.r...@gmail.com 
> <javascript:>> 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 <javascript:>.
>         For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.
> 
>     -- 
>     Craig, Corona De Tucson, AZ
>     missile_flyout
>     enderw88.wordpress.com <http://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 
> <mailto: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.

Reply via email to