From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#35737: xref--original-command Date: Tue, 14 May 2019 23:53:42 +0300 Organization: LINKOV.NET Message-ID: <87ftpgu59l.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="640"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) To: 35737@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue May 14 22:58:20 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hQeV9-0018HR-6b for geb-bug-gnu-emacs@m.gmane.org; Tue, 14 May 2019 22:58:19 +0200 Original-Received: from localhost ([127.0.0.1]:54019 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQeV8-0007nn-4f for geb-bug-gnu-emacs@m.gmane.org; Tue, 14 May 2019 16:58:18 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:38994) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQeUu-0007lR-P9 for bug-gnu-emacs@gnu.org; Tue, 14 May 2019 16:58:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hQeUt-0004NR-Bi for bug-gnu-emacs@gnu.org; Tue, 14 May 2019 16:58:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36474) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hQeUs-0004Le-MW for bug-gnu-emacs@gnu.org; Tue, 14 May 2019 16:58:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hQeUs-0005GS-J2 for bug-gnu-emacs@gnu.org; Tue, 14 May 2019 16:58:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 14 May 2019 20:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 35737 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.155786747220205 (code B ref -1); Tue, 14 May 2019 20:58:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 14 May 2019 20:57:52 +0000 Original-Received: from localhost ([127.0.0.1]:50015 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hQeUi-0005Fn-B0 for submit@debbugs.gnu.org; Tue, 14 May 2019 16:57:52 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:52731) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hQeUg-0005Fa-FE for submit@debbugs.gnu.org; Tue, 14 May 2019 16:57:51 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:48341) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hQeUb-0004Ds-94 for submit@debbugs.gnu.org; Tue, 14 May 2019 16:57:45 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:38829) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQeUa-0007X1-7s for bug-gnu-emacs@gnu.org; Tue, 14 May 2019 16:57:45 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hQeRi-0001uo-70 for bug-gnu-emacs@gnu.org; Tue, 14 May 2019 16:54:47 -0400 Original-Received: from bird.maple.relay.mailchannels.net ([23.83.214.17]:47929) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hQeRh-0001rN-Qu for bug-gnu-emacs@gnu.org; Tue, 14 May 2019 16:54:46 -0400 X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id EB4CE8C1AFD for ; Tue, 14 May 2019 20:54:43 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a88.g.dreamhost.com (100-96-5-25.trex.outbound.svc.cluster.local [100.96.5.25]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 551F18C15ED for ; Tue, 14 May 2019 20:54:43 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from pdx1-sub0-mail-a88.g.dreamhost.com ([TEMPUNAVAIL]. [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.17.2); Tue, 14 May 2019 20:54:43 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Robust-Hook: 3099d58977b96908_1557867283785_4173052338 X-MC-Loop-Signature: 1557867283784:3246773636 X-MC-Ingress-Time: 1557867283784 Original-Received: from pdx1-sub0-mail-a88.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a88.g.dreamhost.com (Postfix) with ESMTP id 13B04806DC for ; Tue, 14 May 2019 13:54:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to :subject:date:message-id:mime-version:content-type; s= linkov.net; bh=3OryTe5ZuVnbm2SiFZHlyGUjHKY=; b=JHCsRyd0JdDPV1mR7 IikG/bTtgm8h8+cTPpCXgUeBhCE3ZTIpobuZKMtauVTHL2E44d4pwzAUN7TIuodD OD/Aqiuid1M301r0QStYltgvTq0vaKC3s2/D1Zs71wJRgy2QZdE/ITaWpreEOAZ8 CH8SYM3CfFIpifzfDkpgZtkLbY= Original-Received: from mail.jurta.org (m91-129-96-230.cust.tele2.ee [91.129.96.230]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a88.g.dreamhost.com (Postfix) with ESMTPSA id E763B806D2 for ; Tue, 14 May 2019 13:54:37 -0700 (PDT) X-DH-BACKEND: pdx1-sub0-mail-a88 X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: 0 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduuddrleeigdduheehucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgdpffftgfetoffjqffuvfenuceurghilhhouhhtmecufedttdenucenucfjughrpefhvffuohffkfgfgggtsehttdertddtredtnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecukfhppeeluddruddvledrleeirddvfedtnecurfgrrhgrmhepmhhouggvpehsmhhtphdphhgvlhhopehmrghilhdrjhhurhhtrgdrohhrghdpihhnvghtpeeluddruddvledrleeirddvfedtpdhrvghtuhhrnhdqphgrthhhpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhhrtghpthhtohepsghughdqghhnuhdqvghmrggtshesghhnuhdrohhrghenucevlhhushhtvghrufhiiigvpedt X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:159291 Archived-At: Remembering the command that created the *xref* buffer will allow such customization to treat RET differently, i.e. it makes sense for RET to quit the transient xref buffer displayed momentarily while navigating code with xref-find-definitions, whereas leaving the xref buffer visible while navigating matches in the xref buffer created by e.g. project-find-regexp: (define-key xref--button-map [(control ?m)] (lambda () (interactive) (if (memq xref--original-command '(xref-find-definitions)) (call-interactively 'xref-quit-and-goto-xref) (call-interactively 'xref-goto-xref)))) Better ideas? diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index bf999aeb0d..5c38cac164 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -477,6 +477,9 @@ xref--original-window-intent (defvar-local xref--original-window nil "The original window this xref buffer was created from.") +(defvar-local xref--original-command nil + "The original command that created this xref buffer.") + (defun xref--show-pos-in-buf (pos buf) "Goto and display position POS of buffer BUF in a window. Honor `xref--original-window-intent', run `xref-after-jump-hook' @@ -777,7 +788,8 @@ xref--analyze (pop-to-buffer (current-buffer)) (goto-char (point-min)) (setq xref--original-window (assoc-default 'window alist) - xref--original-window-intent (assoc-default 'display-action alist)) + xref--original-window-intent (assoc-default 'display-action alist) + xref--original-command this-command) (current-buffer)))))