Change your ls
switches, using option dired-listing-switches
or by using a prefix arg with command dired
(in which case you're prompted for the ls
switches for that particular Dired listing).
Depending on your ls
(use M-x man RET ls RET
to see what yours offers), you can use a switch such as these:
-H, --dereference-command-line
follow symbolic links listed on the command line
--dereference-command-line-symlink-to-dir
follow each command line symbolic link
that points to a directory
-L, --dereference
when showing file information for a symbolic link, show informa-
tion for the file the link references rather than for the link
itself
In a comment you mention that you're really interested in the header lines of directories (presumably including inserted subdir listings) - showing whether they are symlinks and if so what they link to.
In that case no, as far as I know that's not available with Dired. You might want to file an enhancement request, using M-x report-emacs-bug
.
Or you could code it yourself, using function file-symlink-p
to test whether the directory is itself a symlink.
You could then advise or redefine function dired-insert-directory
, where it inserts the directory header line, to do what you want. That's this code from file dired.el
:
;; Note that dired-build-subdir-alist will replace the name
;; by its expansion, so it does not matter whether what we insert
;; here is fully expanded, but it should be absolute.
(insert " " (or (car-safe (insert-directory-wildcard-in-dir-p dir))
(directory-file-name (file-name-directory dir))) ":\n")
However, I think it's quite likely that will break several Dired features that depend on the current format for the header line and use the directory name there for multiple purposes. (E.g., see that comment.)
Ask yourself how important it is that you see the symlink destination in the header line.
If what's important to you are (1) to have some indication that the directory in the header line is a symlink, and (2) then be able to find out what it symlinks to, then you can do this:
Add font-locking to color or whatever the directory header line when the directory is a symlink.
Add a command to use with the cursor on that header line, which echoes the symlink destination.