bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#18051: 24.3.92; ls-lisp: Sorting; make ls-lisp-string-lessp a normal


From: Eli Zaretskii
Subject: bug#18051: 24.3.92; ls-lisp: Sorting; make ls-lisp-string-lessp a normal function?
Date: Sun, 20 Jul 2014 09:07:48 +0300

> From: Michael Heerdegen <michael_heerdegen@web.de>
> Cc: Michael Albinus <michael.albinus@gmx.de>,  18051@debbugs.gnu.org
> Date: Sun, 20 Jul 2014 07:49:48 +0200
> 
> There are other things.  What I don't like from ls is that it shows
> symlinks like this:
> 
>    lrwxrwxrwx ... ...
> 
> rwxrwxrwx is redundant.

It's what 'lstat' returns.

> When you use M on a link in dired, you actually
> set the modes of the target.  I want to see the target file's modes, so
> I use this:
> 
> ,----------------------------------------------------------------------
> | (defun my-ls-lisp-treat-symlinks-ad (file-alist &rest _)
> |   "Make it show modes of truenames for symlinks."
> |   (mapc (lambda (file-line)
> |           (let ((filename (expand-file-name (car file-line)
> |                                             default-directory))
> |                 modes-string)
> |             (when (file-symlink-p filename)
> |               (setq modes-string (nth 8 (file-attributes
> |                                          (file-truename filename))))
> |               (if (not modes-string) ;; link could be dead!
> |                   (setq modes-string "l?????????")
> |                 (aset modes-string 0 ?l))
> |               (setf (nth 9 file-line) modes-string))))
> |         file-alist)
> |   file-alist)
> | 
> | (advice-add 'ls-lisp-handle-switches :after #'my-ls-lisp-treat-symlinks-ad)
> `----------------------------------------------------------------------
> 
> AFAIK this can't be reached with ls.

Doesn't "ls -L" give you that?

> Just one example.  Trying to do such things with Tramp would
> probably indeed slow it down.

IMO, the right way to do this is to have an additional argument to
file-attributes, follow-symlinks, with the obvious semantics.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]