[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ergoemacs-mode b4b5241 30/87: Add back ergoemacs-style
From: |
Stefan Monnier |
Subject: |
[elpa] externals/ergoemacs-mode b4b5241 30/87: Add back ergoemacs-style shift-translation |
Date: |
Wed, 14 Apr 2021 18:47:02 -0400 (EDT) |
branch: externals/ergoemacs-mode
commit b4b5241e679cc1a7bd7b1f3703f1a7ce602cd1f6
Author: Fidler <matthew.fidler@gmail.com>
Commit: Fidler <matthew.fidler@gmail.com>
Add back ergoemacs-style shift-translation
M-> translates to M-. in colemak to allow reduction to have
shift-selection style on ergoemacs-keys
---
ergoemacs-advice.el | 6 ++++++
ergoemacs-command-loop.el | 13 ++++++++++++-
ergoemacs-translate.el | 21 ++++++++++++++++++++-
3 files changed, 38 insertions(+), 2 deletions(-)
diff --git a/ergoemacs-advice.el b/ergoemacs-advice.el
index 31ef9c0..0ba3770 100644
--- a/ergoemacs-advice.el
+++ b/ergoemacs-advice.el
@@ -360,6 +360,12 @@ TYPE is the type of translation installed."
ad-do-it
(ergoemacs-mode--undefined-advice)))
+(ergoemacs-advice handle-shift-selection ()
+ "Allow `ergoemacs-mode' to do shift selection on keys like Alt+# to Alt+3."
+ :type :before
+ (when (eq 'ergoemacs-command-loop--shift-translate (key-binding
(this-single-command-keys)))
+ (setq this-command-keys-shift-translated t)))
+
(provide 'ergoemacs-advice)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ergoemacs-advice.el ends here
diff --git a/ergoemacs-command-loop.el b/ergoemacs-command-loop.el
index 1f858e1..7cc5197 100644
--- a/ergoemacs-command-loop.el
+++ b/ergoemacs-command-loop.el
@@ -1556,7 +1556,8 @@ needed (and resotre them to the original values)."
"Call the COMMAND interactively. Also handle mouse events (if possible.)
The RECORD-FLAG and KEYS are sent to
`ergoemacs-command-loop--grow-interactive'."
(ergoemacs-command-loop--sync-point)
- (setq ergoemacs-last-command-was-ergoemacs-ignore-p nil)
+ (setq ergoemacs-last-command-was-ergoemacs-ignore-p nil
+ this-command-keys-shift-translated (or
ergoemacs-this-command-keys-shift-translated
this-command-keys-shift-translated))
(cond
((and (eventp last-command-event)
(consp last-command-event)
@@ -2319,6 +2320,16 @@ For instance in QWERTY M-> is shift translated to M-."
(setq unread-command-events (append (ergoemacs-translate--emacs-shift
shift-trans) '(ergoemacs-timeout)))
(setq ergoemacs-this-command-keys-shift-translated t)
(ergoemacs-command-loop--internal shift-trans))))
+
+(defun ergoemacs-command-loop--shift-translate ()
+ "Shift translation."
+ (interactive)
+ (let ((shift-trans (ergoemacs-translate--emacs-shift
(this-single-command-keys) 'ergoemacs-shift)))
+ (message "%s->%s" (key-description (this-single-command-keys))
+ (key-description shift-trans))
+ (setq ergoemacs-this-command-keys-shift-translated t
+ this-command-keys-shift-translated t)
+ (ergoemacs-command-loop--call-interactively (key-binding shift-trans))))
(provide 'ergoemacs-command-loop)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ergoemacs-command-loop.el ends here
diff --git a/ergoemacs-translate.el b/ergoemacs-translate.el
index 6931f8c..7d66cd8 100644
--- a/ergoemacs-translate.el
+++ b/ergoemacs-translate.el
@@ -232,6 +232,24 @@ If no changes are performed, return nil."
(setq ret new-key))
ret)))
+(defun ergoemacs-translate--ergoemacs-shift-select (key)
+ "Translate KEY to allow `ergoemacs-mode' shift translation.
+
+This will shift translate Alt+# to Alt+3."
+ (let (modifiers basic)
+ (when (and (vectorp key)
+ ;; only makes sense for single key combinations.
+ (= (length key) 1)
+ ;; Doesn't make sense if shifted...
+ (not (or (memq 'shift (setq modifiers
(ergoemacs-translate--event-modifiers (aref key 0))))
+ (memq 'ergoemacs-shift modifiers)))
+ ;; Only define if emacs doesn't handle shift selection.
+ (not (eq (event-convert-list (list 'shift (setq basic
(event-basic-type (aref key 0)))))
+ (ergoemacs-translate--event-convert-list (list
'ergoemacs-shift basic)))))
+ (setq ergoemacs-translate--define-key-if-defined-p nil
+ ergoemacs-translate--define-key-replacement-function
'ergoemacs-command-loop--shift-translate)
+ (vector (ergoemacs-translate--event-convert-list (append modifiers (list
'ergoemacs-shift basic)))))))
+
(defun ergoemacs-translate--ergoemacs-timeout (key)
"Translates KEY to allow Shift translation to default to key sequence.
@@ -270,7 +288,8 @@ If no chanegs are performed, return nil."
ergoemacs-translate--swap-menu
ergoemacs-translate--to-string
ergoemacs-translate--to-vector
- ergoemacs-translate--ergoemacs-timeout)
+ ergoemacs-translate--ergoemacs-timeout
+ ergoemacs-translate--ergoemacs-shift-select)
"Functions to apply to key.
These functions take a key as an argument and translate it in
- [elpa] externals/ergoemacs-mode 59cb758 08/87: Change to an idle timer for more stability, (continued)
- [elpa] externals/ergoemacs-mode 59cb758 08/87: Change to an idle timer for more stability, Stefan Monnier, 2021/04/14
- [elpa] externals/ergoemacs-mode 07ef724 22/87: Change ergoemacs-override-keymap key bindings., Stefan Monnier, 2021/04/14
- [elpa] externals/ergoemacs-mode a75a338 07/87: Add ergoemacs start prefix correctly, Stefan Monnier, 2021/04/14
- [elpa] externals/ergoemacs-mode f3dd332 23/87: Revert set-map-list, Stefan Monnier, 2021/04/14
- [elpa] externals/ergoemacs-mode 98703c4 27/87: Add Swiper keys. Issue #445, Stefan Monnier, 2021/04/14
- [elpa] externals/ergoemacs-mode 01197b3 13/87: Add undefined handling, Stefan Monnier, 2021/04/14
- [elpa] externals/ergoemacs-mode 4a8de51 19/87: The image is created for the current theme., Stefan Monnier, 2021/04/14
- [elpa] externals/ergoemacs-mode 176af55 10/87: Take out message, Stefan Monnier, 2021/04/14
- [elpa] externals/ergoemacs-mode 6051ab5 25/87: Remove unicode fonts setup. Refix Issue #408, Stefan Monnier, 2021/04/14
- [elpa] externals/ergoemacs-mode 87fe85a 36/87: No longer try to ensure undo-tree and persistent-soft are installed, Stefan Monnier, 2021/04/14
- [elpa] externals/ergoemacs-mode b4b5241 30/87: Add back ergoemacs-style shift-translation,
Stefan Monnier <=
- [elpa] externals/ergoemacs-mode 1421a65 06/87: Change how key prefixes are handled., Stefan Monnier, 2021/04/14
- [elpa] externals/ergoemacs-mode 59235bb 12/87: Allow ergoemacs-mode to handle ending <apps> keys, Stefan Monnier, 2021/04/14
- [elpa] externals/ergoemacs-mode 27c6245 05/87: Remove helm-do-grep. Its no longer found in helm, Stefan Monnier, 2021/04/14
- [elpa] externals/ergoemacs-mode b70d9fe 43/87: Fix back quote., Stefan Monnier, 2021/04/14
- [elpa] externals/ergoemacs-mode d5d2ba4 39/87: Create extras directory. See Issue #452, Stefan Monnier, 2021/04/14
- [elpa] externals/ergoemacs-mode f5aa0f7 63/87: Merge pull request #496 from wlandry/command_loop, Stefan Monnier, 2021/04/14
- [elpa] externals/ergoemacs-mode 10007d2 64/87: Preserve the behavior of 'space' when rebinding inside a minibuffer, Stefan Monnier, 2021/04/14
- [elpa] externals/ergoemacs-mode ad3ec45 73/87: Fix describe-ergoemacs-theme and consolidate menu items, Stefan Monnier, 2021/04/14
- [elpa] externals/ergoemacs-mode eaf2812 79/87: Suppress more warnings, Stefan Monnier, 2021/04/14
- [elpa] externals/ergoemacs-mode 347070d 76/87: Some changes, Stefan Monnier, 2021/04/14