简体   繁体   English

如何将replace-regexp仅应用于emacs中的一行?

[英]How to apply replace-regexp to only a single line in emacs?

How do I apply replace-regexp to only a single line in a text buffer in emacs? 如何将replace-regexp仅应用于emacs文本缓冲区中的一行? For example, I am working in org-mode and would like to apply this regular expression replacement to the currently selected line only, not the entire org-mode text buffer: 例如,我在组织模式下工作,并且想将此正则表达式替换仅应用于当前选定的行,而不是整个组织模式文本缓冲区:

M-x replace-regexp RET [-]\\{1\\}[ ]\\{1\\} RET RET 

<f1> f replace-regexp 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.

In other words, highlight the line, and call replace-regexp . 换句话说,突出显示该行,然后调用replace-regexp

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM