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

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在Emacs术语模式下使用f键的最佳实践相关的知识,希望对你有一定的参考价值。

我一直在寻找在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))
答案

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

以上是关于在Emacs术语模式下使用f键的最佳实践的主要内容,如果未能解决你的问题,请参考以下文章

在片段和活动之间进行通信 - 最佳实践

Emacs术语模式:通过双击鼠标选择单词

Django:关于自动递增主键的最佳实践

ScalaQuery 和 Play 框架:处理未分配 (AutoInc) 主键的最佳实践

emacs 中的术语 :: 如何关闭“自动换行”

在android中使用底部导航的最佳实践:活动与片段