Subject: Re: bug#39145: 28.0.50; dired: Show broken/circular links in different font

From: Tino Calancha <[email-masked]>
Date: Tue, 25 Aug 2020 18:34:08 +0200

Tino Calancha <[email-masked]> writes:

> Today I have updated the patch to match what bash does
> now I only use dired-broken-symlink at 'foo' and 'bar' keeping '->' with
> dired-symlink.
>
> commit d250625b8f79a3b9273de6640f4840b5c8e54fe8
> Author: Tino Calancha <[email-masked]>
> Date:   Mon Aug 24 19:44:29 2020 +0200
>
>     dired: Show broken/circular links w/ different face
>     
>     * lisp/dired.el (dired-broken-symlink): New face.
>     (dired-font-lock-keywords) Use the new face for broken/circular links.
>     
>     * etc/NEWS (Changes in Specialized Modes and Packages in Emacs 28.1):
>     Announce this change.
>     
>     * test/lisp/dired-tests.el (dired-test-dired-broken-symlink-face):
>     Add a test.

Would be more emacsy to add an user option to enable/disable the feature?
Something like:

(defcustom dired-alert-on-broken-links t
  "If non-nil, display broken and circular links with `dired-broken-symlink'."
  :type 'boolean
  :group 'dired
  :version "28.1")

There is still something else that worries me.

If I have a broken link, and I create the missing target with
`dired-create-directory' or `dired-create-empty-file', then
I need to manually call `revert-buffer' to get the link face updated.

Same if teh target do exist and I decide to delete it with
`dired-do-delete'.
Note, this is not the case if you modify the target with wdired, because
wdired revert the buffer after applying the changes. 

A solution would be to call `dired-revert' at functions like
`dired-internal-do-deletions', `dired-create-empty-file' or
`dired-create-directory'.
That call could be optional in case we add a user option to control this feature.