[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: align mysteries
From: |
Eli Zaretskii |
Subject: |
Re: align mysteries |
Date: |
Fri, 15 Oct 2021 09:20:47 +0300 |
> From: Lars Ingebrigtsen <larsi@gnus.org>
> Date: Thu, 14 Oct 2021 23:41:44 +0200
> Cc: dick <dick.r.chiang@gmail.com>, emacs-devel@gnu.org
>
> Lars Ingebrigtsen <larsi@gnus.org> writes:
>
> > But... why? Why only have `M-x align' do something in text modes if
> > you give it a prefix?
>
> It's to be able to have different predefined alignments depending on the
> prefix, I guess:
>
> ;; With a numeric prefix argument, or C-u, space delimited text
> ;; tables will be aligned.
> (text-column
> (regexp . "\\(^\\|\\S-\\)\\([ \t]+\\)\\(\\S-\\|$\\)")
> (group . 2)
> (modes . align-text-modes)
> (repeat . t)
> (run-if . ,(lambda ()
> (and current-prefix-arg
> (not (eq '- current-prefix-arg))))))
>
> ;; With a negative prefix argument, lists of dollar figures will
> ;; be aligned.
> (text-dollar-figure
> (regexp . "\\$?\\(\\s-+[0-9]+\\)\\.")
> (modes . align-text-modes)
> (justify . t)
> (run-if . ,(lambda ()
> (eq '- current-prefix-arg))))
>
> It still doesn't explain why the first one doesn't just test that it's
> not minus.
It really doesn't make sense to have this discussion without involving
John Wiegley, the author (CC'ed).
> The `align' doc string should mention that the prefix can influence
> which rule is used, at the very least.
The doc string needs a lot of work, but it cannot be improved before
we understand well enough what the function is doing in the various
use cases.
Re: align mysteries, Stefan Monnier, 2021/10/14
Re: align mysteries, Teemu Likonen, 2021/10/15