【发布时间】:2015-07-28 14:44:27
【问题描述】:
如何在 emacs 的文本缓冲区中仅将替换正则表达式应用于单行?例如,我在 org-mode 下工作,并且想将此正则表达式替换仅应用于当前选定的行,而不是整个 org-mode 文本缓冲区:
M-x replace-regexp RET [-]\\{1\\}[ ]\\{1\\} RET RET
【问题讨论】:
如何在 emacs 的文本缓冲区中仅将替换正则表达式应用于单行?例如,我在 org-mode 下工作,并且想将此正则表达式替换仅应用于当前选定的行,而不是整个 org-mode 文本缓冲区:
M-x replace-regexp RET [-]\\{1\\}[ ]\\{1\\} RET RET
【问题讨论】:
<f1> f replace-regexp RET:
replace-regexp is an interactive compiled Lisp function in
`replace.el'.
(replace-regexp REGEXP TO-STRING &optional DELIMITED START END
BACKWARD)
...
In Transient Mark mode, if the mark is active, operate on the contents
of the region. Otherwise, operate from point to the end of the buffer.
换句话说,突出显示该行,然后调用replace-regexp。
【讨论】: