From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: David Morgan Newsgroups: gmane.emacs.devel Subject: Add xref-find-references-other-window and xref-find-references-other-frame to xref.el Date: Thu, 04 Aug 2022 15:30:52 +0000 Message-ID: Reply-To: David Morgan 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="6574"; mail-complaints-to="usenet@ciao.gmane.io" To: "emacs-devel@gnu.org" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Aug 04 17:33:12 2022 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 1oJcqW-0001SC-EM for ged-emacs-devel@m.gmane-mx.org; Thu, 04 Aug 2022 17:33:12 +0200 Original-Received: from localhost ([::1]:49180 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oJcqV-0000wH-9Y for ged-emacs-devel@m.gmane-mx.org; Thu, 04 Aug 2022 11:33:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55208) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oJcob-0007gK-UJ for emacs-devel@gnu.org; Thu, 04 Aug 2022 11:31:14 -0400 Original-Received: from mail-0201.mail-europe.com ([51.77.79.158]:40465) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oJcoZ-0008Un-IM for emacs-devel@gnu.org; Thu, 04 Aug 2022 11:31:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1659627060; x=1659886260; bh=OqvQnaQQAtkpaHzuwDDtwWaxIl8xg7t0PFaJd1y/EZM=; h=Date:To:From:Reply-To:Subject:Message-ID:Feedback-ID:From:To:Cc: Date:Subject:Reply-To:Feedback-ID:Message-ID; b=qRNmxGC2ss/YJPaMNbXqhmYYbmg4HihV/Yw0bJjx4BeqksypDVqkmOYy+Frie18oJ Dgx3OvysoTrU5jj67XgbaEjbS5ibkxuFJ+Ns64YzY0ENA4fsUMwh4gr2A8beiRjBAy i+ymC+o8ij81ls33BEplu//ZszR5hXYzyn9+Ol7cIUdNeS6qjkiFSm16NiEf58LijM QxRB9MS2e8dq3CQDtWNkZloI6haslKXKzsXJuQ2Fy76cGTQqhQCDO/oQbuP0r1ASTW 9HG+cA7372d7odGqJaHtIrcFN7sqQ8MDPaI9rTwfmc6AoNGK6mGWsk6t/ytgH5wY8y tT6rrgjRBU2hg== Feedback-ID: 22107024:user:proton Received-SPF: pass client-ip=51.77.79.158; envelope-from=djm_uk@protonmail.com; helo=mail-0201.mail-europe.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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" Xref: news.gmane.io gmane.emacs.devel:293071 Archived-At: I would like to add the functions xref-find-references-other-window and xre= f-find-references-other-frame (plus keybindings to xref.el). We already have xref-find-definitions-other-window (C-x 4 .) and xref-find-= definitions-other-frame (C-x 5 .), but xref-find-references (M-?) has no eq= uivalent other-window/frame versions. Please see the patch below, and let me know if it would be worthwhile to ad= d this. I am not clear on which other files I need to edit (I think it's etc/NEWS b= ut not ChangeLog.1), or on who would need to provide a commit message (me, = or someone with commit access). Some notes: 1. Following the key bindings for xref-find-definitions-other-*, I have us= ed C-x 4 ? and C-x 5 ? for these. The potential downside to this is that wh= ich-key allows ? as an equivalent to C-h (paging/help). So it may be better= to change them to "\M-?". I can provide an updated patch if so. 2. Currently the default value for xref-prompt-identifier is '(not xref-fin= d-definitions xref-find-definitions-other-window xref-find-definitions-othe= r-frame). My preference would be to add the existing xref-find-references f= unction to this, along with the two new ones. Would that be a good idea, an= d if so, would it need to be done separately, or could it be included in th= is patch? 3. I think this change is small enough to not need copyright assignment to = the FSF, but I am happy to do it now anyway. diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index f3db971bcf..04bf319fc4 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -1511,6 +1511,18 @@ is nil, prompt only if there's no usable symbol at p= oint." (interactive (list (xref--read-identifier "Find references of: "))) (xref--find-xrefs identifier 'references identifier nil)) +;;;###autoload +(defun xref-find-references-other-window (identifier) + "Like `xref-find-references' but switch to the other window." + (interactive (list (xref--read-identifier "Find references of: "))) + (xref--find-xrefs identifier 'references identifier 'window)) + +;;;###autoload +(defun xref-find-references-other-frame (identifier) + "Like `xref-find-references' but switch to the other frame." + (interactive (list (xref--read-identifier "Find references of: "))) + (xref--find-xrefs identifier 'references identifier 'frame)) + (defun xref-find-references-and-replace (from to) "Replace all references to identifier FROM with TO." (interactive @@ -1598,6 +1610,8 @@ output of this command when the backend is etags." ;;;###autoload (define-key esc-map [?\C-.] #'xref-find-apropos) ;;;###autoload (define-key ctl-x-4-map "." #'xref-find-definitions-other-w= indow) ;;;###autoload (define-key ctl-x-5-map "." #'xref-find-definitions-other-f= rame) +;;;###autoload (define-key ctl-x-4-map "?" #'xref-find-references-other-wi= ndow) +;;;###autoload (define-key ctl-x-5-map "?" #'xref-find-references-other-fr= ame) ^L ;;; Helper functions