不一致的 M-x align-regexp 与 C-u M-x align-regexp 行为 [英] Inconsistent M-x align-regexp vs. C-u M-x align-regexp behaviour

查看:23
本文介绍了不一致的 M-x align-regexp 与 C-u M-x align-regexp 行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试为 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-regexpRET[[:lower:]]+(s-+)=>RET 结果看起来符合要求:

After typing M-xalign-regexpRET[[:lower:]]+(s-+)=>RET result looks as desired:

"some thing" like => this
             hello => world
             and => again

但是在 CuMxalign-regexpRET[[:lower:]]+ 之后(s-+)=>RET1RET1RETyRET 我得到了这个:

But after C-uM-xalign-regexpRET[[:lower:]]+(s-+)=>RET1RET1RETyRET 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