From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Wolfgang Scherer Newsgroups: gmane.emacs.bugs Subject: bug#37189: 25.4.1: vc-hg-ignore implementation is missing Date: Fri, 21 Feb 2020 23:22:18 +0100 Message-ID: <2f84ddff-3275-6eb1-01ae-ff1d28b6e8da@gmx.de> References: <1ba53ae2-42a4-3ab3-d4f2-2ceae565d198@gmx.de> <1ebc6077-9175-65ba-4996-282bb2c8eca5@yandex.ru> <6145d6f6-37a8-7166-731b-57669086b145@gmx.de> <838slmk90j.fsf@gnu.org> <83h806gp2w.fsf@gnu.org> <8336bmg1o9.fsf@gnu.org> <2354821b-5c1e-f9e3-3a64-4ff978ded33b@gmx.de> <83sgjkdev5.fsf@gnu.org> <3fb73dbc-bf31-233b-4afc-2147c4ffd5b7@gmx.de> <5622487d-a21f-49cf-5420-21f87415af4f@gmx.de> <83wo8ubfbo.fsf@gnu.org> <83zhdpqbas.fsf@gnu.org> <2c8419ae-723d-c7ae-a60e-59d1b1cbc2c1@gmx.de> <83o8u3r6wg.fsf@gnu.org> <6f3ba261-e1f9-cf19-cc22-ec8c24cf3298@gmx.de> <83blq2qzqp.fsf@gnu.org> <83ftfdplo8.fsf@gnu.org> <9929b44f-37da-23c8-16cc-c6ca89602149@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="76809"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 Cc: 37189@debbugs.gnu.org To: Dmitry Gutov , Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Feb 21 23:23:35 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 1j5Ghr-000JtF-5N for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 21 Feb 2020 23:23:35 +0100 Original-Received: from localhost ([::1]:36808 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j5Ghp-0002TE-S6 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 21 Feb 2020 17:23:34 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41231) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j5GhL-0002St-Th for bug-gnu-emacs@gnu.org; Fri, 21 Feb 2020 17:23:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j5GhK-0008NH-CL for bug-gnu-emacs@gnu.org; Fri, 21 Feb 2020 17:23:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42340) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j5GhK-0008N1-9E for bug-gnu-emacs@gnu.org; Fri, 21 Feb 2020 17:23:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1j5GhK-0007M6-5q for bug-gnu-emacs@gnu.org; Fri, 21 Feb 2020 17:23:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Wolfgang Scherer Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 21 Feb 2020 22:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37189 X-GNU-PR-Package: emacs Original-Received: via spool by 37189-submit@debbugs.gnu.org id=B37189.158232375228219 (code B ref 37189); Fri, 21 Feb 2020 22:23:02 +0000 Original-Received: (at 37189) by debbugs.gnu.org; 21 Feb 2020 22:22:32 +0000 Original-Received: from localhost ([127.0.0.1]:48313 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j5Ggp-0007L4-Rm for submit@debbugs.gnu.org; Fri, 21 Feb 2020 17:22:32 -0500 Original-Received: from mout.gmx.net ([212.227.15.15]:40349) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j5Ggo-0007Kp-0s for 37189@debbugs.gnu.org; Fri, 21 Feb 2020 17:22:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1582323743; bh=nHw9cnrcg881e77pUr6FFHZPwFh5vs6vGdfZI+jSd64=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=JfZTiZiUmk2v6E8gc9VJfrGn2xqlZJV5uOH7+3dQvlyYlTSY9m4H0KvjdnJhjkSnU o/qyzMRvcg2Uj8DBAxdT+m0rWT6Us5eXQkeGtCf5Mas2x75LNwM8n7BpoX+jJ7+C3d 0tO788NMl/izajzlKx2Lcaj6jCo24GHqD3A0e1dY= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from sheckley.simul.de ([87.160.210.52]) by mail.gmx.com (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MdvqW-1jgGCH1Mwg-00b2pc; Fri, 21 Feb 2020 23:22:23 +0100 Original-Received: from [127.0.0.1] (sheckley.simul.de [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by sheckley.simul.de (Postfix) with ESMTPSA id 2DABF19431F0; Fri, 21 Feb 2020 23:22:19 +0100 (CET) Openpgp: preference=signencrypt Autocrypt: addr=Wolfgang.Scherer@gmx.de; prefer-encrypt=mutual; keydata= xsDiBEb46IgRBACMHOAb1KNo1Ylk+ebri+4R+bG4tyKlqBlrpv8D9/ZwRdXSGt+0DyCHoaAd 7KW7noHapLe87DunABOjKG4nqTGv+dRiWuUBlp3I4aYRFDVa3Da+XnIYkMHKqhK59VEHQCdp Km42nuLS7TS+n99at9YwzTG6VBdOlBKTlRFngOjVLwCg1RGXJ6X3EjS1FKCQeXziURVpWlkD /2zY6Ayhxi62TS84VjikXrrmjXykAAaAmMVEyKKYb9L5pGlqiZz9g/K9xw1EUoZTYuaufquD v4rAGR58K/3V4CYfJLEeshMWiaXHvMmlxMznlG16/um4MvmR8B3r+cx0nOPK1JBdD2qrkNnF Mw8FB+zouLFB4Gt2IUC5IlOmZ8OQA/4qdU53CItzWsCr9Nux4L0qUlRweSmCnV8xGQ2wP5XI MawIQxxREvSrsYDG8cNnYETMg4iQFfIktwAoxCJvuFAwIB6ZxHGF4FcEZm64CXc2u7CmFLqt rVhXhIfMz9oEYC+HhGczGamn9ofbGTFd2hJEtPcQgWNR4f7+aKknmi2+OM0fV29sZmdhbmcg U2NoZXJlciA8d3NAc3ctYW10LndzPsJhBBMRAgAhBQJYmz3YAhsjBQsJCAcCBhUICQoLAgQW AgMBAh4BAheAAAoJEIUCr3Gr112VZZoAoLTBSTp1qGuNhLdXY04iaWCMYmHCAJ4kHPtQ6nTw kEq9qCHgVgXDaY7wjs7ATQRG+OiIEAQAhi0wjcxvA4tychg2NQuwBIf9LX/46l+74+QbewCn a4a+mw/9s5KY In-Reply-To: <9929b44f-37da-23c8-16cc-c6ca89602149@yandex.ru> Content-Language: de-DE X-Provags-ID: V03:K1:rRoWYT54JTcOeIszS1Pw5MjUa3sP0CttoLKqdGGChX4RbgecZdq YNdN3fyjk4G/WuMuIofwBvcTZGpLAkMrzxQUaEnmjb65M3/NESuK/RqZUjt+8cQbDHzaQpr DwmTgWoxBf/rC/tusPvH1ZMY3LivGZ/oTmCy/WSx2SJwaN+zHo2gHH8eDJ8VOyOnMmFfU/6 JH/c/xDQo2Q6ZDZpoXCxw== X-UI-Out-Filterresults: notjunk:1;V03:K0:ONiKE0oEKQw=:LOG1k+d3bUJOoyfyxa52zq 4ewGpVFUKX8j8DjqUAEKISsMkXsjIzDdpe0iL1ceE51yUazL+2Potiq0huHtFAgnYxcba9Pmp MxOR5QB5AmyQZHBmmKhKv9YyfLNV8ZOrP15I8/YmM31Eqviv8pY81hUEiUfw+69Geq09SEzAo XvTjwF+fUVT+11Q7/JrRBC3yZI1a7ecCJtGdDKTz8ubZ2O9Vv8YTQlRvkgVcUzIHtfn6rhgFf cS7POC2/CjZuJJt+xaWDT7yP+B9/iAnOXVS0yQ6wB3bBiGWpZWB5EzFNhaHNtj378qEayhj0M S+q1Dt1So6Lgp8n+5zXhCMgzzUszL6nSlLEsbUXMG7w1TrOgtGJAV1FlBy5UVyC2QZlwEfMW+ vFLv7oqN0vpCErwoC3wdTPTAmuhotgZBdMIHDLC6q5tDL3sgALgrhQNlgRtX3Il1yOuKQk4p3 vZ1C5cuqaKn0loNEP5rFpTFGYqwchKgIaleRvmkFjQHHAUhD72+kJdYDQyUBSPMDsFVK6UTk6 7AdAClrLC7UDeXGSvZ/+9W1NvUhfWWvN4XAXf3LUpIp0XgajHswhG35Qe26bDET7XBzH9fR/J rfTIrvSmVa4c6hB3L7EbDLR6U62s3XavM5WBMEGtjl0pJriNDfaFPqKqHKkIXXelNgS8nic9w /kvAmH2PzAKU+SP9CGNRqwuGMrGLAaRNUuHs1m/2I0zOQpHIo+9TdonZngcnih/xtfem9GaNX L+MrxA6NgYd0YC2viM9/OjwBgwiqKbabzLFWtjalkCZ3jkxRb4i4kzVGhrYoS/acfI3tXn5t X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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:176386 Archived-At: Am 21.02.20 um 01:05 schrieb Dmitry Gutov: > On 14.02.2020 11:23, Eli Zaretskii wrote: >>> Cc: 37189@debbugs.gnu.org >>> From: Dmitry Gutov >>> Date: Fri, 14 Feb 2020 01:40:31 +0200 >>> >>> I think the first thing I'll have to do is revert a part of an earlier >>> patch to vc-default-ignore which changed its semantics a little, becau= se >>> it doesn't look like this discussion is going to culminate in a patch >>> small enough for emacs-27 anyway. >> >> Which part?=C2=A0 Can you show a proposed patch? > > See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D37217. > > The patch fixed a legitimate scenario, but made an existing one work wor= se. Trying to vc-ignore, say, '*.c' from a subdirectory in a Git repo, for= instance, will now prepend the intermediary directories to it. > > (Mentioned this before: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D= 37189#41) > > Now, one could argue that one use case is more important than the other = one, and that vc-ignore has for a while been geared toward entering plain = file names rather than glob patterns. I have little opinion on this subjec= t, however, since I mostly edit ignore files by hand, and do so very rarel= y. So as far as I'm concerned, we could remove this feature altogether and= not lose much. Both use cases are important for casual users of a VC. Before this research, I did not know anything about SVN, SRC, Bzr, Mtn. Ignore file support in 'vc' as a distilled experience cache does come in handy, even for experienced users. Especially, if escaping/anchoring is implemented. > > But maybe it's more valuable for SVN users? Where the ignore configurati= on is more tricky and the DIRECTORY argument is actually important. For SVN users it is extremely useful, since there are no files that can be edited. Commands must be issued to store ignore patterns. However, the commands cannot add patterns to existing patterns, so the existing patterns have to be read and a new pattern added, before writing everything back. That is pretty much work and support by emacs as frontend is very valued. > > So the options at hand are: > > - Revert almost all of the patch from bug#37217, reverting to the previo= us, admittedly broken behavior, and continue to discuss a better improveme= nt for Emacs 28. I think that is the best way to proceed. The correct implementation is definitely non-trivial and should not be made in a series of adhoc patches. > - Try to resolve the ambiguity of purpose in favor either entering patte= rns on file names only. Probably the latter, later vc-ignore to vc-ignore-= file. I have never seen the pattern feature before, but since I implemented it now, I have come to realize that it is very useful, when combined with pre-escaped and anchored patterns from the current file in vc-dir-mode and dired-mode. It is extremely useful for regex pattern syntax, where patterns are a lot more ambiguous and need more attention than patterns with glob syntax. > - Try to sit on both chairs... Basically, that means using the user inpu= t unaltered. Allowing them to enter a file name as well, but treat it as a= pattern, without escaping or the like. This would be close to the origina= l intent behind vc-ignore, AFAICT. Pre-escaped and anchored is very useful. But unmodified ist a good starting point. > To do the last one, read-file-name would need to be called with the seco= nd argument provided, the directory against which the file path should be = relative. For most backend, we can reuse the find-ignore-file backend comm= and, but SVN (and RCS, etc) don't have it defined. RCS, SCCS do not have ignore files, so they should error out. SRC has ignore files similar to CVS and SVN. Do not forget that CVS and SVN have functions vc-cvs-ignore and vc-svn-ignore, which are called *instead* of vc-default-ignore. I.e. The changes to vc-default-ignore do not affect those VCs. For the invocation of find-ignore-file in vc-ignore, see below. > Roughly and handwavy, we can take this case to mean "use default-directo= ry". Unfortunately not. If the file or pattern to be ignored is in a subdirectory of default-directory, the DIRECTORY argument must reflect this for CVS, SVN, SRC. > > As you noted, the use of read-file-name at all in vc-ignore is somewhat = problematic, but let's see if we can keep the function sane without removi= ng it first. I would not change it for Emacs 27. > > Attaching a patch. Eli, Wolfgang, any objections? As mentioned above, for CVS, SVN, SRC default-directory is not necessarily the correct rel-dir. This would be better: =C2=A0=C2=A0 (let* ((backend (vc-responsible-backend default-directory)) =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (file (read-file-na= me "File to ignore: ")) =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (rel-dir =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (condition-ca= se nil =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 (file-name-directory =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 (vc-call-backend backend 'find-ignore-file =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 default-directory)) =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (= vc-not-supported =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 (file-name-directory =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 (directory-file-name (expand-file-name file))))))) =C2=A0=C2=A0=C2=A0=C2=A0 (when (and (file-name-absolute-p file) =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 (file-in-directory-p file rel-dir)) =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (setq file (file-relative-name file r= el-dir))) =C2=A0=C2=A0=C2=A0=C2=A0 (list file =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 rel-dir =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 current-prefi= x-arg))) I apologize for introducing ewoc into vc-dir-mode. Meanwhile I have discovered vc-deduce-fileset, which does all the hard work for preparing a fileset in vc-dir-mode, dired-mode and other modes. vc-deduce-fileset delivers a backend and absolute file names, not relative file names. I think introducing relative file names in function APIs is the wrong way to go. However, as a preliminary solution, it does suffice. >>> Then, naturally, we'll have to look for small changes that improve the >>> situation but provide as little breakage as possible. >> >> Agreed. Definitely.