ess-rdired:自定义键绑定

时间:2019-06-13 15:42:02

标签: emacs key-bindings ess

我想自定义按键绑定,以便“ n”和“ p”通过编辑.emacs自动运行'ess-rdired-next-line和'ess-rdired-previous-line

直到我从具有ESS进程的缓冲区中调用ess-rdired之前,它无法识别变量ess-rdired-mode-map。我尝试将(ess-rdired)放在我的.emacs中,并得到错误

  

现在没有ESS进程与此缓冲区关联

当我按如下所示使用define-key之前从ESS缓冲区调用ess-rdired时,它们的键绑定将按预期工作。

(define-key ess-rdired-mode-map "P" 'ess-rdired-plot)
(define-key ess-rdired-mode-map "n" 'ess-rdired-next-line)
(define-key ess-rdired-mode-map "p" 'ess-rdired-previous-line)

Debugger entered--Lisp error: (void-variable ess-rdired-mode-map)

1 个答案:

答案 0 :(得分:0)

直到加载包后才定义变量,因此您可以将键定义包装在ess-rdired之后

(with-eval-after-load 'ess-rdired
  ;; (define-key ...)
  )