all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
Cc: 37189@debbugs.gnu.org, dgutov@yandex.ru
Subject: bug#37189: 25.4.1: vc-hg-ignore implementation is missing
Date: Mon, 10 Feb 2020 18:02:51 +0200	[thread overview]
Message-ID: <83wo8ubfbo.fsf@gnu.org> (raw)
In-Reply-To: <5622487d-a21f-49cf-5420-21f87415af4f@gmx.de> (message from Wolfgang Scherer on Sun, 9 Feb 2020 14:57:12 +0100)

> From: Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
> Cc: dgutov@yandex.ru, 37189@debbugs.gnu.org
> Date: Sun, 9 Feb 2020 14:57:12 +0100
> 
> "pattern" is a generic term, which does not imply a specific syntax.
> 
> "wildcard specification" is a pattern following the rules of a glob(7)
> syntax variant.
> 
> "regexp pattern" implies one of the regular expression syntaxes
> (regex(7), Emacs, Perl, Python, ...).

Got it, thanks.

>     +-------------+-----------------+---------------+-----------------+--------------------+
>     | `file path` | glob(7)         | anchored glob | Hg `regex`      | Bzr `regex`        |
>     +=============+=================+===============+=================+====================+
>     | test[56].xx |   test\[56].xx  | /test\[56].xx | ^test\[56]\.xx$ | RE:^test\[56]\.xx$ |
>     |             |   test[[]56].xx |               |                 |                    |
>     +-------------+-----------------+---------------+-----------------+--------------------+
>     | simple.txt  |   simple.txt    | /simple.txt   | ^simple\.txt$   | RE:^simple\.txt$   |
>     |             |   simple[.]txt  |               |                 |                    |
>     +-------------+-----------------+---------------+-----------------+--------------------+

Just a note: this table might be interpreted to mean that hg and bzr
only support regexes in their ignore files, but that is of course
false: they also support glob-style widlcards.

>     The correct escaping of FILE can only be determined by the
>     backend. Therefore neither vc-dir-ignore nor lisp code calling
>     vc-ignore can escape the FILE parameter correctly without support
>     from the backend. This makes pattern input for FILE only useful
>     during interactive calls.
> 
> Even, if it was magically possible to determine the correct
> pattern in the frontend, submitting an anchored
> glob "/some-sub/file.txt" to `vc-ignore` would be interpreted as
> an absolute path.
> 
> In other words, the API specificaton
> 
>   [...] FILE is a wildcard specification, either relative to
>   DIRECTORY or absolute.
> 
> which asks for implementing the pattern use case inextricably
> mixed with the file path use case, is nonsense.
> 
> It also means, that all of the backend functions which currently
> demand a pattern are absolutely useless.

I don't think I agree.  While the direction in which you propose to
move -- which AFAIU is to offer 2 different commands, one to ignore a
file name, the other to ignore a file pattern -- is definitely
possible, I question its necessity.  In the use cases I have in mind,
the ignore file-or-pattern always comes from the user, because only
the users can decide which files they want to ignore.  And the users
always know both which backend they are working with, and whether the
file-or-pattern is a filename or a pattern.  It follows that we can
ask the users to escape and anchor the file-or-pattern argument they
type, and that is not an unreasonable expectation.  In fact, your
approach expects the same from the users, because you are asking the
users to decide which of the two commands to invoke in each case.

If there are no flaws in my way of reasoning, then I think the
resulting changes will be much less extensive, because the same
vc-ignore command can then be used for both ignoring a specific file
and for ignoring a pattern of any kind.  We just need to document that
if the argument is a pattern of any kind, the user will have to make
sure it is escaped and anchored for the backend to DTRT.

A further advantage of my proposal is that we don't need to write any
backend-specific code to escape special characters in patterns,
because we expect the users to do that.

This concept is similar to what we do in commands such as "M-x grep",
where we expect the users to escape special characters in the
command-line arguments to be passed to Grep the program via the shell.

