【问题标题】:Inconsistent M-x align-regexp vs. C-u M-x align-regexp behaviour不一致的 M-x align-regexp 与 C-u M-x align-regexp 行为
【发布时间】:2012-10-19 12:40:54
【问题描述】:

我尝试为 emacs 编写一些新的对齐规则,但发现这种奇怪且不一致的行为。当前缓冲区内容:

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

在输入 M-xalign-regexpRET[[:lower:]]+\(\s-+\)=>RET 后,结果看起来如所愿:

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

但是在C-uM-xalign-regexpRET[[:lower:]]+\(\s-+\)=>RET1RET之后1RETyRET 我得到了这个:

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

如果我把它放到align-rules-list 中,也会发生同样的(错误的)事情。如何解决这个问题?我想先得到结果。

【问题讨论】:

    标签: emacs alignment elisp


    【解决方案1】:

    好问题。

    当您在 Emacs 中运行 commands 时,请记住交互式表单是 为您预处理参数。

    要查看 函数 最终收到什么,请按 C-x ESC ESC

    在这种情况下,您会看到前一种情况:

    (align-regexp 1 57 "\\(\\s-*\\)[[:lower:]]+\\(\\s-+\\)=>" 1 1 nil)
    

    后者是这个

    (align-regexp 1 57 "[[:lower:]]+\\(\\s-+\\)=>" 1 1 t)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-06-06
      • 1970-01-01
      • 2014-10-09
      • 2020-01-11
      • 1970-01-01
      • 1970-01-01
      • 2013-01-13
      相关资源
      最近更新 更多