求助:怎么把 deletechar 转换成 interger

为了给输入法增加minor mode map https://gist.github.com/QiangF/06c1a941449d9a705c14aa0db24ab2ae 卡在这里了

(let (result (keyseq (read-key-sequence nil nil nil t))) 
(let ((key (aref keyseq (1- (length keyseq)))))
    (if (aref printable-chars key)
        (setq result key)
        (and keyseq (push key unread-command-events)))))

按Delete键会报错,怎么解决啊

你想把deletechar转换为哪个integer?和backspace一样的那个?,手动判定一下就完事了。

(let ((keyseq (read-key-sequence nil nil nil t)))
  (let ((key (aref keyseq (1- (length keyseq)))))
    (cond
      ((aref printable-chars key)
       key)
      ((eq key 'deletechar)
       ?\C-?                            ;Same char as backspace(DEL)
       )
      (t
       (and keyseq (push key unread-command-events))))))

原来delete和deletechar不是一个东西.