看看这个简单的程序:
(defun test ()
(interactive)
(push-mark)
(setq mark-active t)
(search-forward "a" nil nil 1))
Run Code Online (Sandbox Code Playgroud)
它将光标移动到最近的'a',并突出显示路径.当然,这很明显.
但它的行为有所不同,具体取决于执行此过程后您的下一个输入是什么,例如,您输入一个字符,如'b'或\ Cg,突出显示消失,但如果您输入\ Cf或\ Ce,则突出显示保持不变.所以这是我的问题:是什么让这些输入表现不同?
除了JB所说的,你可以通过在命令结束时这样做来阻止他所引用的标记的自动停用:
(setq deactivate-mark nil)
Run Code Online (Sandbox Code Playgroud)
这是doc字符串.注意最后一句话(这就是JB所说的).
deactivate-mark is a variable defined in `C source code'.
Its value is nil
Documentation:
If an editing command sets this to t, deactivate the mark afterward.
The command loop sets this to nil before each command,
and tests the value when the command returns.
Buffer modification stores t in this variable.
Run Code Online (Sandbox Code Playgroud)