emacs创建键修饰符 [英] emacs create key modifier

查看:165
本文介绍了emacs创建键修饰符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Mac OS上使用emacs。
我想将一个修饰符(Meta,Control,...)映射到一个简单的键。
基本上这就是我需要的:(global-set-key(kbda)'hyper)
这里只是一个键,没有控制一个或任何,只是一个一个白痴修饰符。
我想要a成为超级例如,但我找不到解决方案。



有人有线索?

解决方案

这种方法不会使修饰符键在您按下另一个键的同时按下,但可以让您使用超级绑定



默认情况下,您可以通过 Cx @ 前缀使用其他修饰键。请参阅 Cx @ Ch 。完整列表



这些绑定位于 function-key-map ,您可以使用相同的方法来获取自己的独立于操作系统的绑定。例如:

 (define-key function-key-map(kbdCc H event-apply-hyper-modifier)

function-key-map 是所有 local-function-key-map 实例的父级。请注意:


如果与local-function-key-map中的绑定与辅助模式下的绑定冲突,本地,或全局键盘图。即重新映射仅适用于原始密钥序列否则不具有约束力。


Ch g (elisp)翻译Keymaps RET



因此,确保您使用没有现有绑定的密钥序列。 (在理论上这是非常有限的,但是YMMV。)



编辑:为了澄清,这给你一种方法来访问任何现有的超级当您使用没有超级修饰符键的机器时,绑定,但实际上并没有创建一个新的修饰符键。如果您没有现有的绑定访问权限,这种技术比常规的前缀绑定没有任何优势。



我相信,正如彼得评论的那样,创建一个真正的修饰符关键是操作系统级的任务。 AFAIK当您自己按下修饰键时,Emacs不会收到任何输入,当您使用修饰符按下非修饰符时,Emacs会接收(修改)输入。相反,当您按住非修饰键时,Emacs将立即接收输入,无法将该输入与其他输入组合,并将其视为单个(修改)事件。



IIRC, xmodmap 将是在Unix系统中实现此功能的典型机制,因此OSX可能是这种情况。以下链接可能有助于:




I am using emacs on mac os. I would like to map a modifier (Meta, Control,...) to a simple key. Basically this is what I need : (global-set-key (kbd "a") 'hyper) Here a is just the a key, no Control-a or whatever, just "a" alone whithout modifier. I want "a" to become hyper for example but I can't find a solution for this.

Someone have a clue ?

解决方案

This approach won't make a modifier key in the sense that you press another key with the modifier held down, but it lets you use hyper bindings nevertheless.

By default you can utilise the additional modifier keys via the C-x@ prefix. See C-x@C-h for the full list.

These bindings are in function-key-map, and you can use the same method to get your own OS-independent bindings. e.g.:

(define-key function-key-map (kbd "C-c H") 'event-apply-hyper-modifier)

function-key-map is the parent for all local-function-key-map instances. Note carefully:

Entries in `local-function-key-map' are ignored if they conflict with bindings made in the minor mode, local, or global keymaps. I.e. the remapping only applies if the original key sequence would otherwise not have any binding.

C-hig (elisp) Translation Keymaps RET

So ensure that you use a key sequence with no existing bindings. (In theory that's quite limiting, but YMMV.)

Edit: To clarify, this gives you a way to access any existing 'hyper' bindings when you are using a machine without a hyper modifier key, but does not actually create a new modifier key. If you have no existing bindings to access, this technique has no advantages over a regular prefix binding.

I believe it's the case that, as Peter commented, creating a genuine modifier key is an OS-level task. AFAIK when you press a modifier key on its own, Emacs does not receive any input, and when you press a non-modifier with a modifier, Emacs receives the (modified) input. Conversely when you press/hold a non-modifier key, Emacs receives input immediately, and has no way to combine that input with some other input and treat it all as a single (modified) event.

IIRC, xmodmap would be the typical mechanism for achieving this in Unix systems, so that may well be the case for OSX. The following links may help:

这篇关于emacs创建键修饰符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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