gpt4 book ai didi

emacs - 如何使用 comint 将编译绑定(bind)到组合键

转载 作者:行者123 更新时间:2023-12-01 23:15:32 26 4
gpt4 key购买 nike

我目前将编译绑定(bind)到 C-x c。我知道我可以使用 C-u C-x c 在 comint 模式下运行编译,但我更愿意直接将它绑定(bind)到 C-x c。如果不从 compile.el 复制整个编译函数,调整它并绑定(bind)它,我无法理解如何做到这一点。有没有更好的办法?

编辑:为了澄清我草率的语言,我不希望在 comint 模式下绑定(bind) C-x c。我希望使 C-x c 运行“使用 comint 模式编译”。我目前将 C-x 绑定(bind)到“编译”。我可以通过输入 C-u C-x c 来做我想做的事,但我更愿意只输入 C-x c 来做到这一点。

最佳答案

认为这可行...

(defun c-w-c ()
(interactive)
(call-interactively 'compile t (vector 21 (this-command-keys-vector))))

(global-set-key (kbd "C-x c") 'c-w-c)

添加到向量中的 '21' 是 ctrl-u 前缀键,它似乎让编译函数误以为它是用 C-u C-x c 调用的。

编辑:

它没有用,但是这样做:

(defun c-w-c ()
(interactive)
(setq current-prefix-arg '(4))
(call-interactively 'compile))

关于emacs - 如何使用 comint 将编译绑定(bind)到组合键,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3610114/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com