0

By default Emacs' ls-lisp shows the symlink destination in its output like this:

/tmp:
total used in directory 2 available 12933091
lrwxr-xr-x  40 02-07 16:12 foo -> bar
-rw-r--r--   0 03-06 14:45 bar

Is there any way to make ls-lisp not show the symlink destination (the "-> bar" part)?

The reason for asking this is that the symlink destination can in some cases be very long and cause a linebreak, which looks ugly in dired.

1

Dunno whether there is something specific to ls-lisp (haven't found it), but for Dired more generally, if you turn on dired-hide-details-mode (e.g., using (), and if you the value of option dired-hide-details-hide-symlink-targets is non-nil then the targets of symlinks are hidden when details are hidden.

(If the length of the target name is a problem you can also consider using relative symbolic links, which are typically much shorter. Command dired-do-relsymlink (bound to Y) from dired-x.el creates a relative symlink.)

0

The reason for asking this is that the symlink destination can in some cases be very long and cause a linebreak, which looks ugly in dired.

An alternative approach would be to enable line truncation for dired buffers:

(add-hook 'dired-mode-hook 'my-dired-mode-hook)

(defun my-dired-mode-hook ()
  "Custom `dired-mode' behaviours."
  (setq truncate-lines t))

I do recommend using dired-hide-details-mode as mentioned by Drew, but truncating lines might be preferable to entirely hiding symlink targets.

<C-next> and <C-prior> (n.b. next/prior are typically Page Down and Page up keys) are used to scroll horizontally when lines are truncated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.