GNU bug report logs - #34911
26.1; doc about lock file names

Previous Next

Package: emacs;

Reported by: Drew Adams <drew.adams <at> oracle.com>

Date: Mon, 18 Mar 2019 22:49:01 UTC

Severity: wishlist

Found in version 26.1

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 34911 in the body.
You can then email your comments to 34911 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#34911; Package emacs. (Mon, 18 Mar 2019 22:49:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Drew Adams <drew.adams <at> oracle.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 18 Mar 2019 22:49:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 26.1; doc about lock file names
Date: Mon, 18 Mar 2019 15:47:52 -0700 (PDT)
I started from the doc of `dired-omit-files', which says:

  The default is to omit `.', `..', auto-save files and lock files.
                                                        ^^^^^^^^^^

And the default value is this: "^\\.?#\\|^\\.$\\|^\\.\\.$"

I can only guess that a lock file has either the same syntax as (the
default syntax of) an auto-save file: `#...#', or that prefixed by `.':
`.#...#'.  In fact, it's a stretch to guess even that, as the ^\.?#
doesn't necessarily match even an auto-save file (no # appended).

I don't see documented anywhere what a lock file name looks like.
I looked through both the Emacs manual and the Elisp manual.  Did I miss
it somehow, or is it defined/described nowhere?

Please let users know what how lock files are named.  Thx.  If this is
already done somewhere, please refer to that location from node (elisp)
`File Locks'.

Please also update the doc of `dired-omit-files' to make clear that its
default value only approximately matches auto-save files (and lock
files?), and that even this is true only for the default naming regime
for auto-save files.

In GNU Emacs 26.1 (build 1, x86_64-w64-mingw32)
 of 2018-05-30
Repository revision: 07f8f9bc5a51f5aa94eb099f3e15fbe0c20ea1ea
Windowing system distributor `Microsoft Corp.', version 10.0.17134
Configured using:
 `configure --without-dbus --host=x86_64-w64-mingw32
 --without-compress-install 'CFLAGS=-O2 -static -g3''




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34911; Package emacs. (Mon, 18 Mar 2019 23:19:02 GMT) Full text and rfc822 format available.

Message #8 received at 34911 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: 34911 <at> debbugs.gnu.org
Subject: Re: bug#34911: 26.1; doc about lock file names
Date: Mon, 18 Mar 2019 19:17:51 -0400
https://debbugs.gnu.org/25469




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34911; Package emacs. (Tue, 19 Mar 2019 00:29:02 GMT) Full text and rfc822 format available.

Message #11 received at 34911 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Glenn Morris <rgm <at> gnu.org>, 34911 <at> debbugs.gnu.org
Subject: RE: bug#34911: 26.1; doc about lock file names
Date: Mon, 18 Mar 2019 17:28:32 -0700 (PDT)
> https://urldefense.proofpoint.com/v2/url?u=https-
> 3A__debbugs.gnu.org_25469&d=DwIBAg&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_
> JnE&r=kI3P6ljGv6CTHIKju0jqInF6AOwMCYRDQUmqX22rJ98&m=ZQXJQudbtYivz1y22NetuHLhZ
> w6CxfyhnaFolvxcbS8&s=1vr5xywPgW1Od5O-51aGFhhPoAmPbYnHwGhA2JYv7EI&e=

Thanks.  So it's a duplicate.  Good to know.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34911; Package emacs. (Tue, 19 Mar 2019 06:57:02 GMT) Full text and rfc822 format available.

Message #14 received at 34911 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 34911 <at> debbugs.gnu.org
Subject: Re: bug#34911: 26.1; doc about lock file names
Date: Tue, 19 Mar 2019 08:56:40 +0200
> Date: Mon, 18 Mar 2019 15:47:52 -0700 (PDT)
> From: Drew Adams <drew.adams <at> oracle.com>
> 
> I don't see documented anywhere what a lock file name looks like.
> I looked through both the Emacs manual and the Elisp manual.  Did I miss
> it somehow, or is it defined/described nowhere?

It is described in the node "File Locks" in the ELisp manual.

> Please let users know what how lock files are named.  Thx.  If this is
> already done somewhere, please refer to that location from node (elisp)
> `File Locks'.

