From: Tino Calancha <tino.calancha@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 27762@debbugs.gnu.org
Subject: bug#27762: 26.0.50; ls-lisp: misalignment when dired-directory is a cons
Date: Tue, 01 Aug 2017 16:01:17 +0900 [thread overview]
Message-ID: <87a83jkc02.fsf@calancha-pc> (raw)
In-Reply-To: <83shhf3brw.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 29 Jul 2017 11:09:07 +0300")
Eli Zaretskii <eliz@gnu.org> writes:
> 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?
That is to work regardless on the `dired-hide-details-mode' value.
If we use `current-column' we are in trouble.
Consider the following:
;; Definition uses `current-column'.
(defun dired--need-align-p ()
"Return non-nil if some file names are misaligned.
The return value is the target column for the file names."
(save-excursion
(goto-char (point-min))
(dired-goto-next-file)
;; Use point difference instead of `current-column', because
;; the former works when `dired-hide-details-mode' is enabled.
(let* ((first (current-column))
(target first))
(while (and (not (eobp))
(progn
(forward-line)
(dired-move-to-filename)))
(when (> (current-column) target)
(setq target (current-column))))
(and (/= first target) target))))
;; Eval following form:
(let* ((dir (expand-file-name "src" source-directory))
(default-directory dir))
(dired (list dir "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))))
M-: (dired--need-align-p) RET
=> t
( ; toggle dired-hide-details-mode
M-: (dired--need-align-p) RET
=> nil
( ; Toggle again: the files still are misaligned.
next prev parent reply other threads:[~2017-08-01 7:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-19 3:21 bug#27762: 26.0.50; ls-lisp: misalignment when dired-directory is a cons Tino Calancha
2017-07-19 17:04 ` Eli Zaretskii
2017-07-20 3:45 ` Tino Calancha
2017-07-21 4:55 ` Tino Calancha
2017-07-29 8:09 ` Eli Zaretskii
2017-08-01 7:01 ` Tino Calancha [this message]
2017-08-01 13:46 ` Eli Zaretskii
2017-08-01 15:08 ` Tino Calancha
2017-08-01 15:43 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87a83jkc02.fsf@calancha-pc \
--to=tino.calancha@gmail.com \
--cc=27762@debbugs.gnu.org \
--cc=eliz@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).