I try to align something using align-regexp but can't get the desired behavior.
Here's what I have at first:
[21:26] <Luke-Jr> btcNeverSleeps: no
[21:26] <dmanderson> Not if it has to wait to make it into the block
[21:26] <btcNeverSleeps> Luke-Jr: can you develop a bit?
[21:26] <Luke-Jr> btcNeverSleeps: Bitcoin is a currency, not an authentication system
[21:26] <dmanderson> your user could be waiting a LONG time for 1 Satoshi to who up
[21:26] <Luke-Jr> btcNeverSleeps: you can use signed messages though
Here's what I want:
[21:26] <Luke-Jr> btcNeverSleeps: no
[21:26] <dmanderson> Not if it has to wait to make it into the block
[21:26] <btcNeverSleeps> Luke-Jr: can you develop a bit?
[21:26] <Luke-Jr> btcNeverSleeps: Bitcoin is a currency, not an authentication system
[21:26] <dmanderson> your user could be waiting a LONG time for 1 Satoshi to who up
[21:26] <Luke-Jr> btcNeverSleeps: you can use signed messages though
Here's what I get using "align-rexegp RET > RET": (and which is NOT what I want)
[21:26] <Luke-Jr > btcNeverSleeps: no
[21:26] <dmanderson > Not if it has to wait to make it into the block
[21:26] <btcNeverSleeps > Luke-Jr: can you develop a bit?
[21:26] <Luke-Jr > btcNeverSleeps: Bitcoin is a currency, not an authentication system
[21:26] <dmanderson > your user could be waiting a LONG time for 1 Satoshi to who up
[21:26] <Luke-Jr > btcNeverSleeps: you can use signed messages though
can what I want be done with a simple align-regexp
or should I look into something more advanced? (for example I know I can definitely do it using a macro but I'd first like to know if it can be done using a simple regexp).
The align-regexp
function is not well documented. What you actually want to do in this case is to use C-u M-x align-regexp
Then, follow the prompts being sure to enter -1 to justify the capture group.
Complex align using regexp: (<[^>]*>)
Parenthesis group to modify (justify if negative): -1
Amount of spacing (or column if negative): 1
Repeat throughout line? (yes or no): yes
You need to include the bracketed text in the capturing group, then turn on justification by supplying a negative group argument:
C-u M-xalign-regexp
RET\( <[^>]+>\)
RETDEL-1
RETRETn
align-regexp
is definitely one of the more cryptic Emacs commands. Powerful, though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With