The node "Interlocking" in the user manual, where file locking is
described on the user level, has a cross-reference to the above node
pf ELisp manual.  So I'm unsure how you missed that.

> Please also update the doc of `dired-omit-files' to make clear that its
> default value only approximately matches auto-save files (and lock
> files?), and that even this is true only for the default naming regime
> for auto-save files.

I don't understand this part.  Concretely, what is missing in the doc
string, and why do you think it is necessary to add whatever is
missing?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34911; Package emacs. (Tue, 19 Mar 2019 07:08:01 GMT) Full text and rfc822 format available.

Message #17 received at 34911 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 34911 <at> debbugs.gnu.org
Subject: Re: bug#34911: 26.1; doc about lock file names
Date: Tue, 19 Mar 2019 09:07:12 +0200
close 25469 26.2
thanks

> From: Glenn Morris <rgm <at> gnu.org>
> Date: Mon, 18 Mar 2019 19:17:51 -0400
> 
> 
> https://debbugs.gnu.org/25469

This was fixed already, so that bug should be closed.

I'm not yet closing this one, because it seems to say something beyond
the issue raised in 25469.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34911; Package emacs. (Tue, 19 Mar 2019 11:50:02 GMT) Full text and rfc822 format available.

Message #20 received at 34911 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: drew.adams <at> oracle.com
Cc: 34911 <at> debbugs.gnu.org
Subject: Re: bug#34911: 26.1; doc about lock file names
Date: Tue, 19 Mar 2019 13:49:33 +0200
> Date: Tue, 19 Mar 2019 08:56:40 +0200
> From: Eli Zaretskii <eliz <at> gnu.org>
> Cc: 34911 <at> debbugs.gnu.org
> 
> It is described in the node "File Locks" in the ELisp manual.
> 
> > Please let users know what how lock files are named.  Thx.  If this is
> > already done somewhere, please refer to that location from node (elisp)
> > `File Locks'.
> 
> The node "Interlocking" in the user manual, where file locking is
> described on the user level, has a cross-reference to the above node
> of ELisp manual.  So I'm unsure how you missed that.

Oh, I see you reported this from Emacs 26.1, whose manuals don't
include the additions I mentioned.  That explains why you didn't see
them.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34911; Package emacs. (Tue, 19 Mar 2019 14:55:02 GMT) Full text and rfc822 format available.

Message #23 received at 34911 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Eli Zaretskii <eliz <at> gnu.org>, Drew Adams <drew.adams <at> oracle.com>
Cc: 34911 <at> debbugs.gnu.org
Subject: RE: bug#34911: 26.1; doc about lock file names
Date: Tue, 19 Mar 2019 07:54:48 -0700 (PDT)
> > I don't see documented anywhere what a lock file name looks like.
> > I looked through both the Emacs manual and the Elisp manual.  Did I miss
> > it somehow, or is it defined/described nowhere?
> 
> It is described in the node "File Locks" in the ELisp manual.

I started there.  I see nothing in that node that says
what the name looks like.  I'm using Emacs 26.  Did
someone perhaps add a description of it since that
release?

> > Please let users know what how lock files are named.  Thx.  If this is
> > already done somewhere, please refer to that location from node (elisp)
> > `File Locks'.
> 
> The node "Interlocking" in the user manual, where file locking is
> described on the user level, has a cross-reference to the above node
> pf ELisp manual.  So I'm unsure how you missed that.

Please explain how that replies to the text you quote,
or to any of the text in the bug report?  AFAICT, there
is nothing in the Emacs manual (including of course the
node you cite) or in the Elisp manual (including the node
you cite) that tells you how lock files are named.

That's what this bug report is about (and its near-duplicate,
#25469, also touches on this lack).  

> > Please also update the doc of `dired-omit-files' to make clear that its
> > default value only approximately matches auto-save files (and lock
> > files?), and that even this is true only for the default naming regime
> > for auto-save files.
> 
> I don't understand this part.  Concretely, what is missing in the doc
> string, and why do you think it is necessary to add whatever is
> missing?

