Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我已经设置了activate-mark-hook和deactivate-mark-hook,但是它们仅在通过拖动鼠标选择文本时才起作用,而不是通过使用shift-selection。如何加入班次选择?
我在 Mac OS X 10.6.6 上使用 Aquamacs 24。
刚刚查看了 Emacs 源代码,看看会发生什么,这就是我发现的:
对于已被移位转换的每个命令,都会调用函数“handle-shift-selection”。此函数将通过使用“transient-mark-mode”变量以及分别调用“push-mark”和“deactivate-mark”来激活或停用选择。如果我计算正确,这意味着将调用您的停用挂钩,而不是您的激活挂钩。
解决此问题的一种方法是使用“defadvice”将您自己的代码添加到“push-mark”。