[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:35:21 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
"H. Dieter Wilhelm" <dieter@duenenhof-wilhelm.de> writes:
> For my needs it is working perfectly (I didn't study it, because it
> works so nicely in my programming mode "APDL-Mode" on Melpa). Here's an
> example when setting parameters:
>
> mp = 3333333
> l =40.0
> kkkkk=8
>
> M-x apdl-align
>
> mp = 3333333
> l = 40.0
> kkkkk = 8
Ah, I see. apdl-mode has set up a bunch of rules in
apdl-align-rules-list, and that makes `M-x align' work perfectly.
text-mode hasn't set up any alignment rules, so `M-x align' does nothing
and `C-u M-x align' does... weird stuff?
No, not quite?
(defcustom align-rules-list
[...]
;; 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))))))
So this is where the prefix action comes from! Wow, that's a weird way
to control this.
But... why? Why only have `M-x align' do something in text modes if
you give it a prefix?
And the other oddness I was seeing with this indentation:
foo bar zot
lalala y indeed
It indents it the expected way if I change the "y" into a "yy".
foo bar zot
lalala yy indeed
I guess there's some heavy DWIM involved here?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Re: align mysteries, Stefan Monnier, 2021/10/14
Re: align mysteries, Teemu Likonen, 2021/10/15