From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tobias Rittweiler Newsgroups: gmane.emacs.bugs Subject: bug#45135: 28.0.50; [PATCH] Add option to print file names in *xref* buffer relative to project root Date: Sun, 27 Dec 2020 08:10:46 +0100 Message-ID: References: <6d6911b9-c604-1fca-3cd4-084a8880524f@yandex.ru> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000728c8305b76cdd95" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21120"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 45135@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 27 14:44:30 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1ktWLW-0005OU-2f for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 27 Dec 2020 14:44:30 +0100 Original-Received: from localhost ([::1]:40702 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ktWLV-0007J8-2s for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 27 Dec 2020 08:44:29 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48024) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ktWL4-0007Hi-QR for bug-gnu-emacs@gnu.org; Sun, 27 Dec 2020 08:44:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48915) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ktWL4-0002pt-Jg for bug-gnu-emacs@gnu.org; Sun, 27 Dec 2020 08:44:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ktWL4-0007Qe-Hx for bug-gnu-emacs@gnu.org; Sun, 27 Dec 2020 08:44:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Tobias Rittweiler Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 27 Dec 2020 13:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45135 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 45135-submit@debbugs.gnu.org id=B45135.160907660128479 (code B ref 45135); Sun, 27 Dec 2020 13:44:02 +0000 Original-Received: (at 45135) by debbugs.gnu.org; 27 Dec 2020 13:43:21 +0000 Original-Received: from localhost ([127.0.0.1]:60460 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ktWKP-0007PB-8r for submit@debbugs.gnu.org; Sun, 27 Dec 2020 08:43:21 -0500 Original-Received: from mail-qv1-f53.google.com ([209.85.219.53]:34503) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ktQDA-00063j-Lq for 45135@debbugs.gnu.org; Sun, 27 Dec 2020 02:11:29 -0500 Original-Received: by mail-qv1-f53.google.com with SMTP id 4so3764236qvh.1 for <45135@debbugs.gnu.org>; Sat, 26 Dec 2020 23:11:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=uOj1WOJGzCHOZFApAmxz+Rbk7cKpVnYoL3zqo7lotGI=; b=Eyd4Y9DFYW5TclscRvlztgrusbfGRH7yz3TwfmMIdouPrQ3I8MQEyOLJp5sHQh8Gw4 u2/SFp+ebCuUBTK/eueqDLknqTpiPOW6t/3l+zVmkGCoN2HQCZGS5IKktIAqh8K0mZSj 3V5LXOEhZeCn++D9jRnAi5dL/NatcVsh4WSK6v8RRIM5eg1TiQkbdAQ1Hq/pzWoKI2QU 4eND/1+LZ5yB8Fy5sa4YFYYbqMzBRb59MYwa0IprXxDjINDTjpJ2aLKmiB0lfIj0jkCZ Xytwl+Fu8BmY7Hlam+RHr39kkm5KhUDUjRAf4jUuOAwlUw9vBTsqVPmIsxV4I2ermmcE gKfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=uOj1WOJGzCHOZFApAmxz+Rbk7cKpVnYoL3zqo7lotGI=; b=XONCqsrHnZQYlTYSQPGTIVZddPUk2AAJPA30eNHQsq5uDIytFSZIVWsVffweUJaa8A 4FFMMwnFFVnvK8Z4oHKx7pISX8px3CF6tYEKhLJcDF+c6Mb4gyeAsTijASIaW94KnfNy /2qPCOsNNRvKMMGICCowmWW/mcNNmVSesXCLSK3h0ReTTgcjB0m+Vwr7/fhO745kXTiX /3li4LmP3D1hgs/GaB2K3KCWuHWvhtj0WxJDJzTNzORooA2Gq8Esf60Xe0iNcYpbyx+h NpwYWNu6wc1gOjE+xzJ2WH3fMImAVQaX2OR6tXTmqOq1eEY5Ac14Hxro+cHdqnHAzgiK 3LnA== X-Gm-Message-State: AOAM5309P9ZxS1GsYqd1+rntb78ZH4tj2SXMmsGSU1Q4n6YLgQcJgq2F ZsbZKgfr0sUEhi2QGS7Kq278nEGL3U4MsUQmB/o= X-Google-Smtp-Source: ABdhPJzUGBAXWGiNOM8uwd2VXW9IE1Db/cXCZAZWbkEABLIho4Ct7STk2BTktx0Rd3RrytM7sZuI28uVFGvyc0qLQWM= X-Received: by 2002:ad4:4643:: with SMTP id y3mr41980985qvv.3.1609053083175; Sat, 26 Dec 2020 23:11:23 -0800 (PST) In-Reply-To: <6d6911b9-c604-1fca-3cd4-084a8880524f@yandex.ru> X-Mailman-Approved-At: Sun, 27 Dec 2020 08:43:18 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:196796 Archived-At: --000000000000728c8305b76cdd95 Content-Type: text/plain; charset="UTF-8" On Wed, 23 Dec 2020 at 03:16, Dmitry Gutov wrote: > Hi Tobias, > > On 09.12.2020 17:08, Tobias Rittweiler wrote: > > > please find patches attached to this e-mail that make it possible to > > set 'xref-file-name-display' to 'relative-to-project-root'. If so set, > > the file names in the *xref* buffer will be shortened by the > 'project-root' > > and 'project-external-roots' of 'project-current'. Note that xref.el > already > > requires 'project'. > > > > The patches are relative to commit 2581beb from Wed Dec 9 00:54:34 2020 > > +0000 > > Could you clarify the reason for the first patch? Did you have any test > failures (on Ubuntu 20.04.1?) with the current test code because of the > "random" filesystem traversal order? Thanks! > The original code *did* already fix the file order in the test where it actually mattered: 'xref-matches-in-directory-finds-some-for-bar'. Note that no other test actually involve locations from multiple files in a way that is dependent on the order. The patch does not serve any actual utility except for code hygiene: it reduces a bit of trivial code duplication. Feel free to ignore it. (But in case you do add tests for 'xref-file-name-display' being 'relative', please make sure you write the tests in a way that makes it independent from the filesystem traversal order.) Tobias --000000000000728c8305b76cdd95 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Wed, 23 Dec 2020 at 03:16, Dmitry Guto= v <dgutov@yandex.ru> wrote:
Hi Tobias,

On 09.12.2020 17:08, Tobias Rittweiler wrote:

> please find patches attached to this e-mail that make it possible to > set 'xref-file-name-display' to 'relative-to-project-root&= #39;. If so set,
> the file names in the *xref* buffer will be shortened by the 'proj= ect-root'
> and 'project-external-roots' of 'project-current'. Not= e that xref.el already
> requires 'project'.
>
> The patches are relative to commit 2581beb from Wed Dec 9 00:54:34 202= 0
> +0000

Could you clarify the reason for the first patch? Did you have any test failures (on Ubuntu 20.04.1?) with the current test code because of the "random" filesystem traversal order? Thanks!

The original code *did* already fix the file order in the t= est where it actually mattered:
'xref-matches-in-directory-fi= nds-some-for-bar'. Note that no other test actually involve
l= ocations from multiple files in a way that is dependent on the order.
=

The patch does not serve any actual utility except for = code hygiene: it reduces a bit
of trivial code duplication. Feel = free to ignore it. (But in case you do add tests for
'xref-fi= le-name-display' being 'relative', please make sure you write t= he tests in a way
that makes it independent from the filesystem t= raversal order.)
=C2=A0
Tobias
--000000000000728c8305b76cdd95--