Subject: bug#46882: 26.3; Let `dired-omit-mode' match lines, as well as file names

From: Drew Adams <[email-masked]>
Date: Wed, 3 Mar 2021 00:39:42 +0000

`dired-omit-mode' matches file names against regexps, and removes their
lines from the Dired listing.

It can also be useful to match other things on a file's line, besides
its name.  For example, match the `x' permission to omit executable files.

The attached code implements this.  It adds a new option,
`dired-omit-line-regexp', which is a regexp to match lines.

It redefines `dired-omit-mode', `dired-omit-expunge', and
`dired-do-kill-lines'.  It adds optional args LINEP and INIT-COUNT to
`dired-omit-expunge', and optional arg INIT-COUNT to
`dired-do-kill-lines'.

When the new option is non-nil, `dired-omit-mode' calls
`dired-omit-expunge' a second time, to omit matching lines.

The updated doc of `dired-do-kill-lines' speaks only of removing lines
from the listing, not of "killing" lines, to avoid confusion with kills
(the `kill-ring' is unaffected by this command).  We should consider
renaming the command altogether, but then the key binding of `k' would
no longer be mnemonic'.  At the very least, if the doc continues to
speak of "killing" lines then it should explicitly say that the
`kill-ring' is unaffected.

If this improvement is OK (try it) then I can send a patch.  Otherwise,
I won't bother.

The improvement was inspired by this user question:

https://emacs.stackexchange.com/q/63659/105

In GNU Emacs 26.3 (build 1, x86_64-w64-mingw32)
 of 2019-08-29
Repository revision: 96dd0196c28bc36779584e47fffcca433c9309cd
Windowing system distributor `Microsoft Corp.', version 10.0.19041
Configured using:
 `configure --without-dbus --host=x86_64-w64-mingw32
 --without-compress-install 'CFLAGS=-O2 -static -g3''