The default value is "^\\.?#\\|^\\.$\\|^\\.\\.$".

\\.?# matches only the first char of an auto-save file
name, and the first two chars of a lock file name.  It
does not match the full name, requiring it to end with
`#'.  That means that (1) it cannot be used as is for,
say, font-locking such a (complete) name, and (2) as
it is now, it can falsely identify files that are not
auto-save or lock files.

And it does not necessarily match auto-save file names
at all, as they can be nearly anything, it seems:

(elisp) `Auto-Saving' makes a point of saying that each
of  `auto-save-file-name-p' and `make-auto-save-file-name'
exists "so that you can customize it if you wish to change
the naming convention for auto-save files".  And for each
it reminds us "If you redefine it, be sure to redefine the
[other] function ... correspondingly."

IOW, apparently the `#...#' is conventional but users are
practically invited to adopt alternative naming schemes.

While those two functions go together, so that changing
the naming scheme for one calls for changing it also for
the other, there are other functions and variables that
presume the standard naming convention.  Their doc does
not, so far, speak to the possibility of a naming change.

Also, please add a doc string for `dired-omit-regexp',
referring to `dired-omit-files' (where this missing doc
will hopefully be added) and `dired-omit-extensions', as
is done for `dired-mark-omitted', for example.

Does this clarify what I meant by "the default value only
approximately matches auto-save files (and lock files?)"?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34911; Package emacs. (Tue, 19 Mar 2019 18:24:03 GMT) Full text and rfc822 format available.

Message #26 received at 34911 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 34911 <at> debbugs.gnu.org
Subject: Re: bug#34911: 26.1; doc about lock file names
Date: Tue, 19 Mar 2019 20:23:27 +0200
> Date: Tue, 19 Mar 2019 07:54:48 -0700 (PDT)
> From: Drew Adams <drew.adams <at> oracle.com>
> Cc: 34911 <at> debbugs.gnu.org
> 
> > > I don't see documented anywhere what a lock file name looks like.
> > > I looked through both the Emacs manual and the Elisp manual.  Did I miss
> > > it somehow, or is it defined/described nowhere?
> > 
> > It is described in the node "File Locks" in the ELisp manual.
> 
> I started there.  I see nothing in that node that says
> what the name looks like.  I'm using Emacs 26.  Did
> someone perhaps add a description of it since that
> release?

Yes, as I wrote in a followup message, this information is now present
in what will be Emacs 26.2.

> The default value is "^\\.?#\\|^\\.$\\|^\\.\\.$".
> 
> \\.?# matches only the first char of an auto-save file
> name, and the first two chars of a lock file name.  It
> does not match the full name, requiring it to end with
> `#'.  That means that (1) it cannot be used as is for,
> say, font-locking such a (complete) name, and (2) as
> it is now, it can falsely identify files that are not
> auto-save or lock files.

Then maybe we need to change the default value, but that's a separate
issue.  AFAIU, the bug report was about documentation.

> Also, please add a doc string for `dired-omit-regexp',
> referring to `dired-omit-files' (where this missing doc
> will hopefully be added) and `dired-omit-extensions', as
> is done for `dired-mark-omitted', for example.

Another separate issue, unrelated to file locks, AFAIU.

> Does this clarify what I meant by "the default value only
> approximately matches auto-save files (and lock files?)"?

Yes, but I don't necessarily see that as a problem.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34911; Package emacs. (Tue, 19 Mar 2019 20:16:02 GMT) Full text and rfc822 format available.

