GNU bug report logs -
#17064
24.3.50; Enhancement request: dired: fontification of symlinks
Previous Next
Reported by: Michael Heerdegen <michael_heerdegen <at> web.de>
Date: Fri, 21 Mar 2014 23:35:02 UTC
Severity: wishlist
Tags: fixed
Found in version 24.3.50
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 17064 in the body.
You can then email your comments to 17064 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#17064
; Package
emacs
.
(Fri, 21 Mar 2014 23:35:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Michael Heerdegen <michael_heerdegen <at> web.de>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Fri, 21 Mar 2014 23:35:03 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Hi,
in dired, symlinks look like
symlink -> target
where the whole thing is fontified with dired-symlink-face. But I
already know from the -> that I have a symlink, it would be more useful
to know whether TARGET is a directory, which is what I normally see for
non symlink files in dired by fontification with dired-directory-face.
My proposal: fontify only the first part "symlink ->" with
dired-symlink-face. Fontify "target" according to its truename type.
I'm no expert for font lock, so I don't send a patch but just post the
code I use in my config:
--8<---------------cut here---------------start------------->8---
(cl-callf2 cl-remove dired-re-sym dired-font-lock-keywords :key #'car)
(cl-callf nconc dired-font-lock-keywords
`((,dired-re-sym
((lambda (end) (when (let ((file (dired-file-name-at-point)))
(file-directory-p (file-truename file)))
(search-forward-regexp "\\(.+-> ?\\)\\(.+\\)" end t)))
(dired-move-to-filename)
nil
(1 dired-symlink-face)
(2 dired-directory-face)))
(,dired-re-sym
((lambda (end) (when (let ((file (dired-file-name-at-point)))
(file-regular-p (file-truename file)))
(search-forward-regexp "\\(.+-> ?\\)\\(.+\\)" end t)))
(dired-move-to-filename)
nil
(1 dired-symlink-face)
(2 'default)))))
--8<---------------cut here---------------end--------------->8---
Or could this have any bad side effects? Is it maybe too heavy to call
`file-truename'?
Thanks,
Michael.
In GNU Emacs 24.3.50.2 (x86_64-unknown-linux-gnu, GTK+ Version 3.10.7)
of 2014-03-14 on drachen
Windowing system distributor `The X.Org Foundation', version 11.0.11500000
System Description: Debian GNU/Linux testing (jessie)
Important settings:
value of $LC_ALL: de_DE.utf8
value of $LC_COLLATE: C
value of $LC_TIME: C
value of $LANG: de_DE.utf8
locale-coding-system: utf-8-unix
Major mode: Emacs-Lisp
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#17064
; Package
emacs
.
(Wed, 30 Oct 2019 23:34:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 17064 <at> debbugs.gnu.org (full text, mbox):
Michael Heerdegen <michael_heerdegen <at> web.de> writes:
> in dired, symlinks look like
>
> symlink -> target
>
> where the whole thing is fontified with dired-symlink-face. But I
> already know from the -> that I have a symlink, it would be more useful
> to know whether TARGET is a directory, which is what I normally see for
> non symlink files in dired by fontification with dired-directory-face.
>
> My proposal: fontify only the first part "symlink ->" with
> dired-symlink-face. Fontify "target" according to its truename type.
Sounds good to me.
> (cl-callf nconc dired-font-lock-keywords
> `((,dired-re-sym
> ((lambda (end) (when (let ((file (dired-file-name-at-point)))
> (file-directory-p (file-truename file)))
> (search-forward-regexp "\\(.+-> ?\\)\\(.+\\)" end t)))
> (dired-move-to-filename)
> nil
> (1 dired-symlink-face)
> (2 dired-directory-face)))
[...]
> Or could this have any bad side effects? Is it maybe too heavy to call
> `file-truename'?
Normally, there aren't many symlinks in a buffer, so I think the
performance impact would be negligible.
I've added a modified version of your code to Emacs 27 -- more error
checking was necessary, because symlinks may be circular etc.
--
(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
.
(Wed, 30 Oct 2019 23:34:02 GMT)
Full text and
rfc822 format available.
bug marked as fixed in version 27.1, send any further explanations to
17064 <at> debbugs.gnu.org and Michael Heerdegen <michael_heerdegen <at> web.de>
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Wed, 30 Oct 2019 23:34:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 28 Nov 2019 12:24:08 GMT)
Full text and
rfc822 format available.
This bug report was last modified 4 years and 122 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.