[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#17064: 24.3.50; Enhancement request: dired: fontification of symlink
From: |
Lars Ingebrigtsen |
Subject: |
bug#17064: 24.3.50; Enhancement request: dired: fontification of symlinks |
Date: |
Thu, 31 Oct 2019 00:33:02 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
Michael Heerdegen <michael_heerdegen@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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bug#17064: 24.3.50; Enhancement request: dired: fontification of symlinks,
Lars Ingebrigtsen <=