emacs - 如何在 Emacs 中创建区分大小写的键绑定(bind)?

标签 emacs elisp key-bindings case-sensitive

根据Emacs' manual , 由于“历史原因”,修饰键不区分大小写。

我可以改变这种行为吗?

我的目标是制作 M-aM-A表示不同的东西。

谢谢!

最佳答案

根据说明书,

A Control-modified alphabetical character is always considered case-insensitive: Emacs always treats C-A as C-a, C-B as C-b, and so forth. The reason for this is historical.



所以你不能像这样定义它们:
(global-set-key (kbd "C-a") 'xxx)
(global-set-key (kbd "C-A") 'yyy)

但是 S-可用于 Shift,因此:
(global-set-key (kbd "C-a") 'xxx)
(global-set-key (kbd "C-S-a") 'yyy)  ;; C-A

没关系。和

For all other modifiers, you can make the modified alphabetical characters case-sensitive when you customize Emacs. For instance, you could make M-a and M-A run different commands.



所以你可以像这样定义键绑定(bind):
(global-set-key (kbd "M-a") 'xxx)
(global-set-key (kbd "M-A") 'yyy)

关于emacs - 如何在 Emacs 中创建区分大小写的键绑定(bind)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24177014/

相关文章:

emacs - 如何获取加载 init.el 的路径?

git blame 与 emacs 中的提交细节

emacs - 使用 emacs 查找未分配的 key

emacs - 在 Emacs 中将光标移动到 12 个月旋转日历上的日期的算法

Java KeyEvent方 block 移动

Emacs GPG 密码超时

emacs - 使用 Emacs 文件名补全优先选择某些文件扩展名

emacs - 错误的类型参数 : stringp, nil

emacs - 将多个 Emacs 键绑定(bind)分配给单个命令?

java - 使 Enter 键充当 java 中 jtextfield、jcombobox、jspinner 的 Tab 键