當前位置: 華文問答 > 數碼

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- ])