From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#33870: 27.0.50; xref-goto-xref not configurable Date: Thu, 03 Jan 2019 02:18:50 +0200 Organization: LINKOV.NET Message-ID: <878t02egph.fsf@mail.linkov.net> References: <87a7ktqqx7.fsf@mail.linkov.net> <9215183d-0a44-88b5-5b3c-d0da31f749ad@yandex.ru> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1546474874 23980 195.159.176.226 (3 Jan 2019 00:21:14 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 3 Jan 2019 00:21:14 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) Cc: 33870@debbugs.gnu.org, Dmitry Gutov To: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jan 03 01:21:10 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from listsout.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1geql1-000670-Uy for geb-bug-gnu-emacs@m.gmane.org; Thu, 03 Jan 2019 01:21:08 +0100 Original-Received: from localhost ([127.0.0.1]:48126 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1geqn8-0004Gy-KF for geb-bug-gnu-emacs@m.gmane.org; Wed, 02 Jan 2019 19:23:18 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:36248) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1geqn1-0004Gr-9v for bug-gnu-emacs@gnu.org; Wed, 02 Jan 2019 19:23:12 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1geqmt-00086b-O2 for bug-gnu-emacs@gnu.org; Wed, 02 Jan 2019 19:23:09 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:37945) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1geqms-00085f-JS for bug-gnu-emacs@gnu.org; Wed, 02 Jan 2019 19:23:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1geqms-0001qh-CE for bug-gnu-emacs@gnu.org; Wed, 02 Jan 2019 19:23:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 03 Jan 2019 00:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33870 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 33870-submit@debbugs.gnu.org id=B33870.15464749277022 (code B ref 33870); Thu, 03 Jan 2019 00:23:02 +0000 Original-Received: (at 33870) by debbugs.gnu.org; 3 Jan 2019 00:22:07 +0000 Original-Received: from localhost ([127.0.0.1]:45067 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1geqlz-0001pC-BG for submit@debbugs.gnu.org; Wed, 02 Jan 2019 19:22:07 -0500 Original-Received: from golden.birch.relay.mailchannels.net ([23.83.209.73]:57837) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1geqlx-0001p2-0g for 33870@debbugs.gnu.org; Wed, 02 Jan 2019 19:22:05 -0500 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 BA8535E24DE; Thu, 3 Jan 2019 00:22:03 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a23.g.dreamhost.com (unknown [100.96.30.62]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 79B395E22CF; Thu, 3 Jan 2019 00:22:03 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from pdx1-sub0-mail-a23.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.16.2); Thu, 03 Jan 2019 00:22:03 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Absorbed-Stop: 6ff32b4755d1c126_1546474923620_3176056191 X-MC-Loop-Signature: 1546474923620:716224017 X-MC-Ingress-Time: 1546474923619 Original-Received: from pdx1-sub0-mail-a23.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a23.g.dreamhost.com (Postfix) with ESMTP id 2061C80028; Wed, 2 Jan 2019 16:22:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=linkov.net; bh=9j/u6JQRBQ2jUHBjOAw2xLKN1Ck=; b= zc/Mt9pL64otPn2vXAI2Ni54ZedQvbCpkocWTmrUwK197la4WsAL/7rNALCqx75y Nb5zzcIi2Wiqfc5PR2aurrW8wBptNZXz2IQ4AZCUh4yhDpZvZCvDWVlmaJOG4+Ax HEOUpPrFrHPxWlg7b2BfehjrxsR5ACJ5SGEcNt5CLoU= Original-Received: from mail.jurta.org (m91-129-100-233.cust.tele2.ee [91.129.100.233]) (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-a23.g.dreamhost.com (Postfix) with ESMTPSA id B21958005F; Wed, 2 Jan 2019 16:22:00 -0800 (PST) X-DH-BACKEND: pdx1-sub0-mail-a23 In-Reply-To: ("=?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?="'s message of "Wed, 26 Dec 2018 14:48:31 +0000") X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: -100 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedtledrudejgddvgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucggtfgfnhhsuhgsshgtrhhisggvpdfftffgtefojffquffvnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffuohhfffgjkfgfgggtsehmtderredtreejnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecukfhppeeluddruddvledruddttddrvdeffeenucfrrghrrghmpehmohguvgepshhmthhppdhhvghlohepmhgrihhlrdhjuhhrthgrrdhorhhgpdhinhgvthepledurdduvdelrddutddtrddvfeefpdhrvghtuhhrnhdqphgrthhhpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhhrtghpthhtohepjhhorghothgrvhhorhgrsehgmhgrihhlrdgtohhmnecuvehluhhsthgvrhfuihiivgeptd 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: 208.118.235.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:154097 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Jo=C3=A3o > Any simplification to the implementation that keeps the > "keep original window intent" behavior across xref > intermediate buffers is very welcome. Thanks for the explanation. Now I understand better the intent in xref--show-pos-in-buf. Generally, I'd like to see the =E2=80=9Ckeep orig= inal window intent=E2=80=9D behavior in more places, e.g. in *Occur*, *grep*, = etc. Based on your explanation, I've been able to write the patch that does the following: 1. simplifies =E2=80=98xref--show-pos-in-buf=E2=80=99 while at the same t= ime preserves the current behavior and respects user's customization of display actions; 2. makes the xref buffer non-obtrusive like *Completions* in xref--show-xref-buffer; 3. turns the existing arg QUIT of xref-goto-xref into a prefix arg, so a natural key sequence =E2=80=98C-u RET=E2=80=99 will quit the wind= ow. This is similar to the prefix arg of quit-window. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=xref.el.patch diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 87ce2299c5..a166f8299c 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -482,19 +482,9 @@ xref--show-pos-in-buf (window-live-p xref--original-window) (or (not (window-dedicated-p xref--original-window)) (eq (window-buffer xref--original-window) buf))) - `(,(lambda (buf _alist) - (set-window-buffer xref--original-window buf) - xref--original-window)))))) - (with-selected-window - (with-selected-window - ;; Just before `display-buffer', place ourselves in the - ;; original window to suggest preserving it. Of course, if - ;; user has deleted the original window, all bets are off, - ;; just use the selected one. - (or (and (window-live-p xref--original-window) - xref--original-window) - (selected-window)) - (display-buffer buf action)) + `(,(lambda (buf alist) + (window--display-buffer buf xref--original-window 'reuse alist))))))) + (with-selected-window (display-buffer buf action) (xref--goto-char pos) (run-hooks 'xref-after-jump-hook) (let ((buf (current-buffer))) @@ -548,9 +538,8 @@ xref--item-at-point (defun xref-goto-xref (&optional quit) "Jump to the xref on the current line and select its window. -Non-interactively, non-nil QUIT means to first quit the *xref* -buffer." - (interactive) +A prefix arg QUIT means to first quit the *xref* buffer." + (interactive "P") (let* ((buffer (current-buffer)) (xref (or (xref--item-at-point) (user-error "No reference at point"))) @@ -782,7 +771,17 @@ xref--show-xref-buffer (erase-buffer) (xref--insert-xrefs xref-alist) (xref--xref-buffer-mode) - (pop-to-buffer (current-buffer)) + (pop-to-buffer + (current-buffer) + `((display-buffer--maybe-same-window + display-buffer-reuse-window + display-buffer--maybe-pop-up-frame + display-buffer-below-selected) + ,(if temp-buffer-resize-mode + '(window-height . resize-temp-buffer-window) + '(window-height . fit-window-to-buffer)) + ,(when temp-buffer-resize-mode + '(preserve-size . (nil . t))))) (goto-char (point-min)) (setq xref--original-window (assoc-default 'window alist) xref--original-window-intent (assoc-default 'display-action alist)) --=-=-=--