[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#27762: 26.0.50; ls-lisp: misalignment when dired-directory is a cons
From: |
Tino Calancha |
Subject: |
bug#27762: 26.0.50; ls-lisp: misalignment when dired-directory is a cons |
Date: |
Thu, 20 Jul 2017 12:45:22 +0900 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) |
Eli Zaretskii <eliz@gnu.org> writes:
>> II) Now suppose we want to list the same files _but_ we want that
>> "cyge32.c" appears the first.
>> emacs -Q -l ls-lisp -eval '(setq ls-lisp-use-insert-directory-program nil)'
>> Eval this form:
>>
>> (let* ((dir source-directory)
>> (default-directory dir)
>> (files (mapcar (lambda (f) (concat "src/" f))
>> (cons "cygw32.c"
>> (delete "cygw32.c"
>> (directory-files
>> (expand-file-name "src") nil "\\.*\\.c\\'"))))))
>> (dired (nconc (list dir) files)))
>> ;; Note how the first file looks misaligned.
>
> Thanks, but I'd prefer to keep the ls-lisp related stuff confined to
> ls-lisp.el. Is it possible to rewrite the patch such that dired.el
> code doesn't need to call ls-lisp functions directly (and thus the
> need for (featurep 'ls-lisp) etc. would be avoided)?
Thanks. Yes, that sounds better.
> Also, what exactly is the source of the differences between ls-lisp
> and the 'ls' command, and are you sure the differences aren't specific
> to GNU 'ls'?
I think II) above is not specific of ls-lisp: the same happen with
GNU ls.
With emacs -Q:
(let* ((dir (expand-file-name "src" source-directory))
(default-directory dir))
(dired (list dir "cygw32.c" "alloc.c" "w32xfns.c" "xdisp.c")) ; Wrong
aligment.
;; Following just fix the first file, but xdisp.c keeps misaligned.
(dired-goto-file (expand-file-name "cygw32.c"))
(forward-line 0)
(let ((inhibit-read-only t))
(dired-align-file (point) (point-max))))
Note that when i eval the previous form GNU 'ls' is used, and i see
misalignment.
I would expect `dired-align-file' fix this problem, but i doesn't.
*) Since this is not specific of `ls-lisp', one alternative fix could
be to run `dired-align-file' at the end of `dired-internal-noselect'
when `dired-directory' is a cons.
**) First, we must fix `dired-lign-file', which is not doing its job
in the snippet above.