GNU bug report logs -
#24547
24.4; dired should colour in sockets and pipes
Previous Next
Reported by: trentbuck <at> gmail.com (Trent W. Buck)
Date: Mon, 26 Sep 2016 08:07:01 UTC
Severity: wishlist
Tags: fixed
Found in version 24.4
Fixed in version 27.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 24547 in the body.
You can then email your comments to 24547 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24547
; Package
emacs
.
(Mon, 26 Sep 2016 08:07:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
trentbuck <at> gmail.com (Trent W. Buck)
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Mon, 26 Sep 2016 08:07:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
With GNU ls --color in a terminal, different colors are used for
regular files,
directories,
symlinks,
sockets,
pipes,
(other stuff - dircolors?)
In dired, the first three get different faces,
but sockets and pipes look like regular files.
I think it's probably easy to fix sockets and pipes,
because the first character is "s" or "p",
at least in GNU ls output.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24547
; Package
emacs
.
(Sat, 27 Jul 2019 14:27:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 24547 <at> debbugs.gnu.org (full text, mbox):
trentbuck <at> gmail.com (Trent W. Buck) writes:
> With GNU ls --color in a terminal, different colors are used for
>
> regular files,
> directories,
> symlinks,
> sockets,
> pipes,
> (other stuff - dircolors?)
>
> In dired, the first three get different faces,
> but sockets and pipes look like regular files.
>
> I think it's probably easy to fix sockets and pipes,
> because the first character is "s" or "p",
> at least in GNU ls output.
Sounds reasonable. I've now done this in Emacs 27, but I've used just a
single face for both sockets and pipes.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Added tag(s) fixed.
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Sat, 27 Jul 2019 14:27:02 GMT)
Full text and
rfc822 format available.
bug marked as fixed in version 27.1, send any further explanations to
24547 <at> debbugs.gnu.org and trentbuck <at> gmail.com (Trent W. Buck)
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Sat, 27 Jul 2019 14:27:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24547
; Package
emacs
.
(Sat, 27 Jul 2019 22:26:01 GMT)
Full text and
rfc822 format available.
Message #15 received at 24547 <at> debbugs.gnu.org (full text, mbox):
>> With GNU ls --color in a terminal, different colors are used for
>>
>> regular files,
>> directories,
>> symlinks,
>> sockets,
>> pipes,
>> (other stuff - dircolors?)
>>
>> In dired, the first three get different faces,
>> but sockets and pipes look like regular files.
>>
>> I think it's probably easy to fix sockets and pipes,
>> because the first character is "s" or "p",
>> at least in GNU ls output.
>
> Sounds reasonable. I've now done this in Emacs 27, but I've used just a
> single face for both sockets and pipes.
What are the remaining special file types possible in ls output?
For example, in /run I see only "s" and "p" files. But in /dev there are
also "b" and "c". These "block" and "character" device files could be
highlighted using the same face with sockets and pipes.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24547
; Package
emacs
.
(Sun, 28 Jul 2019 10:02:02 GMT)
Full text and
rfc822 format available.
Message #18 received at 24547 <at> debbugs.gnu.org (full text, mbox):
Juri Linkov <juri <at> linkov.net> writes:
> For example, in /run I see only "s" and "p" files. But in /dev there are
> also "b" and "c". These "block" and "character" device files could be
> highlighted using the same face with sockets and pipes.
Good idea. I've now added this to the trunk (as well as the NEWS item I
forgot when I added the face originally).
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24547
; Package
emacs
.
(Sun, 28 Jul 2019 14:55:02 GMT)
Full text and
rfc822 format available.
Message #21 received at 24547 <at> debbugs.gnu.org (full text, mbox):
TL;DR: explanation of dircolors(1) and terminfo(5).
Juri Linkov wrote:
> >> With GNU ls --color in a terminal, different colors are used for
> >>
> >> regular files,
> >> directories,
> >> symlinks,
> >> sockets,
> >> pipes,
> >> (other stuff - dircolors?)
> >>
> >> In dired, the first three get different faces,
> >> but sockets and pipes look like regular files.
> >>
> >> I think it's probably easy to fix sockets and pipes,
> >> because the first character is "s" or "p",
> >> at least in GNU ls output.
> >
> > Sounds reasonable. I've now done this in Emacs 27, but I've used just a
> > single face for both sockets and pipes.
Thanks! :-)
> What are the remaining special file types possible in ls output?
>
> For example, in /run I see only "s" and "p" files. But in /dev there are
> also "b" and "c". These "block" and "character" device files could be
> highlighted using the same face with sockets and pipes.
As I hinted earlier, GNU ls's --color output is governed by the dircolors program.
"dircolors --print-database" gives a bunch of stuff. The part you asked about is:
DIR 01;34 # directory
LINK 01;36 # symbolic link. (If you set this to 'target' instead of a
# numerical value, the color is as for the file pointed to.)
MULTIHARDLINK 00 # regular file with more than one link
FIFO 40;33 # pipe
SOCK 01;35 # socket
DOOR 01;35 # door
BLK 40;33;01 # block device driver
CHR 40;33;01 # character device driver
ORPHAN 40;31;01 # symlink to nonexistent file, or non-stat'able file ...
MISSING 00 # ... and the files they point to
Note that GNU ls/dircolors also uses different colors for different
kinds of regular files e.g. "video", "audio", "pictures", "compressed
files", "executables". This is done by filename extension rather than
MIME type, because GNU/* filesystems generally don't store MIME type
metadata, and running libmagic on every ls would be slow :-(
Those codes are SGR escape sequences, also called "ANSI color".
See also "man 5 terminfo".
01 above is "tput bold" (I think).
4x above is "tput setab x" (set background color).
3x above is "tput setaf x" (set foreground color).
There are 8 colors (0 through 7), which you can see at the top of
"emacs -nw -f list-colors-display":
black red green yellow blue magenta cyan white
The "bright" variants are selected automatically when bold is also set
(if the terminal supports that).
You might also want to consider what "man 2 stat" has to say, viz:
switch (sb.st_mode & S_IFMT) {
case S_IFBLK: printf("block device\n"); break;
case S_IFCHR: printf("character device\n"); break;
case S_IFDIR: printf("directory\n"); break;
case S_IFIFO: printf("FIFO/pipe\n"); break;
case S_IFLNK: printf("symlink\n"); break;
case S_IFREG: printf("regular file\n"); break;
case S_IFSOCK: printf("socket\n"); break;
default: printf("unknown?\n"); break;
}
dired (as at 26.1) doesn't seem to have faces for file types (or MIME
types), except for dired-directory and dired-symlink.
I suppose you could just add more faces.
The only downside to that, AFAICT, is that it will annoy people who write emacs color themes.
For my personal needs, I don't *REALLY* care about the details, so
long as "special" inodes stand out from "regular" inodes. Doing so
acts as a warning to me to e.g. add "--devices=skip" to "grep -r".
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24547
; Package
emacs
.
(Wed, 31 Jul 2019 21:25:02 GMT)
Full text and
rfc822 format available.
Message #24 received at 24547 <at> debbugs.gnu.org (full text, mbox):
>> What are the remaining special file types possible in ls output?
>>
>> For example, in /run I see only "s" and "p" files. But in /dev there are
>> also "b" and "c". These "block" and "character" device files could be
>> highlighted using the same face with sockets and pipes.
>
> As I hinted earlier, GNU ls's --color output is governed by the dircolors program.
> "dircolors --print-database" gives a bunch of stuff. The part you asked about is:
>
> DIR 01;34 # directory
> LINK 01;36 # symbolic link. (If you set this to 'target' instead of a
> # numerical value, the color is as for the file pointed to.)
> MULTIHARDLINK 00 # regular file with more than one link
> FIFO 40;33 # pipe
> SOCK 01;35 # socket
> DOOR 01;35 # door
> BLK 40;33;01 # block device driver
> CHR 40;33;01 # character device driver
> ORPHAN 40;31;01 # symlink to nonexistent file, or non-stat'able file ...
> MISSING 00 # ... and the files they point to
Thanks for the detailed explanation. I wonder what would be a common word
for these special file types: pipe, socket, block and character device?
Currently the face name is 'dired-socket', but this doesn't seem right
since it's used not only for socket, but also for pipe, block and character
devices. Is 'dired-special' a better name? At least the manual
(info "(coreutils) What information is listed") named them "special file".
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24547
; Package
emacs
.
(Thu, 01 Aug 2019 02:18:02 GMT)
Full text and
rfc822 format available.
Message #27 received at 24547 <at> debbugs.gnu.org (full text, mbox):
Juri Linkov wrote:
>>> What are the remaining special file types possible in ls output?
>> [dircolors --print-database]
>
> [...] what would be a common word for these special file types:
> pipe, socket, block and character device?
>
> Currently the face name is 'dired-socket', but this doesn't seem right
> since it's used not only for socket, but also for pipe, block and character
> devices. Is 'dired-special' a better name? At least the manual
> (info "(coreutils) What information is listed") named them "special file".
dired-special makes sense to me, and I can't think of a better term.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24547
; Package
emacs
.
(Thu, 01 Aug 2019 11:09:01 GMT)
Full text and
rfc822 format available.
Message #30 received at 24547 <at> debbugs.gnu.org (full text, mbox):
Juri Linkov <juri <at> linkov.net> writes:
> Currently the face name is 'dired-socket', but this doesn't seem right
> since it's used not only for socket, but also for pipe, block and character
> devices. Is 'dired-special' a better name? At least the manual
> (info "(coreutils) What information is listed") named them "special file".
`dired-special' sounds like a better name; yes. (I'm not sure whether
sockets are usually called special files, but the other ones covered by
the face are, I think.)
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 29 Aug 2019 11:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 4 years and 239 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.