all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Michael Heerdegen <michael_heerdegen@web.de>
Cc: 17064@debbugs.gnu.org
Subject: bug#17064: 24.3.50; Enhancement request: dired: fontification of symlinks
Date: Thu, 31 Oct 2019 00:33:02 +0100	[thread overview]
Message-ID: <87v9s5n70x.fsf@gnus.org> (raw)
In-Reply-To: <87siqb6s9i.fsf@web.de> (Michael Heerdegen's message of "Sat, 22 Mar 2014 00:34:01 +0100")

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





      reply	other threads:[~2019-10-30 23:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-21 23:34 bug#17064: 24.3.50; Enhancement request: dired: fontification of symlinks Michael Heerdegen
2019-10-30 23:33 ` Lars Ingebrigtsen [this message]

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=87v9s5n70x.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=17064@debbugs.gnu.org \
    --cc=michael_heerdegen@web.de \
    /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.