Suhail Singh <suhailsingh...@gmail.com> writes: Hi Suhail,
>> ;; Symbolic link to a non-directory. >> (list dired-re-sym >> (list (lambda (end) >> - (when-let ((file (dired-file-name-at-point))) >> - (let ((truename (ignore-errors (file-truename file)))) >> - (and (or (not truename) >> - (not (file-directory-p truename))) >> - (search-forward-regexp "\\(.+-> ?\\)\\(.+\\)" >> - end t))))) >> + (if (not (connection-local-value dired-check-symlinks)) >> + (search-forward-regexp >> + "\\(.+-> ?\\)\\(.+\\)" end t) >> + (when-let ((file (dired-file-name-at-point))) >> + (let ((truename (ignore-errors (file-truename file)))) >> + (and (or (not truename) >> + (not (file-directory-p truename))) >> + (search-forward-regexp >> + "\\(.+-> ?\\)\\(.+\\)" end t)))))) > > Minor nitpick: given the comment for this section (which seems to > suggest this only applies to symlinks to non-directories), wouldn't it > be "better" to simply have something like below instead for the if-then > case? I.e., a separate entry in dired-font-lock-keywords for the > failsafe. > > #+begin_src emacs-lisp > ;; Generic face for symbolic links > (list dired-re-sym > (when (not (connection-local-value dired-check-symlinks)) > '(".+" (dired-move-to-filename) nil (0 dired-symlink-face)))) > #+end_src > > This is essentially what I have in my config today, and seems to behave > as expected. Possible, but I don't see that one version is "better" or "worse" than the other. So I don't see a need to change it. Best regards, Michael.