Subject: Re: bug#27762: 26.0.50; ls-lisp: misalignment when dired-directory is a cons

From: Eli Zaretskii <[email-masked]>
Date: Sat, 29 Jul 2017 11:09:07 +0300

> From: Tino Calancha <[email-masked]>
> Cc: [email-masked]
> Date: Fri, 21 Jul 2017 13:55:26 +0900
> 
> 
> > 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.
> Eli, how do you think about following patch?

Looks OK, but why this complicated code:

> +        (when-let* ((col-diff (- (point) (point-at-bol)))
> +                    (higher (> col-diff target)))
> +          (setq target col-diff)))
> +      (and (/= first target) target))))

Doesn't current-column do its job in this case?

Thanks.