本文介绍了使用read-char-exclusive时如何使用箭头键中止功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当函数依赖于 read-char-exclusive

本质上,我正在寻找一种方法来使Emacs认为箭头键是字符键。如果由于任何原因出现这种行为是有问题的,那么一旦功能按箭头键结束,行为就可以恢复正常。

Essentially, I'm looking for a way to make Emacs think that the arrow keys are character keys. If that behavior is problematic for any reasons, then perhaps the behavior could revert back to normal once the function ends by pressing an arrow key.

推荐答案

我想您需要使用 read-event

字符事件将作为相关整数,就像 read-char

Character events are returned as the relevant integer, just like read-char.

箭头键作为符号返回(离开 right up down

Arrow keys are returned as symbols (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"))))

这篇关于使用read-char-exclusive时如何使用箭头键中止功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-01 18:23