From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Spencer Baugh Newsgroups: gmane.emacs.devel Subject: Adding support for xref jumping to headers/interfaces Date: Fri, 24 Feb 2023 14:56:59 -0500 Message-ID: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38622"; mail-complaints-to="usenet@ciao.gmane.io" Cc: azeng@janestreet.com To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Feb 24 21:01:08 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 1pVeFg-0009xh-5w for ged-emacs-devel@m.gmane-mx.org; Fri, 24 Feb 2023 21:01:08 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pVeF2-0000Lo-EN; Fri, 24 Feb 2023 15:00:29 -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 1pVeBk-000802-1e for emacs-devel@gnu.org; Fri, 24 Feb 2023 14:57:04 -0500 Original-Received: from mxout5.mail.janestreet.com ([64.215.233.18]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pVeBi-0002Jt-F6 for emacs-devel@gnu.org; Fri, 24 Feb 2023 14:57:03 -0500 Received-SPF: pass client-ip=64.215.233.18; envelope-from=sbaugh@janestreet.com; helo=mxout5.mail.janestreet.com 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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Fri, 24 Feb 2023 15:00:24 -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:303759 Archived-At: Hi, 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? Thoughts? Thanks, Spencer Baugh