它似乎以任何方式改变缓冲区,阻止defun激活标记:
(defun mark-five-next ()
"Marks the next five chars as expected"
(interactive)
(push-mark (+ 5 (point)) t t))
(defun insert-an-a-then-mark-five-next ()
"Does not mark the next five chars"
(interactive)
(insert "a")
(push-mark (+ 5 (point)) t t))
Run Code Online (Sandbox Code Playgroud)
我更喜欢一种方法来解决它,但只是一个解释也很好.
事实证明,所有编辑命令都设置了var deactivate-mark
,命令完成后就是这样做的.
要避免此行为,必须将缓冲区更改函数包装在let
-statement中,以防止更改全局deactivate-mark
var.
(let (deactivate-mark)
(...))
Run Code Online (Sandbox Code Playgroud)
我在这个问题上花了一个多小时,因为我刚刚在手册中跳过了deactivate-mark,认为这是对函数的描述.当然,正如我已经知道的那样,但现在已经正确学习:emacs lisp对函数和变量有不同的命名空间.
归档时间: |
|
查看次数: |
259 次 |
最近记录: |