Auto-completion on Tab in Emacs?

288 views
Skip to first unread message

Oscar

unread,
Sep 23, 2019, 2:56:56 PM9/23/19
to Ledger
Hi,

I can't seem to have auto-completion to work when I press tab in ledger-mode in Emacs .

Previous versions I never had this problem. Is this a bug? It does indent but pressing tab doesn't do the autocomplete.

Not sure if I am missing any packages or something. Appreciate if someone could help with this.

Thanks!

Richard Lawrence

unread,
Sep 23, 2019, 3:16:52 PM9/23/19
to Oscar, Ledger
Hi Oscar,

Oscar <orzya...@gmail.com> writes:

> I can't seem to have auto-completion to work when I press tab in
> ledger-mode in Emacs .
>
> Previous versions I never had this problem. Is this a bug? It does indent
> but pressing tab doesn't do the autocomplete.

This was changed recently; I noticed it too when I recently upgraded
ledger-mode. Discussion here: https://github.com/ledger/ledger-mode/pull/174

To get (something like) the old behavior back, you can do:

(add-hook 'ledger-mode-hook
(lambda ()
(setq-local tab-always-indent 'complete)
(setq-local completion-cycle-threshold t)
(setq-local ledger-complete-in-steps t)))

I found that this solution was not quite satisfying; whatever the old
version did to guess the ordering of completions was better. But I also
recently decided to try out Ivy for completion; with ivy-mode on, I find
this is enough:

(add-hook 'ledger-mode-hook
(lambda ()
(setq-local tab-always-indent 'complete)
(setq-local completion-cycle-threshold t)))


--
HTH,
Richard

Oscar

unread,
Sep 23, 2019, 4:08:31 PM9/23/19
to Ledger
Hi Richard,

Ah i see ...  Yes it seems to be a debatable topic. Thanks for pointing the link .

I personally liked the tab completion. Sorry, but my understanding of emacs is a bit limited . Where do i add these codes ? In the init.el?



 
(add-hook 'ledger-mode-hook
            (lambda ()
             (setq-local tab-always-indent '
complete)
             
(setq-local completion-cycle-threshold t)
             
(setq-local ledger-complete-in-steps t)))
...


Message has been deleted

Alexandre Rademaker

unread,
Sep 24, 2019, 7:07:52 AM9/24/19
to ledge...@googlegroups.com, Oscar

From https://github.com/ledger/ledger-mode/pull/174, it looks like the functionality was not removed but replaced by something that I didn’t understand yet. It worked for me the code:

(add-hook 'ledger-mode-hook
(lambda ()
(setq-local tab-always-indent 'complete)
(setq-local completion-cycle-threshold t)))

But I am curious to understand the discussion above. Does anyone here knows what was the idea? What is the best solution for completion (mainly of account names in my case) in ledger mode?

Best,

--
Alexandre Rademaker
http://arademaker.github.io
Reply all
Reply to author
Forward
0 new messages