我的使用环境是:linux mint 22.3;emacs 30.2,自己手动编译,但没有更改或添加任何参数;文本编码为utf-8。
在emacs -q下测试使用这段文本,目标将to替换为into:
Attempts to retrieve or share EMACS information not necessary to perform your job duties are strictly prohibited. Unauthorized access may result in disciplinary action, up to and including termination and …
M-% runs the command query-replace (found in global-map), which is an
interactive native-comp-function in ‘replace.el’.
It is bound to M-% and %.
It can also be invoked from the menu: Edit → Replace → Replace String…
(query-replace FROM-STRING TO-STRING &optional DELIMITED START END BACKWARD
REGION-NONCONTIGUOUS-P)
Inferred type: (function (t t &optional t t t t t) t)
Replace some occurrences of FROM-STRING with TO-STRING.
As each match is found, the user must type a character saying
what to do with it. Type SPC or ‘y’ to replace the match,
DEL or ‘n’ to skip and go to the next match. For more directions,
type C-h at that time.
In Transient Mark mode, if the mark is active, operate on the contentsof the region. Otherwise, operate from point to the end of the buffer’saccessible portion.
In interactive use, the prefix arg (non-nil DELIMITED in
non-interactive use), means replace only matches surrounded by
word boundaries. A negative prefix arg means replace backward.
Use M-n to pull the last incremental search string to the minibuffer
that reads FROM-STRING, or invoke replacements from
incremental search with a key sequence like C-s C-s M-%
to use its current search string as the string to replace.
加粗的这一段:“ 在 Transient Mark 模式下,如果标记(mark)处于激活状态,则对区域(region)的内容进行操作。否则,操作范围将从光标位置(point)始终延伸至缓冲区(buffer)可访问部分的末尾。”