all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Noam Postavsky <npostavs@gmail.com>
Cc: 34911@debbugs.gnu.org
Subject: bug#34911: 26.1; doc about lock file names
Date: Sun, 19 May 2019 15:04:53 +0000 (UTC)	[thread overview]
Message-ID: <509ba95a-d515-40e8-a76f-3f614faeef47@default> (raw)
In-Reply-To: <871s0ucxnb.fsf@gmail.com>

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





  reply	other threads:[~2019-05-19 15:04 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <<db8aca56-6185-4e1a-a627-53aed26103c2@default>
     [not found] ` <<83bm27uzbr.fsf@gnu.org>
2019-03-19 14:54   ` bug#34911: 26.1; doc about lock file names Drew Adams
2019-03-19 18:23     ` Eli Zaretskii
2019-05-12 16:34     ` Noam Postavsky
2019-05-19 14:43       ` Noam Postavsky
2019-05-19 15:04         ` Drew Adams [this message]
2019-05-19 15:11           ` Noam Postavsky
2019-05-19 16:29             ` Drew Adams
2019-05-19 17:22               ` Noam Postavsky
2019-05-19 19:49                 ` Drew Adams
2020-08-26 10:39       ` Lars Ingebrigtsen
2020-08-26 16:55         ` Drew Adams
     [not found] <<<db8aca56-6185-4e1a-a627-53aed26103c2@default>
     [not found] ` <<<83bm27uzbr.fsf@gnu.org>
     [not found]   ` <<a916e9f9-e66e-40b8-b02d-1d697108774e@default>
     [not found]     ` <<83r2b2u3j4.fsf@gnu.org>
2019-03-19 20:15       ` Drew Adams
2019-03-19 20:23         ` Eli Zaretskii
2019-03-18 22:47 Drew Adams
2019-03-18 23:17 ` Glenn Morris
2019-03-19  0:28   ` Drew Adams
2019-03-19  7:07   ` Eli Zaretskii
2019-03-19  6:56 ` Eli Zaretskii
2019-03-19 11:49   ` Eli Zaretskii

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=509ba95a-d515-40e8-a76f-3f614faeef47@default \
    --to=drew.adams@oracle.com \
    --cc=34911@debbugs.gnu.org \
    --cc=npostavs@gmail.com \
    /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.