[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#34911: 26.1; doc about lock file names
From: |
Drew Adams |
Subject: |
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.