Emacs用于多个命令的键绑定 [英] Emacs key binding for multiple commands

查看:85
本文介绍了Emacs用于多个命令的键绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很喜欢emacs,而且有一个菜鸟的问题。我可以通过(global-set-key(kbdCc abc)'some-command)绑定一个特定功能的密钥,其中 -command 是一个函数。如何使用一个键绑定来调用两个函数(例如 some-command some-other-command )非常感谢!

解决方案

您可以定义自己的函数调用这两个函数,并将该键绑定到您自己的函数中。或者使用简单的lambda:

 (global-set-key(kbdCc abc)(lambda() (some-command)(some-other-command)))


I'm new to emacs, and have a rookie question. I can bind a key to a particular function by (global-set-key (kbd "C-c a b c") 'some-command), where some-command is a function. How can I invoke two functions (say some-command and some-other-command) with one key binding? Thanks a lot!

解决方案

You can define your own function which call the two functions, and bind the key to your own function. Or use a simple lambda:

(global-set-key (kbd "C-c a b c") (lambda () (interactive) (some-command) (some-other-command)))

这篇关于Emacs用于多个命令的键绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