在Emacs术语模式下使用f键的最佳实践

问题描述 投票:2回答:1

我一直在寻找在Emacs术语模式中使用f键的规范方法,因为我正在运行需要它们的控制台应用程序。

是否已有提供此功能的软件包?

我写了以下内容来映射f键,但这似乎是一个次优的解决方案:

(defvar f-key-defs
  (let ((fkeys nil))
    (dotimes (i 12)
      (push (cons (intern (concat "f" (int-to-string (1+ i))))
                  (format "\e[%d~" (+ i (if (> i 4) 12 11))))
            fkeys))
    fkeys))

(defun send-f-key ()
  "Send an f-key escape sequence to the sub-process."
  (interactive)
  (term-send-raw-string (alist-get last-input-event f-key-defs)))

(dotimes (i 12)
  (define-key term-raw-map
    (vector (intern (concat "f" (int-to-string (1+ i))))
    #'send-f-key))
emacs keyboard key-bindings
1个回答
0
投票

它对我来说并不是非常不理想(我调整了你的代码以使用dotimesterm-send-raw-string)。默认情况下提供此功能可能很有意义,因此我建议您使用M-x report-emacs-bug来请求此新功能(包括您的代码作为可能的解决方案)。

© www.soinside.com 2019 - 2024. All rights reserved.