不一致的 M-x align-regexp 与 C-u M-x align-regexp 行为 [英] 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
输入Mxalign-regexp
RET[[:lower:]]+(s-+)=>
RET 结果看起来符合要求:
After typing M-xalign-regexp
RET[[:lower:]]+(s-+)=>
RET result looks as desired:
"some thing" like => this
hello => world
and => again
但是在 CuMxalign-regexp
RET[[:lower:]]+ 之后(s-+)=>
RET1
RET1
RETy
RET 我得到了这个:
But after C-uM-xalign-regexp
RET[[:lower:]]+(s-+)=>
RET1
RET1
RETy
RET I get this instead:
"some thing" like => this
hello => world
and => again
如果我把它放到 align-rules-list
中,也会发生同样(错误)的事情.如何解决这个问题?我想先得到结果.
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 中运行命令时,请记住交互式表单是为您预处理参数.
When you run commands in Emacs, keep in mind that interactive forms are pre-processing arguments for you.
要查看函数最终收到什么,按C-x 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)
这篇关于不一致的 M-x align-regexp 与 C-u M-x align-regexp 行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!