From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: xref call project-current in correct buffer Date: Tue, 15 Nov 2022 23:55:34 +0200 Message-ID: References: <8635ak9hny.fsf@stephe-leake.org> <86y1sb99vv.fsf@stephe-leake.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8728"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 To: Stephen Leake , emacs-devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Nov 15 22:56:29 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 1ov3uv-00024C-Fc for ged-emacs-devel@m.gmane-mx.org; Tue, 15 Nov 2022 22:56:29 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ov3uK-0003er-Gf; Tue, 15 Nov 2022 16:55:52 -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 1ov3uH-0003eZ-Mo for emacs-devel@gnu.org; Tue, 15 Nov 2022 16:55:49 -0500 Original-Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ov3uF-0007lO-Ah for emacs-devel@gnu.org; Tue, 15 Nov 2022 16:55:49 -0500 Original-Received: by mail-wr1-x42e.google.com with SMTP id cl5so26680012wrb.9 for ; Tue, 15 Nov 2022 13:55:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:references:to:from :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=P8sh+qlKJodXHuPVRCNLUaf2ZtZSPBQhIjnBgkCM2RI=; b=UAoxse3MUgjydprwe9JFmngbP12WlPln4HPgJ7VoRGzLcO7AuVOYjz7FXvLnrNQq98 D/rtIU8+OxJdSx2Q1IWG7H6o7oR5FZ5GiXQcmovpb5IiiZIiEWMThs1/IUvJm+pn69ET pDBFWkQEh41LoVJDDEmbmgeCwoR6iQz602JP7ZAvucCzfRIMATxBLlSxLcz0F5/1V0kR 73tLIlVyyE76osrutVLMWW6sJ7VuLwQUhi9vHGAXpCjgk7cOU2SndSwj43nB8xCQQTzU sPGSmXOOxCBCCjY4cwkN7PBYdlIYT/BuTpvk13usMGtsSxW8Ta5/Xj7FKhNot78AMt7m BAig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:references:to:from :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=P8sh+qlKJodXHuPVRCNLUaf2ZtZSPBQhIjnBgkCM2RI=; b=8CNBVoFilJUgYmZ0SG70vVQWXVvZwjub1HU4oqs8V/iMAofUQpm0NYgM0xhQuTm0mT nd6jOGNhe3O8P0egp3hOCtXmlVZAel2P1TJiaq8X6eBqX8xM1tXHixRV9SZ5+5f1AFKm tsbuyvHVfDhVnWWFTQrhcDy2y3RyB9F97IBqyZwkyApGPcL2ZqLozrvlVrgijB/gVAcn b3KaxV0vJW9ScQ4gdKeIg48HGndOaOgfez+i+/Cm8+J/+6vPLpPl+zyDf+tIMB3zCU4g 6jOzgmCUFXl4t2tvqPJJXbf8fWqx+eNF0pEa94WORM7N7WNFs8NbCbkDECNXv/qKpFA0 u0VQ== X-Gm-Message-State: ANoB5pktiV94TLwcvk8FAO2LSmjmx9xKclK38YqPVqsvUVcr126R7uu1 NSgwSCxjngp3zt1g/IcAX9pHQdA0yyc= X-Google-Smtp-Source: AA0mqf4QcYcozLqKMJkqcFeK+t/7JVCD3Rdpq8wIePLCQRCrj6iNOq/X+5NmCgGTdkBbCFiT2W4VNA== X-Received: by 2002:adf:fbc6:0:b0:22e:3392:fb46 with SMTP id d6-20020adffbc6000000b0022e3392fb46mr11735710wrs.706.1668549337151; Tue, 15 Nov 2022 13:55:37 -0800 (PST) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id iv7-20020a05600c548700b003cf87623c16sm93650wmb.4.2022.11.15.13.55.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 15 Nov 2022 13:55:36 -0800 (PST) Content-Language: en-US In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=raaahh@gmail.com; helo=mail-wr1-x42e.google.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:299888 Archived-At: On 15.11.2022 23:48, Dmitry Gutov wrote: > On 15.11.2022 23:37, Stephen Leake wrote: >> +      ;; xref--analyze uses (project-current), so it must be done in >> +      ;; the original buffer. >> +      (setq xrefs (xref--analyze xrefs)) > > LGTM, thanks! > > Maybe change the comment from "uses" to "can use" (or "might"), because > that only happens with the currently default value of > xref-file-name-display. Or not. That's a very minor detail. Actually, how about this one? The difference is slight, but we don't reuse a variable for a value with different structure, and it mirrors the same variable in related/similar functions in this package. diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 0213ab3cc5..3e04291bc3 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -1230,16 +1230,20 @@ xref-show-definitions-buffer-at-bottom (max-height (/ (window-height) 2)) (size-fun (lambda (window) (fit-window-to-buffer window max-height))) + xref-alist buf) (cond ((not (cdr xrefs)) (xref-pop-to-location (car xrefs) (assoc-default 'display-action alist))) (t + ;; Call it here because it can call (project-current), and that + ;; might depend on individual buffer, not just directory. + (setq xref-alist (xref--analyze xrefs)) (with-current-buffer (get-buffer-create xref-buffer-name) (xref--ensure-default-directory dd (current-buffer)) (xref--transient-buffer-mode) - (xref--show-common-initialize (xref--analyze xrefs) fetcher alist) + (xref--show-common-initialize xref-alist fetcher alist) (pop-to-buffer (current-buffer) `(display-buffer-in-direction . ((direction . below) (window-height . ,size-fun))))