emacs 中宏的查询替换?
我经常使用 emacs 中的内置 f3/f4 绑定来记录和重复宏,并发现它是一个非常强大且有用的功能,特别是与搜索结合使用时。然而,我最近注意到,每当我执行查询替换(默认情况下为 MS-5)时,记录我的宏都会停止!有办法防止这种情况吗?我知道查询替换是交互式的,但如果我输入 'y' 3 次进行 3 次替换,我认为宏应该执行相同的操作。
没问题,我想,在录制宏时,我会执行 Cu 3 MS-5,这样它就会精确地进行 3 次替换,因为我知道这对于我正在做的事情来说已经足够好了。但显然查询替换忽略了 Cu!通常宏的使用和铜的使用对我来说是无缝的。有没有办法让它们与查询替换一起使用?
I use the builtin f3/f4 bindings in emacs a lot to record and repeat macros, and find it to be a very powerful and useful feature, especially when combined with search. However, I noticed recently that whenever I do a query-replace (M-S-5 by default) that recording my macro stops! Is there a way to prevent this? I know that query-replace is interactive but if I enter 'y' 3 times to do 3 replaces, I figure the macro should just do the same.
No problem I figure, when recording my macro I'll do C-u 3 M-S-5 so it'll do the replacement exactly 3 times since I know that's good enough for what I'm doing. But apparently query-replace ignores C-u! Usually macro use and C-u use are seamless for me. Is there a way I can make them work with query-replace?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在我的 Emacs (23.2) 和没有用户初始化文件 (
emacs -q
) 的情况下,我发现query-replace
工作得很好。 测试这是我输入的
:我将光标移动到该文本块的顶部
,这给我留下了:
再次按下 给我留下了:
按预期工作。我建议尝试使用
emacs -q
以确保您没有任何影响行为的自定义。With my Emacs (23.2) and no user init file (
emacs -q
), I find thatquery-replace
works just fine. This is my testI typed in:
I moved the cursor to the top of that text block
which left me with:
Pressing <f4> again left me with:
Works as expected. I'd recommend trying with
emacs -q
to ensure you don't have any customizations that affect the behavior.