From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alexander Adolf Newsgroups: gmane.emacs.devel Subject: Re: Inline completion preview Date: Mon, 30 Oct 2023 13:42:51 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40524"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eshel Yaron , Juri Linkov , Eli Zaretskii , emacs-devel@gnu.org To: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Oct 30 13:44:07 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qxRck-000AHa-9k for ged-emacs-devel@m.gmane-mx.org; Mon, 30 Oct 2023 13:44:06 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qxRbg-0003eO-17; Mon, 30 Oct 2023 08:43:00 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qxRbe-0003e3-Lc for emacs-devel@gnu.org; Mon, 30 Oct 2023 08:42:58 -0400 Original-Received: from smtprelay03.ispgateway.de ([80.67.18.15]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qxRbb-0002PB-T1; Mon, 30 Oct 2023 08:42:58 -0400 Original-Received: from [185.17.206.187] (helo=condition-alpha.com) by smtprelay03.ispgateway.de with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.1) (envelope-from ) id 1qxRbX-0004rr-2a; Mon, 30 Oct 2023 13:42:51 +0100 In-Reply-To: X-Df-Sender: YWxleGFuZGVyLmFkb2xmQGNvbmRpdGlvbi1hbHBoYS5jb20= Received-SPF: pass client-ip=80.67.18.15; envelope-from=alexander.adolf@condition-alpha.com; helo=smtprelay03.ispgateway.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:311991 Archived-At: Jo=C3=A3o T=C3=A1vora writes: > On Sun, Oct 29, 2023 at 4:25=E2=80=AFPM Alexander Adolf > wrote: >> >> Company provides an ecosystem of its own, and that can make one=E2=80=99= s setup more complicated. > > I agree it provides more abstractions then are essential, but you don't > have to use them. Eglot-managed buffers prefer the company-capf backend > by default and it works fine just fine. > > So the "complicated setup" you're looking for might just be one line: > > (setq company-backends '(company-capf)) Indeed. But the complexity I was intending to refer to came with integrating company with other 3rd party packages. Because of comapny's age (it predates some of Emacs's current completion infrastructure), many 3rd party packages have specific company adaptation code. As packages and Emacs evolve, an adaptation or two tend to break with each update. This kept my company config growing and growing. My corfu config is still as small as it was on day one. >> I have moved to corfu, which fully builds on Emacs=E2=80=99s ecosystem, = and >> have never looked back. > > company-capf is perfectly compatible with Emacs's completion functions > as well. It does. But in such a configuration you're only using a rather small subset of company's code. What's the point of having such a big codebase then? Lot sof unneeded complexity, IMHO. > Corfu has known problems with Eglot, for example. And it used to have with LSP. To my experience, in 99% of the cases the problem and the fix lies with the other package, which was not using Emacs's completion system properly (as was for instance teh case with LSP). > As far I understand, the way to fix them (presumably) is based on an > additional thing called "cape" which works by monkey patching Eglot's > functions via advice, which I don't think is really elegant. Cape can wrap completion code, which is not compliant with Emacs's completion framework, into wrapper functions which make it compliant with the interfaces Emacs provides for, and expects from completion functions. Thus, cape is a migration aid. You can switch from whatever you used before to corfu, and keep using all your legacy completion sources. This buys you time to find other completion sources which are good `completion-at-point` citizens to replace your legacy ones. > Also company works on TTY Emacs out of the box, and I think Corfu > doesn't. More stuff to add in. Corfu works with TTY Emacs of of the box, too. Under a graphical environment, corfu uses a frame provided by the graphical environment (for instance the window manager) to display the candidates. That way the display of the "popover" is independent of the fonts used in the buffer. Consider as an example an Org buffer, where the headings are rendered in a bigger font. Company will render popvover text in that area using the bigger font. Result with company: ---------------------------------------------------------------------- The quick brown fox jum +-------------+ | candidate 1 | * BIG FONT HEADING | CANDIDATE 2 | BIG FONT HEADING | CANDIDATE 2 | | candidate 3 | | candidate 4 | +-------------+ ---------------------------------------------------------------------- Duh! Company certainly showing its age here. Result with corfu: ---------------------------------------------------------------------- The quick brown fox jum +-------------+ | candidate 1 | * BIG FONT HEADING | candidate 2 | BIG FONT HEADING | candidate 3 |=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20 | candidate 4 | +-------------+ ---------------------------------------------------------------------- > So, as I see it, with Company you get hassle free completion by > customizing a way a bit of its functionality, whereas with Corfu you > have to add stuff to your .emacs. As I see it, it's really Corfu > that has the most complicated setup. My experience is the exact opposite. As mentioned, I used company for many years. I kept compiling complexities over complexities, and hacks for this and that in my dot-emacs. Making the switch to corfu was like a liberation. Tiny config, zero hassle ever since. Just my two cents anyway. --alexander