On Fri, May 5, 2023 at 6:21 PM Hongyi Zhao <hongyi.z...@gmail.com> wrote:
>
> On Fri, May 5, 2023 at 5:58 PM Hongyi Zhao <hongyi.z...@gmail.com> wrote:
> >
> > On Fri, May 5, 2023 at 4:17 PM Arash Esbati <ar...@gnu.org> wrote:
> > >
> > > Hongyi Zhao <hongyi.z...@gmail.com> writes:
> > >
> > > > Perhaps the simplest solution is to use the cape to interface to
> > > > well-developed backends.
> > >
> > > Please feel free to try it out; maybe you report back how good it works
> > > with other available backends.  I'd be curious to know how good
> > > completion for package names in \usepackage{<point-here>} and
> > > corresponding package options works.
> >
> > My previous experience of such completions has been based on specific
> > backends of company-mode. It seems that they do not provide package
> > options completion.
> >
> > > I suspect that in your other message[1], you wanted to complete to 
> > > 'hyperref';
> >
> > Yes.
> >
> > > that's a good example for your experiments.
> >
> > I got the inspiration from the discussions below, but it still seems
> > complicated to me to figure them out completely:
> >
> > Using Corfu and Company simultaneously in different modes.
> > https://github.com/minad/corfu/issues/321
> >
> > In-buffer completion for normal text/word with ispell + corfu + orderless.
> > https://github.com/minad/corfu/issues/323
>
> And also the shockingly powerful description of cape given in its document 
> [1]:
>
> Cape has the super power to transform Company backends into Capfs and
> merge multiple Capfs into a Super-Capf! These transformers allow you
> to still take advantage of Company backends even if you are not using
> Company as frontend.
>
> [1] https://github.com/minad/cape#capeel---let-your-completions-fly

I conducted some simple testings using the official example
configuration as follows:

(use-package cape
  ;; Bind dedicated completion commands
  ;; Alternative prefix keys: C-c p, M-p, M-+, ...
  :bind (("C-c p p" . completion-at-point) ;; capf
         ("C-c p t" . complete-tag)        ;; etags
         ("C-c p d" . cape-dabbrev)        ;; or dabbrev-completion
         ("C-c p h" . cape-history)
         ("C-c p f" . cape-file)
         ("C-c p k" . cape-keyword)
         ("C-c p s" . cape-symbol)
         ("C-c p a" . cape-abbrev)
         ("C-c p l" . cape-line)
         ("C-c p w" . cape-dict)
         ("C-c p \\" . cape-tex)
         ("C-c p _" . cape-tex)
         ("C-c p ^" . cape-tex)
         ("C-c p &" . cape-sgml)
         ("C-c p r" . cape-rfc1345))
  :init
  ;; Add `completion-at-point-functions', used by `completion-at-point'.
  ;; NOTE: The order matters!
  (add-to-list 'completion-at-point-functions #'cape-dabbrev)
  (add-to-list 'completion-at-point-functions #'cape-file)
  ;; (add-to-list 'completion-at-point-functions #'cape-elisp-block)
  ;;(add-to-list 'completion-at-point-functions #'cape-history)
  (add-to-list 'completion-at-point-functions #'cape-keyword)
  ;; (add-to-list 'completion-at-point-functions #'cape-tex)
  ;;(add-to-list 'completion-at-point-functions #'cape-sgml)
  ;;(add-to-list 'completion-at-point-functions #'cape-rfc1345)
  (add-to-list 'completion-at-point-functions #'cape-abbrev)
  (add-to-list 'completion-at-point-functions #'cape-dict)
  ;;(add-to-list 'completion-at-point-functions #'cape-symbol)
  ;; (add-to-list 'completion-at-point-functions #'cape-line)

  ;; Use Company backends as Capfs.
  (setq-local completion-at-point-functions
          (mapcar #'cape-company-to-capf
              (list #'company-files #'company-ispell #'company-dabbrev)))
  )


At this point, the completion result is clearly incorrect. Therefore,
further precise control is necessary.

> > > Best, Arash
> >
> > Best Regards,
> > Zhao
> >
> > > Footnotes:
> > > [1]  https://lists.gnu.org/archive/html/auctex/2023-05/msg00053.html

Reply via email to