Message #29 received at 34911 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Eli Zaretskii <eliz <at> gnu.org>, Drew Adams <drew.adams <at> oracle.com>
Cc: 34911 <at> debbugs.gnu.org
Subject: RE: bug#34911: 26.1; doc about lock file names
Date: Tue, 19 Mar 2019 13:15:00 -0700 (PDT)
> > The default value is "^\\.?#\\|^\\.$\\|^\\.\\.$".
> >
> > \\.?# matches only the first char of an auto-save file
> > name, and the first two chars of a lock file name.  It
> > does not match the full name, requiring it to end with
> > `#'.  That means that (1) it cannot be used as is for,
> > say, font-locking such a (complete) name, and (2) as
> > it is now, it can falsely identify files that are not
> > auto-save or lock files.
> 
> Then maybe we need to change the default value, but that's a separate
> issue.  AFAIU, the bug report was about documentation.

Yes, improving the default value is welcome (and needed).
But currently it is unchanged.  As a result there is a
doc bug because what the doc says about the default value
is incorrect.  If you fix the default value to be what
the doc says then the doc will not need to change.  Else
it does need to change.

BTW, I think (but am not 100% sure) that `^' and `$' are
the wrong things to use here.  Instead, `\`' and `\''
should be used.

> > Also, please add a doc string for `dired-omit-regexp',
> > referring to `dired-omit-files' (where this missing doc
> > will hopefully be added) and `dired-omit-extensions', as
> > is done for `dired-mark-omitted', for example.
> 
> Another separate issue, unrelated to file locks, AFAIU.

Do you need a separate bug report for that?

> > Does this clarify what I meant by "the default value only
> > approximately matches auto-save files (and lock files?)"?
> 
> Yes, but I don't necessarily see that as a problem.

Why not?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34911; Package emacs. (Tue, 19 Mar 2019 20:25:01 GMT) Full text and rfc822 format available.

Message #32 received at 34911 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 34911 <at> debbugs.gnu.org
Subject: Re: bug#34911: 26.1; doc about lock file names
Date: Tue, 19 Mar 2019 22:23:49 +0200
> Date: Tue, 19 Mar 2019 13:15:00 -0700 (PDT)
> From: Drew Adams <drew.adams <at> oracle.com>
> Cc: 34911 <at> debbugs.gnu.org
> 
> > Then maybe we need to change the default value, but that's a separate
> > issue.  AFAIU, the bug report was about documentation.
> 
> Yes, improving the default value is welcome (and needed).
> But currently it is unchanged.  As a result there is a
> doc bug because what the doc says about the default value
> is incorrect.

No, I don't see that it does.  At most, it says something that is not
100% accurate, in some rare cases.

> > > Does this clarify what I meant by "the default value only
> > > approximately matches auto-save files (and lock files?)"?
> > 
> > Yes, but I don't necessarily see that as a problem.
> 
> Why not?

Because the issues sound mostly theoretical to me.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34911; Package emacs. (Sun, 12 May 2019 16:35:01 GMT) Full text and rfc822 format available.

Message #35 received at 34911 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> gmail.com>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 34911 <at> debbugs.gnu.org
Subject: Re: bug#34911: 26.1; doc about lock file names
Date: Sun, 12 May 2019 12:34:37 -0400
[Message part 1 (text/plain, inline)]
Drew Adams <drew.adams <at> oracle.com> writes:
>
>> > Please also update the doc of `dired-omit-files' to make clear that its
>> > default value only approximately matches auto-save files (and lock
>> > files?), and that even this is true only for the default naming regime
>> > for auto-save files.
>> 
>> I don't understand this part.  Concretely, what is missing in the doc
>> string, and why do you think it is necessary to add whatever is
>> missing?
>
> The default value is "^\\.?#\\|^\\.$\\|^\\.\\.$".
>
> \\.?# matches only the first char of an auto-save file
> name, and the first two chars of a lock file name.  It
> does not match the full name, requiring it to end with
> `#'.  That means that (1) it cannot be used as is for,
> say, font-locking such a (complete) name, and (2) as
> it is now, it can falsely identify files that are not
> auto-save or lock files.

It's a regexp, so of course you can name files which aren't auto-save or
lock files in such a way that they match it.

