unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 67953@debbugs.gnu.org
Subject: bug#67953: 30.0.50; ls-lisp messes up columns
Date: Fri, 22 Dec 2023 10:31:07 -0500	[thread overview]
Message-ID: <jwvle9mb6o9.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <83jzp6fw69.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 22 Dec 2023 11:01:18 +0200")

> The simple kludge below, which simply prevents it from realigning the
> first column of data, seems to fix it here.  WDYT?

Looks OK to me.  I'd recommend we add a comment about this (zerop
curcol) test explaining why the other branch mishandles this
case (or mentioning that we don't know why).


        Stefan


> diff --git a/lisp/dired.el b/lisp/dired.el
> index cc548ba..3838368 100644
> --- a/lisp/dired.el
> +++ b/lisp/dired.el
> @@ -1572,14 +1572,16 @@ dired-align-file
>  		 ;; the beginning or the end of the next field, depending on
>  		 ;; whether this field is left or right aligned).
>  		 (align-pt-offset
> -		  (save-excursion
> -		    (goto-char other)
> -		    (move-to-column curcol)
> -		    (when (looking-at
> -			   (concat
> -			    (if (eq (char-before) ?\s) " *" "[^ ]* *")
> -			    (if num-align "[0-9][^ ]*")))
> -		      (- (match-end 0) (match-beginning 0)))))
> +                  (if (zerop curcol)
> +                      0
> +		    (save-excursion
> +		      (goto-char other)
> +		      (move-to-column curcol)
> +		      (when (looking-at
> +			     (concat
> +			      (if (eq (char-before) ?\s) " *" "[^ ]* *")
> +			      (if num-align "[0-9][^ ]*")))
> +		        (- (match-end 0) (match-beginning 0))))))
>  		 ;; Now, the number of spaces to insert is align-pt-offset
>  		 ;; minus the distance to the equivalent point on the
>  		 ;; current line.






  reply	other threads:[~2023-12-22 15:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-21 14:35 bug#67953: 30.0.50; ls-lisp messes up columns Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-22  9:01 ` Eli Zaretskii
2023-12-22 15:31   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-12-23 11:05     ` 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=jwvle9mb6o9.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=67953@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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).