在 emacs 中,如何绑定 C-l 以清除粘液中的屏幕?

In emacs, how do I bind C-l to clear screen in slime?

有没有办法在SLIME中绑定C-l来清屏?

谢谢!

您可能想要的是 slime-repl-clear-buffer,它默认绑定到 C-c M-o。你可以用正常的方式在 Slime REPL 缓冲区上绑定函数,例如

(local-set-key [(control l)] 'slime-repl-clear-buffer)

@nosefouratyou add-hook 的问题是你需要将它添加到 'slime-repl-mode-hook 而不是 'slime-mode-hook:

(defun my-slime-keybindings ()
  "For use in `slime-mode-hook' and 'slime-repl-mode-hook."
  (local-set-key (kbd "C-l") 'slime-repl-clear-buffer))

(add-hook 'slime-mode-hook      #'my-slime-keybindings)
(add-hook 'slime-repl-mode-hook #'my-slime-keybindings)