> And it does not necessarily match auto-save file names
> at all, as they can be nearly anything, it seems:
>
> (elisp) `Auto-Saving' makes a point of saying that each
> of  `auto-save-file-name-p' and `make-auto-save-file-name'
> exists "so that you can customize it if you wish to change
> the naming convention for auto-save files".  And for each
> it reminds us "If you redefine it, be sure to redefine the
> [other] function ... correspondingly."
>
> IOW, apparently the `#...#' is conventional but users are
> practically invited to adopt alternative naming schemes.

How about we stop inviting that?  It sounds like something from before
user options were invented, and messing around with auto-save functions
kind of seems like asking for trouble.

[0001-Don-t-recommend-redefining-auto-save-filename-functi.patch (text/plain, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34911; Package emacs. (Sun, 19 May 2019 14:44:02 GMT) Full text and rfc822 format available.

Message #38 received at 34911 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> gmail.com>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 34911 <at> debbugs.gnu.org
Subject: Re: bug#34911: 26.1; doc about lock file names
Date: Sun, 19 May 2019 10:43:52 -0400
Noam Postavsky <npostavs <at> gmail.com> writes:

> Drew Adams <drew.adams <at> oracle.com> writes:
>>
>> The default value is "^\\.?#\\|^\\.$\\|^\\.\\.$".
>>
>> \\.?# matches only the first char of an auto-save file
>> name, and the first two chars of a lock file name.  It
>> does not match the full name, requiring it to end with
>> `#'.  That means that (1) it cannot be used as is for,
>> say, font-locking such a (complete) name, and (2) as
>> it is now, it can falsely identify files that are not
>> auto-save or lock files.
>
> It's a regexp, so of course you can name files which aren't auto-save or
> lock files in such a way that they match it.

After looking at it some more, I realize you were probably suggesting
that the regexp should have something like "^.#\\|^#.*#$" instead of
"^\\.?#"




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34911; Package emacs. (Sun, 19 May 2019 15:08:02 GMT) Full text and rfc822 format available.

Message #41 received at 34911 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 34911 <at> debbugs.gnu.org
Subject: RE: bug#34911: 26.1; doc about lock file names
Date: Sun, 19 May 2019 15:04:53 +0000 (UTC)
> >> The default value is "^\\.?#\\|^\\.$\\|^\\.\\.$".
> >>
> >> \\.?# matches only the first char of an auto-save file
> >> name, and the first two chars of a lock file name.  It
> >> does not match the full name, requiring it to end with
> >> `#'.  That means that (1) it cannot be used as is for,
> >> say, font-locking such a (complete) name, and (2) as
> >> it is now, it can falsely identify files that are not
> >> auto-save or lock files.
> >
> > It's a regexp, so of course you can name files which aren't auto-save or
> > lock files in such a way that they match it.
> 
> After looking at it some more, I realize you were probably suggesting
> that the regexp should have something like "^.#\\|^#.*#$" instead of
> "^\\.?#"

No, I don't think so.  It is correct, I think, to
say that the beginning matches .# (or the whole
thing matches . or ..) - that is, the dot is literal.

What I was saying was that it is not enough to say
how it starts.  It should (in all cases) match the
full file name.  (And it is better to use \` and \'.)

A main reason is what I mentioned: being able to
reuse the variable for font-locking.

I do that in `dired+.el', for example.  Option
`diredp-omit-files-regexp' is a regexp to font-lock
file names omitted by `dired-omit-mode'.