Am I missing something?





  reply	other threads:[~2020-02-10 16:02 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-26  0:21 bug#37189: 25.4.1: vc-hg-ignore implementation is missing Wolfgang Scherer
     [not found] ` <handler.37189.B.15667808855126.ack@debbugs.gnu.org>
2019-08-26 23:25   ` bug#37189: Acknowledgement (25.4.1: vc-hg-ignore implementation is missing) Wolfgang Scherer
2019-08-27  7:45     ` Eli Zaretskii
2019-08-28  1:46       ` bug#37189: *** GMX Spamverdacht *** " Wolfgang Scherer
2019-08-28  6:16         ` Eli Zaretskii
2019-08-29  1:23           ` bug#37189: 25.4.1: vc-hg-ignore implementation is missing Wolfgang Scherer
2019-08-29  0:38         ` Wolfgang Scherer
2019-08-29 15:52           ` Wolfgang Scherer
2019-12-25  0:16             ` Dmitry Gutov
2020-01-05  3:46               ` Wolfgang Scherer
2020-01-05  8:58                 ` Andreas Schwab
2020-01-05 17:25                   ` Wolfgang Scherer
2020-01-14  1:14                 ` Dmitry Gutov
2020-02-01  1:20                   ` Wolfgang Scherer
2020-02-01  8:27                     ` Eli Zaretskii
2020-02-03  1:16                       ` Wolfgang Scherer
2020-02-04 18:55                         ` Eli Zaretskii
2020-02-05  5:18                           ` Wolfgang Scherer
2020-02-05 19:06                           ` Wolfgang Scherer
2020-02-07  9:57                             ` Eli Zaretskii
2020-02-08  9:57                               ` Dmitry Gutov
2020-02-08 19:45                                 ` Wolfgang Scherer
2020-02-08 20:05                                   ` Eli Zaretskii
2020-02-08 23:12                                     ` Wolfgang Scherer
2020-02-09 13:57                                       ` Wolfgang Scherer
2020-02-09 14:07                                         ` Wolfgang Scherer
2020-02-09 13:57                                       ` Wolfgang Scherer
2020-02-09 13:57                                       ` Wolfgang Scherer
2020-02-10 16:02                                         ` Eli Zaretskii [this message]
2020-02-11  1:45                                           ` Wolfgang Scherer
2020-02-11 17:32                                             ` Eli Zaretskii
2020-02-11 22:28                                               ` Wolfgang Scherer
2020-02-12 18:34                                                 ` Eli Zaretskii
     [not found]                                                   ` <6f3ba261-e1f9-cf19-cc22-ec8c24cf3298@gmx.de>
2020-02-12 23:20                                                     ` Wolfgang Scherer
2020-02-13  1:18                                                       ` Wolfgang Scherer
2020-02-13 15:09                                                         ` Eli Zaretskii
2020-02-13 16:30                                                           ` Wolfgang Scherer
2020-02-13 23:43                                                           ` Richard Stallman
2020-02-14  1:49                                                             ` Wolfgang Scherer
2020-02-16  2:29                                                               ` Richard Stallman
2020-02-13 15:21                                                         ` Eli Zaretskii
2020-02-13 23:40                                                           ` Dmitry Gutov
2020-02-14  9:23                                                             ` Eli Zaretskii
2020-02-21  0:05                                                               ` Dmitry Gutov
2020-02-21  8:10                                                                 ` Eli Zaretskii
2020-02-21 22:22                                                                 ` Wolfgang Scherer
2020-02-22  7:44                                                                   ` Eli Zaretskii
2020-02-22 13:46                                                                     ` Wolfgang Scherer
2020-02-22 14:30                                                                       ` Eli Zaretskii
2020-02-22 19:14                                                                         ` Dmitry Gutov
2020-02-22 22:04                                                                           ` Wolfgang Scherer
2020-02-22 23:32                                                                         ` Wolfgang Scherer
2020-02-23 15:20                                                                           ` Eli Zaretskii
2020-02-23 19:16                                                                             ` Wolfgang Scherer
2020-02-22 19:30                                                                   ` Dmitry Gutov
2020-02-22 22:00                                                                     ` Wolfgang Scherer
2020-02-22 23:58                                                                       ` Dmitry Gutov
2020-02-23  0:29                                                                         ` Wolfgang Scherer
2020-02-24 23:07                                                                           ` Dmitry Gutov
2020-02-25  2:22                                                                             ` Wolfgang Scherer
2020-03-19 23:42                                                                               ` Dmitry Gutov
2020-07-03 20:53                                                                                 ` Wolfgang Scherer
2020-07-03 21:49                                                                                   ` Dmitry Gutov
2020-02-12 17:23                                               ` Wolfgang Scherer
2020-02-08 23:59                                     ` Wolfgang Scherer
2020-02-09 21:06                               ` Wolfgang Scherer

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

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

  git send-email \
    --in-reply-to=83wo8ubfbo.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=37189@debbugs.gnu.org \
    --cc=Wolfgang.Scherer@gmx.de \
    --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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.