From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: Adding support for xref jumping to headers/interfaces Date: Sun, 5 Mar 2023 23:21:03 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17365"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Cc: Helmut Eller , emacs-devel To: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Mar 05 22:22:02 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 1pYvnt-0004Hs-PC for ged-emacs-devel@m.gmane-mx.org; Sun, 05 Mar 2023 22:22:01 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pYvn9-0008BA-98; Sun, 05 Mar 2023 16:21:15 -0500 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 1pYvn5-00089M-9v for emacs-devel@gnu.org; Sun, 05 Mar 2023 16:21:12 -0500 Original-Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pYvn1-0003Sf-Ub for emacs-devel@gnu.org; Sun, 05 Mar 2023 16:21:10 -0500 Original-Received: by mail-wr1-x42d.google.com with SMTP id r18so6992231wrx.1 for ; Sun, 05 Mar 2023 13:21:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678051266; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=91+/Uu0bxMGfDP0H2koUKeDt4vRCnMClG9ZF9BIou3A=; b=eUys/L8q98UvMUfyeT1WuoMVj8ChwRCoffLpmznxwqVR+kQQaUtGSSSHZlSIaU1gde z35wdRyH4wL9zEziPiLC3KGzxQCe/KF2S86zbdWLOWywzBSqyv8jNlaN9KpOGj/S5DIg V2t19lorrz10ouULLuAb4KzyUkB02ZjGFttpKtrdNdL9H5k7l+0jkzIEOhYZRPMh+I3O 0A7aXUpxSn7ToYDVxinAOSzO/mPX7X/qRfA2VcQPWd3RgHPbUqokZlUkP/LutW1nl2mx uzougoDoM0m1CLvVLac/jDrl0iZv5F4ax9GUb+iJLJqI8yQCaoKMaPc1aJdIVPrvfp+1 llfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678051266; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=91+/Uu0bxMGfDP0H2koUKeDt4vRCnMClG9ZF9BIou3A=; b=dam1CpONxyJBSonsSeyGkjip/0Ilg0VoVevVYMrzzV5PmCtgSVu+eqwNR/Tu13QM7u gwnLOhQ6HS/EVMAajTVwLYXCJa7YaGGbG+C0KH4y+fW1yg10FeMSEyQ8x7tbP+wb+2wl ZHsRNGHYCFXH4cX2T9EFNmcOqOz+4ZEggz7AIfWjjDtSpF2cs27Uol0rwMj7B++7/SBX NKjb3WVNor4X0GpGYPXY/v+HLBK99tC/CAQ2h9fuDanc4WVk6OQbFiLt6LO7Lj0vDH73 npGi3JIblg73HqzSyTddxug3YYIfVxB2ngJWEi1UDJ9goD6jwCaQ2Uc9Iw7phw4e6unr ALBA== X-Gm-Message-State: AO0yUKVHxS1ApsNuUfBum4e0WFB734SH8d/Sv1LDLEQLVO64iIamp02E PQJYhaKYW7qfhOZ6Z8pnnbs= X-Google-Smtp-Source: AK7set++CXB8mqL69tyi2mPItSWI+mD6T8y4pDn8YLXGp6OEKa+Egqj4c5oGK9GDtBpZhiWl1xLB5w== X-Received: by 2002:adf:e70a:0:b0:2c9:e3d:88ca with SMTP id c10-20020adfe70a000000b002c90e3d88camr5414339wrm.67.1678051265711; Sun, 05 Mar 2023 13:21:05 -0800 (PST) Original-Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id bl18-20020adfe252000000b002cdbb26bb48sm8317975wrb.33.2023.03.05.13.21.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 05 Mar 2023 13:21:05 -0800 (PST) Content-Language: en-US In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=raaahh@gmail.com; helo=mail-wr1-x42d.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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:303997 Archived-At: On 05/03/2023 23:04, João Távora wrote: > > On Sun, Mar 5, 2023, 20:40 Dmitry Gutov > wrote: > > On 05/03/2023 22:32, João Távora wrote: > > To clarify, i think the thin commands and the keybinds should be > in the > > major modes, but these commands should be thin and use xref as a > > library. And the backend should be Eglot's,  if it happens to be > > managing the buffer via LSP, else out can be whatever the major > modes > > sets up. > > xref-find-declarations should be bound by major modes? Which modes? > > > No, you misunderstand. I wrote "commands and keybinds should be in the > major mode". Xref-find-declarations should not exist, because > declaration is not a universal thing common to all languages. That was > Helmut's point AFAIU, and i agree with it. Okay, let's follow on with that idea. > Which modes? The ones where "declaration" is a thing. So we'll have a dozen different commands called 'xxx-find-declarations' which will be implemented the same (?) way? Bound to the same key sequence? If there a particular point to doing that? Do we expect other modes to reuse the same binding to do something else? That will reduce UI consistency, at the very least. > IOW xref should try to stay language-agnostic, but provide common > framework for language-specific things like major modes to reach > backends like Eglot or anything else Most programming languages have something that corresponds to the term "declaration". > Mind you the same point made for xref can be made about LSP, > language-agnostic on paper, but many a language-specific concept poorly > disguised in there. But I see no reason to copy that flaw. I don't mind the idea of extensibility (and packages like lsp-mode do this already: IIRC they have commands called lsp-find-declarations and lsp-find-implementations). But insofar as languages do have shared syntactic concepts, I don't see why we wouldn't want to include more common ones.