The default value is defined this way, reusing the
value of `dired-omit-files':

(let* ((strg  dired-omit-files) ; <=========== Reuse it
       (strg  (if (eq ?^ (aref strg 0)) ; Remove initial ^
                  (substring strg 1)
                strg))
       (strg  (replace-regexp-in-string
               "\\(\\\\[|]\\)\\^"       ; Remove other ^'s
               "\\1"
               strg
               'FIXEDCASE
               nil))
       (strg  (replace-regexp-in-string
               "\\([$]\\)"              ; Remove $'s
               ""
               strg
               'FIXEDCASE
               nil)))
  strg)

Doc string:

Regexp for font-locking file names to be omitted by `dired-omit-mode'.
The regexp is matched only against the file name, but the entire line
is highlighted (with face `diredp-omit-file-name').

The default value of this option differs from that of
`dired-omit-files' by removing "^" from the beginning, and "$"
from the end, of each regexp choice.  (The default value of
`dired-omit-files', at least prior to Emacs 27, uses "^" and "$",
but it should not.)

If you want to control the beginning and end of choice matches then
use "\`" and "\'" instead of "^" and "$".

Note: If you change the value of this option then you need to restart
Emacs to see the effect of the new value on font-locking.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34911; Package emacs. (Sun, 19 May 2019 15:12:01 GMT) Full text and rfc822 format available.

Message #44 received at 34911 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> gmail.com>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 34911 <at> debbugs.gnu.org
Subject: Re: bug#34911: 26.1; doc about lock file names
Date: Sun, 19 May 2019 11:11:41 -0400
Drew Adams <drew.adams <at> oracle.com> writes:

>> >> The default value is "^\\.?#\\|^\\.$\\|^\\.\\.$".
>> >>
>> >> \\.?# matches only the first char of an auto-save file
>> >> name, and the first two chars of a lock file name.  It
>> >> does not match the full name, requiring it to end with
>> >> `#'.  That means that (1) it cannot be used as is for,
>> >> say, font-locking such a (complete) name, and (2) as
>> >> it is now, it can falsely identify files that are not
>> >> auto-save or lock files.
>> >
>> > It's a regexp, so of course you can name files which aren't auto-save or
>> > lock files in such a way that they match it.
>> 
>> After looking at it some more, I realize you were probably suggesting
>> that the regexp should have something like "^.#\\|^#.*#$" instead of
>> "^\\.?#"
>
> No, I don't think so.  It is correct, I think, to
> say that the beginning matches .# (or the whole
> thing matches . or ..) - that is, the dot is literal.

Sorry, forgot to escape the dot, I meant

    "^\\.#\\|^#.*#$" instead of "^\\.?#"




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34911; Package emacs. (Sun, 19 May 2019 16:30:02 GMT) Full text and rfc822 format available.

Message #47 received at 34911 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 34911 <at> debbugs.gnu.org
Subject: RE: bug#34911: 26.1; doc about lock file names
Date: Sun, 19 May 2019 16:29:37 +0000 (UTC)
> >> >> The default value is "^\\.?#\\|^\\.$\\|^\\.\\.$".
> >> >>
> >> >> \\.?# matches only the first char of an auto-save file
> >> >> name, and the first two chars of a lock file name.  It
> >> >> does not match the full name, requiring it to end with
> >> >> `#'.  That means that (1) it cannot be used as is for,
> >> >> say, font-locking such a (complete) name, and (2) as
> >> >> it is now, it can falsely identify files that are not
> >> >> auto-save or lock files.
> >> >
> >> > It's a regexp, so of course you can name files which aren't auto-save or
> >> > lock files in such a way that they match it.
> >>
> >> After looking at it some more, I realize you were probably suggesting
> >> that the regexp should have something like "^.#\\|^#.*#$" instead of
> >> "^\\.?#"
> >
> > No, I don't think so.  It is correct, I think, to
> > say that the beginning matches .# (or the whole
> > thing matches . or ..) - that is, the dot is literal.
> 
> Sorry, forgot to escape the dot, I meant
> 
>     "^\\.#\\|^#.*#$" instead of "^\\.?#"

I don't think so.  More like this, I think:

"^\\.?#[^#]#$\\|^\\.$\\|^\\.\\.$" or preferably this:

"\\`\\.?#[^#]#\\'\\|\\`\\.\\'\\|\\`\\.\\.\\'"

But maybe .* is better than [^#]; dunno.

I don't have time to check right now, but I think
the names to match, besides . and .., start with
.# or # and end with #.  The idea is to match the
start and end, and whatever is between the two.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34911; Package emacs. (Sun, 19 May 2019 17:23:01 GMT) Full text and rfc822 format available.

Message #50 received at 34911 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> gmail.com>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 34911 <at> debbugs.gnu.org
Subject: Re: bug#34911: 26.1; doc about lock file names
Date: Sun, 19 May 2019 13:22:10 -0400
Drew Adams <drew.adams <at> oracle.com> writes:

>>     "^\\.#\\|^#.*#$" instead of "^\\.?#"
>
> I don't think so.  More like this, I think:
>
> "^\\.?#[^#]#$\\|^\\.$\\|^\\.\\.$" or preferably this:

This will fail to match lock file names (because they don't end in "#").

> But maybe .* is better than [^#]; dunno.

Specifically, [^#] will fail for filenames that include "#".

(let ((buffer-file-name "/foo/my-#tag-list"))
  (make-auto-save-file-name)) ;=> "/foo/#my-#tag-list#"




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34911; Package emacs. (Sun, 19 May 2019 19:50:01 GMT) Full text and rfc822 format available.

Message #53 received at 34911 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 34911 <at> debbugs.gnu.org
Subject: RE: bug#34911: 26.1; doc about lock file names
Date: Sun, 19 May 2019 19:49:23 +0000 (UTC)
> >>     "^\\.#\\|^#.*#$" instead of "^\\.?#"
> >
> > I don't think so.  More like this, I think:
> 
> This will fail to match lock file names (because they don't end in "#").

Good.  (This is why doc was needed.)

> > But maybe .* is better than [^#]; dunno.

And anyway, I forgot * after [^#].

> Specifically, [^#] will fail for filenames that include "#".
> (let ((buffer-file-name "/foo/my-#tag-list"))
>   (make-auto-save-file-name)) ;=> "/foo/#my-#tag-list#"

Right  I had forgotten whether that was allowed.
Checking (elisp) `Auto-Saving'...

OK.  So maybe it should be something like this:

"\\`\\.#.*\\|\\`\\.?#.*#\\'\\|\\`\\.\\'\\|\\`\\.\\.\\'"

where:

Lock file: "\\`\\.#.*" - starts with ".#" and ends at eol.
Auto-save file: "\\`#.*#\\'" - starts and ends with "#".
Current or parent directory: "\\`\\.\\'\\|\\`\\.\\.\\" - "." or ".."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34911; Package emacs. (Wed, 26 Aug 2020 10:40:02 GMT) Full text and rfc822 format available.

Message #56 received at 34911 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Drew Adams <drew.adams <at> oracle.com>,
 34911 <at> debbugs.gnu.org
Subject: Re: bug#34911: 26.1; doc about lock file names
Date: Wed, 26 Aug 2020 12:39:22 +0200
Noam Postavsky <npostavs <at> gmail.com> writes:

> How about we stop inviting that?  It sounds like something from before
> user options were invented, and messing around with auto-save functions
> kind of seems like asking for trouble.

[...]

> * doc/lispref/backups.texi (Auto-Saving): Document
> auto-save-file-name-transforms.
> * lisp/files.el (make-auto-save-file-name)
> (auto-save-file-name-p): Remove suggestion to redefine for
> customization.

There was no discussion of this patch, but it makes sense to me, so I
went ahead and applied it to Emacs 28.

Drew had some other suggestions here, but I think this doc change is
sufficient, so I'm closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug marked as fixed in version 28.1, send any further explanations to 34911 <at> debbugs.gnu.org and Drew Adams <drew.adams <at> oracle.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 26 Aug 2020 10:40:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34911; Package emacs. (Wed, 26 Aug 2020 16:56:02 GMT) Full text and rfc822 format available.

Message #61 received at 34911 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>, Noam Postavsky <npostavs <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 34911 <at> debbugs.gnu.org
Subject: RE: bug#34911: 26.1; doc about lock file names
Date: Wed, 26 Aug 2020 09:55:07 -0700 (PDT)
I take that as a "won't fix".

I don't have time to belabor this.  I'm hoping that Noam might take another look and follow up with some of the changes needed.  If not, too bad.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 24 Sep 2020 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 214 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.