不一致的Mx对齐,正则表达式对铜的Mx对齐,正则表达式的行为 [英] Inconsistent M-x align-regexp vs. C-u M-x align-regexp behaviour
问题描述
我试着写了Emacs的一些新的对齐规则,发现这个奇怪的和不一致的行为。当前缓冲区的内容:
I've tried to write some new align rules for emacs and found this strange and inconsistent behaviour. Current buffer contents:
"some thing" like => this
hello => world
and => again
在打字M-x<$c$c>align-regexp$c$c>RET<$c$c>[[:lower:]]+\(\s-+\)=>$c$c>RET结果看起来期望:
After typing M-xalign-regexp
RET[[:lower:]]+\(\s-+\)=>
RET result looks as desired:
"some thing" like => this
hello => world
and => again
但经过C-uM-x<$c$c>align-regexp$c$c>RET<$c$c>[[:lower:]]+\(\s-+\)=>$c$c>RET<$c$c>1$c$c>RET<$c$c>1$c$c>RET<$c$c>y$c$c>RET我得到这个代替:
"some thing" like => this
hello => world
and => again
同样的(错误的)事情发生,如果我把这个变成对齐-规则列表
。如何解决这一问题?我想要得到的结果类似第一。
The same (wrong) thing happens if I put this into align-rules-list
. How to fix this? I want to get the results like first.
推荐答案
有趣的问题。
当您运行的命令的在Emacs,记住互动形式 你pre-加工参数。
When you run commands in Emacs, keep in mind that interactive forms are pre-processing arguments for you.
要看看的功能的最终接收,preSS <大骨节病> CX ESC ESC
To see what the function finally receives, press C-x ESC ESC
在这种情况下,您将在前者的情况看:
In this case, you'll see in the former case:
(align-regexp 1 57 "\\(\\s-*\\)[[:lower:]]+\\(\\s-+\\)=>" 1 1 nil)
和这个在后一
(align-regexp 1 57 "[[:lower:]]+\\(\\s-+\\)=>" 1 1 t)
这篇关于不一致的Mx对齐,正则表达式对铜的Mx对齐,正则表达式的行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!