emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: align mysteries


From: Lars Ingebrigtsen
Subject: Re: align mysteries
Date: Thu, 14 Oct 2021 23:41:44 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

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.

The `align' doc string should mention that the prefix can influence
which rule is used, at the very least.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



reply via email to

[Prev in Thread] Current Thread [Next in Thread]