当函数依赖于read-char-exclusive
时,有没有办法用箭头键中止函数?
基本上,我正在寻找一种让Emacs认为箭头键是字符键的方法。如果出于任何原因该行为存在问题,那么一旦按下箭头键,该行为可能会恢复正常。
答案 0 :(得分:3)
我认为您需要使用read-event
代替。
字符事件作为相关整数返回,就像read-char
。
箭头键以符号形式返回(left
,right
,up
,down
)。
(let ((event (read-event)))
(cond ((characterp event)
(message "Character: %s" (char-to-string event)))
((and (symbolp event) (memq event '(left right up down)))
(message "Arrow key: %s" (symbol-name event)))
(t
(error "Unexpected event"))))