From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Adding support for xref jumping to headers/interfaces Date: Fri, 24 Feb 2023 22:04:00 +0200 Message-ID: <83bklin83z.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20868"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org, azeng@janestreet.com To: Spencer Baugh Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Feb 24 21:04:52 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 1pVeJH-0005As-Gb for ged-emacs-devel@m.gmane-mx.org; Fri, 24 Feb 2023 21:04:51 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pVeIU-0001sL-GZ; Fri, 24 Feb 2023 15:04:02 -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 1pVeIT-0001sB-ND for emacs-devel@gnu.org; Fri, 24 Feb 2023 15:04:01 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pVeIT-00060k-BG; Fri, 24 Feb 2023 15:04:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=umltttyd9pCrL3SuOG6evOzcZ6DlhIj0NFNzLXaiLjQ=; b=PUHVfmhgVTJg TikFX0/9stlXvvDgtrJoB9mSArhm6K3bqsJmtQZye31RuktVC7nsJqtprVR95zBSQhWMvRpNemCVD NkryaTGdZWs3UyubDP/if1M0pgLQBLSJN10Evc/RpSnH6lGFVz9uzNpt2BGCx9NkHE4cvqUO+efxX Xff1DQcM7odjBOy8eRUOYfuLJ4tTpezR76RQzQsKl4GmFARx6k8rkOvMwphX9YmpKgTpU8lxIenYZ sjwMNO6zSj8fW9cmtdYnxM4wzdhsvr8AVP8/gsolhqS6KAPaV/KOYx33MWv0SAm4q1JjYDlDAM+RJ 6kNFpWf2lF1kQlYa5ueh+g==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pVeIS-0008EA-Fq; Fri, 24 Feb 2023 15:04:00 -0500 In-Reply-To: (message from Spencer Baugh on Fri, 24 Feb 2023 14:56:59 -0500) 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:303760 Archived-At: > From: Spencer Baugh > Cc: azeng@janestreet.com > Date: Fri, 24 Feb 2023 14:56:59 -0500 > > > xref provides support for jump-to-definition, but no support for > jump-to-interface. The latter would jump to the header or interface > file for an identifier. This functionality exists in some packages > already because it is particularly important in some languages, and I'm > looking for suggestions on how to expose it through xref. > > For example, merlin, for OCaml, supports both jump-to-definition and > jump-to-interface. However, merlin's xref support only exposes > jump-to-definition (through xref-find-definitions), because there's no > natural way to expose jump-to-interface through xref. > > It would be straightforward to extend xref with a new command > xref-find-interfaces. The main difficulty is picking a good UI to > expose this command. I've thought of a few options, but nothing that > seems obviously correct, so I welcome opinions. > > Suppose there's a new command xref-find-interfaces. Then some options are: > > 1. xref-find-interfaces could be bound by default with some new binding. > I'm not sure what a good binding would be. > > 2. xref-find-definitions could call xref-find-interfaces if called with > a prefix argument. Note that this would change the current prefix > argument behavior of xref-find-definitions. > > 3. xref-find-definitions could call xref-find-interfaces if called after > some custom prefix is typed, like how other-window-prefix works. > > 4. xref-find-definitions could call xref-find-interfaces if a certain > customization variable is set. > > 5. Like option 5, but there could also be a new binding to > toggle that variable on and off. > > I think the most satisfying of these is option 3, but maybe that's too > unusual of an interface for core Emacs? I think 1 is the best alternative. C-M-? is available, AFAIK.