[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: LaTeX commands and packages names autocomplete.
From: |
Hongyi Zhao |
Subject: |
Re: LaTeX commands and packages names autocomplete. |
Date: |
Fri, 5 May 2023 07:58:31 +0800 |
On Fri, May 5, 2023 at 2:18 AM Arash Esbati <arash@gnu.org> wrote:
>
> Hongyi Zhao <hongyi.zhao@gmail.com> writes:
>
> > I should have also uncommented the above line. But even so, I have the
> > following problems:
> >
> > 1. I must at least type 3 letters to trigger the completion.
>
> ,----[ C-h v corfu-auto-prefix RET ]
> | corfu-auto-prefix is a variable defined in ‘corfu.el’.
> |
> | Its value is 3
> |
> | Minimum length of prefix for auto completion.
> | The completion backend can override this with
> | :company-prefix-length. It is *not recommended* to use a small
> | prefix length (below 2), since this will create high load for
> | Emacs. See also ‘corfu-auto-delay’.
> |
> | You can customize this variable.
> |
> `----
>
> > 2. Furthermore, my completion candidates list entries are less than
> > yours, as shown in the attached screenshot.
>
> If you take a closer look, you'll see that the screenshot I sent had
> also a candidate "because" since I hit TAB after only 2 characters, you
> have 3 characters "bec" in the buffer where the completion kicks in,
> hence one candidate is missing.
You're right. Set `(corfu-auto-prefix 2)` does the trick, as shown in
the attached screenshot.
> In your other mail, you wrote:
>
> > Another problem I noticed:
> >
> > 3. The speed of triggering the candidate list for the first time is
> > very slow, while company-mode does not seem to have this problem.
>
> I don't use use-package, but you'll know that it loads packages lazily,
> so if you're using corfu in your .tex file for the first in a fresh
> Emacs instance, it has to be loaded; maybe that's the reason. I observe
> the same thing if I deactivate corfu in a .tex buffer and activate
> company; it takes a sec before it's ready to go.
Now, I add the `:demand t` to the corfu's use-package configuration,
but the problem still remains:
(use-package corfu
:demand t
;; Optional customizations
:custom
;; (corfu-cycle t) ;; Enable cycling for `corfu-next/previous'
(corfu-auto t) ;; Enable auto completion
(corfu-auto-prefix 2)
;; (corfu-separator ?\s) ;; Orderless field separator
;; (corfu-quit-at-boundary nil) ;; Never quit at completion boundary
;; (corfu-quit-no-match nil) ;; Never quit, even if there is no match
;; (corfu-preview-current nil) ;; Disable current candidate preview
;; (corfu-preselect 'prompt) ;; Preselect the prompt
;; (corfu-on-exact-match nil) ;; Configure handling of exact matches
;; (corfu-scroll-margin 5) ;; Use scroll margin
;; Enable Corfu only for certain modes.
;; :hook ((prog-mode . corfu-mode)
;; (shell-mode . corfu-mode)
;; (eshell-mode . corfu-mode))
;; Recommended: Enable Corfu globally.
;; This is recommended since Dabbrev can be used globally (M-/).
;; See also `corfu-exclude-modes'.
:init
(global-corfu-mode))
;; A few more useful configurations...
(use-package emacs
:init
;; TAB cycle if there are only few candidates
;; (setq completion-cycle-threshold 3)
;; Emacs 28: Hide commands in M-x which do not apply to the current mode.
;; Corfu commands are hidden, since they are not supposed to be used via M-x.
;; (setq read-extended-command-predicate
;; #'command-completion-default-include-p)
;; Enable indentation+completion using the TAB key.
;; `completion-at-point' is often bound to M-TAB.
(setq tab-always-indent 'complete))
> Best, Arash
Regards, Zhao
image.png
Description: PNG image
- Re: LaTeX commands and packages names autocomplete., (continued)
- Re: LaTeX commands and packages names autocomplete., Hongyi Zhao, 2023/05/01
- Re: LaTeX commands and packages names autocomplete., Arash Esbati, 2023/05/02
- Re: LaTeX commands and packages names autocomplete., Hongyi Zhao, 2023/05/02
- Re: LaTeX commands and packages names autocomplete., Arash Esbati, 2023/05/02
- Re: LaTeX commands and packages names autocomplete., David Kastrup, 2023/05/02
- Re: LaTeX commands and packages names autocomplete., Arash Esbati, 2023/05/02
- Re: LaTeX commands and packages names autocomplete., Hongyi Zhao, 2023/05/04
- Re: LaTeX commands and packages names autocomplete., Hongyi Zhao, 2023/05/04
- Re: LaTeX commands and packages names autocomplete., Hongyi Zhao, 2023/05/04
- Re: LaTeX commands and packages names autocomplete., Arash Esbati, 2023/05/04
- Re: LaTeX commands and packages names autocomplete.,
Hongyi Zhao <=
- Re: LaTeX commands and packages names autocomplete., Hongyi Zhao, 2023/05/05
- Re: LaTeX commands and packages names autocomplete., Arash Esbati, 2023/05/05
- Re: LaTeX commands and packages names autocomplete., Hongyi Zhao, 2023/05/05
- Re: LaTeX commands and packages names autocomplete., Arash Esbati, 2023/05/05
- Re: LaTeX commands and packages names autocomplete., Hongyi Zhao, 2023/05/05
- Re: LaTeX commands and packages names autocomplete., Hongyi Zhao, 2023/05/05
- Re: LaTeX commands and packages names autocomplete., Hongyi Zhao, 2023/05/05
- Re: LaTeX commands and packages names autocomplete., Arash Esbati, 2023/05/05
- Re: LaTeX commands and packages names autocomplete., Hongyi Zhao, 2023/05/06
- Re: LaTeX commands and packages names autocomplete., Arash Esbati, 2023/05/06