branch: externals/ergoemacs-mode
commit ea9b60fafd19fb1917116acc9c1c5c96d25c5508
Author: Walter Landry <[email protected]>
Commit: Walter Landry <[email protected]>
Make the bash bindings work
---
ergoemacs-theme-engine.el | 39 +++++++++++++++++++++++++++------------
1 file changed, 27 insertions(+), 12 deletions(-)
diff --git a/ergoemacs-theme-engine.el b/ergoemacs-theme-engine.el
index 6933a07..3ecdd73 100644
--- a/ergoemacs-theme-engine.el
+++ b/ergoemacs-theme-engine.el
@@ -635,16 +635,16 @@ See also `find-function-recenter-line' and
`find-function-after-hook'."
(defvar ergoemacs-theme-create-bash-functions
'((backward-char)
(forward-char)
- (previous-history)
- (next-history)
- (beginning-of-line ergoemacs-beginning-of-line-or-what)
- (end-of-line ergoemacs-end-of-line-or-what)
- (backward-word subward-backward backward-sexp)
- (forward-word subword-forward forward-sexp)
- (kill-line ergoemacs-cut-line-or-region)
+ (previous-history previous-line)
+ (next-history next-line)
+ (beginning-of-line move-beginning-of-line)
+ (end-of-line move-end-of-line)
+ (backward-word)
+ (forward-word)
+ (kill-line)
(backward-kill-word)
(kill-word)
- (backward-delete-char)
+ (backward-delete-char backward-delete-char-untabify)
(delete-char)
(undo undo-tree-undo)
(kill-region ergoemacs-cut-line-or-region)
@@ -663,14 +663,29 @@ See also `find-function-recenter-line' and
`find-function-after-hook'."
# place this file in your home dir. e.g. ~/.inputrc
# restart your terminal. Then, bash's keybinding for editing
# should be like ErgoEmacs.
-# If no key works, try replace all \\e to \\M-. That's means change Esc to
Meta key.
+# If none of the keys work, try replacing all instances of \\e with \\M-.
+# That's means changing Esc to Meta key.
\nset editing-mode emacs") tmp)
(with-temp-buffer
(dolist (cmds ergoemacs-theme-create-bash-functions)
(dolist (cmd cmds)
- (when (setq tmp (where-is-internal cmd nil t))
- (setq ret (concat ret "\n\"\\" (key-description tmp) "\": "
- (symbol-name (nth 0 cmds)))))) t))
+ (dolist (key-cmd (where-is-internal cmd nil))
+ (setq key-string (key-description key-cmd))
+ ;; Only set up the Meta bindings, not the regular arrow or
+ ;; Control bindings. That would require more complicated
+ ;; logic to get right.
+ (if (string-prefix-p "M-" key-string)
+ (setq ret (concat ret "\n\"\\"
+ (replace-regexp-in-string "M-" "e"
key-string t)
+ "\": "
+ (symbol-name (nth 0 cmds))
+ )
+ )
+ )
+ )
+ )
+ t)
+ )
(with-temp-file "~/.inputrc"
(insert ret)
(insert "\n"))