关于如何让 emacs 将未绑定(bind)的 F1..F12 键发送到程序的任何提示,就像在“ansi-term”缓冲区中的常规终端一样?
最佳答案
您正在寻找的不是“解除绑定(bind)”,而是将这些键绑定(bind)到正确的转义序列。下面将 [f1]..[f5] 绑定(bind)到 vt100 转义序列,用于 term 和 ansi-term 缓冲区的那些键。我不确定 ansi 的正确序列是什么,因此相应地调整 alist。
(defun term-send-function-key ()
(interactive)
(let* ((char last-input-event)
(output (cdr (assoc char term-function-key-alist))))
(term-send-raw-string output)))
(defconst term-function-key-alist '((f1 . "\e[OP")
(f2 . "\e[OQ")
(f3 . "\e[OR")
(f4 . "\e[OS")))
(dolist (spec term-function-key-alist)
(define-key term-raw-map
(read-kbd-macro (format "<%s>" (car spec)))
'term-send-function-key))
关于emacs - 让 emacs 向 'ansi-term' 中的程序发送 F<n> 键,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2396680/