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.bugs Subject: bug#47799: 28.0.50; Default `project-files' implementation doesn't work with quoted filenames Date: Sun, 18 Apr 2021 23:21:00 +0300 Message-ID: References: <658a3e61-9511-5502-43de-8f591cec7387@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13930"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 Cc: 47799@debbugs.gnu.org To: Philipp Stephani Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Apr 18 22:25:19 2021 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 1lYDyo-0003Va-Lj for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 18 Apr 2021 22:25:18 +0200 Original-Received: from localhost ([::1]:36182 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lYDyn-0005nZ-Oo for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 18 Apr 2021 16:25:17 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50354) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lYDve-0003nB-7u for bug-gnu-emacs@gnu.org; Sun, 18 Apr 2021 16:22:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36406) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lYDvd-0001x3-Vx for bug-gnu-emacs@gnu.org; Sun, 18 Apr 2021 16:22:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lYDvd-0002jL-S9 for bug-gnu-emacs@gnu.org; Sun, 18 Apr 2021 16:22:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 18 Apr 2021 20:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47799 X-GNU-PR-Package: emacs Original-Received: via spool by 47799-submit@debbugs.gnu.org id=B47799.161877727010434 (code B ref 47799); Sun, 18 Apr 2021 20:22:01 +0000 Original-Received: (at 47799) by debbugs.gnu.org; 18 Apr 2021 20:21:10 +0000 Original-Received: from localhost ([127.0.0.1]:47952 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lYDuo-0002iE-JK for submit@debbugs.gnu.org; Sun, 18 Apr 2021 16:21:10 -0400 Original-Received: from mail-wm1-f50.google.com ([209.85.128.50]:41876) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lYDun-0002i2-3f for 47799@debbugs.gnu.org; Sun, 18 Apr 2021 16:21:09 -0400 Original-Received: by mail-wm1-f50.google.com with SMTP id o21-20020a1c4d150000b029012e52898006so7307034wmh.0 for <47799@debbugs.gnu.org>; Sun, 18 Apr 2021 13:21:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=qkcclDzjjj14vNCE6S5TzCbpgTGRWF2NISCj+vP64t8=; b=hLApbK2w4NhQIwJK9QeFDTiMi8lWtDiyiaOKR4QDtBu6HqRpQi4tgeO23tf369aCxS iC5ASLOmpDVfo1kIRaKoxny1uwUOt9ehZfOoEseaA6emNng9JtbziaN3S95pToDZ95ii DUtMqPnE4+Ek0Hh1cLWSblHz/OF0Ksca7hQGJu6xKymfiV6tA0PT3hUPPipYkYeqvd7+ nzDZvXENsE/Uy3aoDo0vZLp8iqGxpvtU76cHT2778gdhNJp18ywy+lALBLAi/B8DFKa+ oCNXBXMjalX0TCHglb4wX1EoF5J3kp5ryowCBb20Vd6oapD9ftf+i+0mRmgjxZmKf1gf baPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=qkcclDzjjj14vNCE6S5TzCbpgTGRWF2NISCj+vP64t8=; b=H1IZNc0hsaj27GUvb/1wDNC4ANN2b12bJEz/82ddpEyWFNppThdSxef4cnONL9MaRs EUQJPEcvM2UxotnWL6wyJJMKzgxWok/LbqKWCiNvP9bQTBikpmMGd9ZwR89fqEEYEZTh LlXKM8oMSvr+TUM1n79AYjPY5kchi7VmZXqhEmuRSgFXYDiAQkKaI/iByRwIvlHLThoN Oq94IA5enRAwt2LsLSRS40xPcXNNgS2Q9hkdUUfWqiFhEuPEw1T2RVePFZ8NY8Gnvqw7 zPVUEJZTfSIPlSKBClIexC7JgpQjviXa6lTWEeFUeNu+qvwepZlAhnkRR4Bw/oiZJ4N6 6Jow== X-Gm-Message-State: AOAM531xBcMkT0+PHqoElSDjjf2RXn7lq9lOynBq9eS6k4LXuIgIR7bh x+gofm36VyahLs1Jo0QYuaAB5CCGnPA= X-Google-Smtp-Source: ABdhPJz04HJdzeUSlhSaNhGXqTJG1lK6X1lRUAzDwRe5bbx7vw/OXRJq1ulroD8R30k7v4oirqEmvw== X-Received: by 2002:a7b:c401:: with SMTP id k1mr18490839wmi.48.1618777263287; Sun, 18 Apr 2021 13:21:03 -0700 (PDT) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id v3sm17502202wmj.25.2021.04.18.13.21.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 18 Apr 2021 13:21:02 -0700 (PDT) In-Reply-To: Content-Language: en-US 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:204410 Archived-At: On 18.04.2021 23:06, Philipp Stephani wrote: >> Regarding xref--find-ignores-arguments, it seems it would be economical >> to do the quoting on the value passed to it. See f955df1. > > Since it's an internal function, this is mostly a matter of style. I > prefer using Emacs filenames as function arguments as much as > possible; it's the expected behavior for functions dealing with files, > and Emacs doesn't have a strong enough type system to distinguish > "Emacs filename" (which can be quoted or remote) from "filename for > external programs" (which must be unquoted and local). Matter of style, yes, but the way I fixed it requires one unquoting instead of two, which seems like a win. Your point is also valid, of course. >> Regarding your change, though, have you tried project-find-regexp in a >> "transient" project with a quoted root directory name? >> >> You've made project--files-in-directory quote the returned file names, >> but that list gets passed to xref-matches-in-files, which pipes them to >> find-grep in the end. I suppose xref-matches-in-files could use a step >> similar to (when remote-id ...) that is already there. > > Good point, I've pushed 6ebc6e12cf to fix. But xref.el should also be > fixed. Maybe I'll find some time to take a look at it. Yes, I think the fix needs to be in xref-matches-in-files, and it also needs to use file-name-quoted-p similarly to (file-remote-p default-directory, to avoid the mapping overhead when the list of file names is large. It's a realistic use case, and the impact is significant (e.g. 1s to list files, 2s to unquote them all), so please look into this soon. The fix in xref should be simple enough, I'd just like for someone to realistically test it before installing (I can send a patch, if you want). >> A bit unfortunate for the users of large projects with quoted names, but >> not sure what else we could do. > > Quoting is a purely lexical operation which should be reasonably fast > even for a large list of files. > For truly enormous projects, something like "list of all project > files" is infeasible anyway. File listing in projects backed by Git (at least) is quite optimized. For example, in a gecko-dev checkout: (benchmark 1 '(project-files (project-current))) => 0.97s (benchmark 1 '(mapcar #'file-name-unquote (project-files (project-current)))) => 2.97s