unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Philipp Stephani <p.stephani2@gmail.com>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: 47799@debbugs.gnu.org
Subject: bug#47799: 28.0.50; Default `project-files' implementation doesn't work with quoted filenames
Date: Sun, 18 Apr 2021 22:06:43 +0200	[thread overview]
Message-ID: <CAArVCkScxJ4FK2ofJSSXxxFanr16+NU=SiquQTu=kuYZ5p9ugw@mail.gmail.com> (raw)
In-Reply-To: <bf392ff3-36bb-546b-35ef-159cc27f2df9@yandex.ru>

Am Fr., 16. Apr. 2021 um 03:08 Uhr schrieb Dmitry Gutov <dgutov@yandex.ru>:
>
> On 15.04.2021 19:44, Philipp Stephani wrote:
> > Am Do., 15. Apr. 2021 um 18:15 Uhr schrieb Dmitry Gutov <dgutov@yandex.ru>:
> >>
> >> Hi Philipp,
> >>
> >> On 15.04.2021 16:43, Philipp Stephani wrote:
> >>> emacs -Q -batch -l project -eval '(print (project-files (quote (transient . "/:/"))))'
> >>>
> >>> ("find: ‘/:/’: No such file or directory
> >>> ")
> >>>
> >>> Note that the error message is listed as a file.
> >>>
> >>> 1. `project-files' should unquote local filenames before passing them to
> >>>      `find'.
> >>>
> >>> 2. `project-files' should check for errors returned from `find'.
> >>
> >> Would you like to propose a patch?
> >
> > I've now pushed a minimal fix to this specific problem (commit
> > 157bfc1812c51a0a48162c71eadf7959f7de9ac6), but there are probably more
> > places that should get fixed, e.g. xref--find-ignores-arguments.
> > project--files-in-directory also still ignores any errors from the
> > find binary.
>
> Thank you.
>
> I've added error handling to project--files-in-directory in a follow-up
> commit.

Thanks.

>
> 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).

>
> 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.

>
> 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.





  reply	other threads:[~2021-04-18 20:06 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-15 13:43 bug#47799: 28.0.50; Default `project-files' implementation doesn't work with quoted filenames Philipp Stephani
2021-04-15 16:15 ` Dmitry Gutov
2021-04-15 16:26   ` Philipp Stephani
2021-04-15 16:44   ` Philipp Stephani
2021-04-16  1:08     ` Dmitry Gutov
2021-04-18 20:06       ` Philipp Stephani [this message]
2021-04-18 20:21         ` Dmitry Gutov
2021-04-19 14:48           ` Philipp Stephani
2021-04-19 20:48             ` Dmitry Gutov
2021-04-22  0:46               ` Dmitry Gutov
2021-05-16 13:37               ` Philipp
2021-05-16 23:22                 ` Dmitry Gutov
2021-05-16 23:31                   ` Dmitry Gutov
2021-07-05 19:05                   ` Philipp
2021-07-18  0:53                     ` Dmitry Gutov
2021-09-05 17:14                       ` Philipp
2021-09-20 16:05                         ` Dmitry Gutov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAArVCkScxJ4FK2ofJSSXxxFanr16+NU=SiquQTu=kuYZ5p9ugw@mail.gmail.com' \
    --to=p.stephani2@gmail.com \
    --cc=47799@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).