当前位置: 华文问答 > 数码

Emacs中的"s

2024-01-15数码

你可以用快捷键 C-h r 以阅读文档, 或者执行 Lisp 代码 (info "(emacs) Windows Keyboard") 跳转到对应的章节.

题目中写的 s-l s 代表 super 键, 它很早就存在了, 后来 MS-Windows 擅自将它改称为 Windows 键, 用作保留的快捷键.

Also, on Windows 10, all Windows key combinations are reserved by the system in such a way that they are never propagated to applications, even if the system does not currently define a hotkey on the specific combination. You can use the w32-register-hot-key function to allow a key sequence to be seen by Emacs instead of being grabbed by Windows. When registered as a hot key, the key combination is pulled out of the system's input queue before it is handled by Windows, effectively overriding the special meaning of that key sequence for Windows. The override is only effective when Emacs is active; with other applications on the foreground the keys behave normally.

意思是, 你可以在 Emacs 中进行设置, 从而 Emacs 会先于操作系统读取这些快捷键; 这不会影响快捷键在其它应用中的表现. 然而不幸的是 s-l 是一个例外 :

There is one known exception: The combination <Windows>-L that locks the workstation is handled by the system on a lower level.

我建议你把其它键 (比方说, 邻近的 s-k ) 映射到 s-l 上,

( keymap-local-set "s-k" ( keymap-local-lookup "s-l" ))

然后, 如果你只想解锁 仅一个 以 super 键打头的快捷键:

( setq w32-lwindow-modifier 'super ) ( w32-register-hot-key [ s-k ])

这样 左 Windows 键 + k 就会被 Emacs 率先检测到; 如果你希望 Emacs 接管所有的 Windows 键:

( setq w32-lwindow-modifier 'super ) ( w32-register-hot-key [ s- ])