From 9858e1e563711a4bddceb5d87da9cf4217f240a9 Mon Sep 17 00:00:00 2001 From: Clemens Radermacher Date: Fri, 20 Dec 2019 19:56:18 +0100 Subject: [PATCH] Update `eaf-bind-key` to allow binding regular emacs commands --- eaf.el | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/eaf.el b/eaf.el index 6c84d0f..6967f17 100644 --- a/eaf.el +++ b/eaf.el @@ -681,15 +681,22 @@ Use it as (eaf-setq var val)" (defmacro eaf-bind-key (command key eaf-app-keybinding) "This function binds COMMAND to KEY in EAF-APP-KEYBINDING list. -COMMAND is a command with `eaf-proxy-' prefix found by calling -`eaf-describe-bindings' in an EAF buffer, but dropping the prefix. +Use this to bind keys for EAF applications. -KEY is a string representing a sequence of keystrokes and events. +COMMAND is a symbol of a regular Emacs command or a python app +command. You can see a list of available commands by calling +`eaf-describe-bindings' in an EAF buffer. The `eaf-proxy-' prefix +should be dropped for the COMMAND symbol. -EAF-APP-KEYBINDING is one of the eaf-.*-keybinding variables. +KEY is a string representing a sequence of keystrokes and events. -This is used to bind key to EAF Python applications." - `(map-put ,eaf-app-keybinding ,key ,(symbol-name command))) +EAF-APP-KEYBINDING is one of the `eaf--keybinding' +variables, where can be obtained by checking the value +of `eaf--buffer-app-name' inside the EAF buffer." + `(map-put ,eaf-app-keybinding ,key + ,(if (string-match "_" (symbol-name command)) + (symbol-name command) + `(quote ,command)))) (defun eaf-focus-buffer (msg) (let* ((coordinate-list (split-string msg ","))