Bor*_*aso 5 emacs elisp configuration-files key-bindings keymaps
有什么办法可以将本地标记和全球标记结合在一起吗?我想做的只是对pop-global-mark和set-mark-command有一个通用的键绑定。就像是; “尝试弹出本地标记,如果没有剩余标记,则尝试弹出全局标记”。
这是需要向后移动代码的,而不是考虑我是否应该按C-u C-SPC或C-x C-SPC,具体取决于函数之间的跳转是在同一文件内部还是外部。
首先,您不能真正set-mark-command在代码中使用,因为它会检查this-command,last-command因此它不会按预期工作。
然而,在检查其代码时,我想出了(未经测试!):
(defun pop-local-or-global-mark ()
"Pop to local mark if it exists or to the global mark if it does not."
(interactive)
(if (mark t)
(pop-to-mark-command)
(pop-global-mark)))
Run Code Online (Sandbox Code Playgroud)