[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ergoemacs-mode 6c4b457 280/325: Add emacs type of comma
From: |
Stefan Monnier |
Subject: |
[elpa] externals/ergoemacs-mode 6c4b457 280/325: Add emacs type of command loop support. |
Date: |
Sat, 23 Oct 2021 18:49:11 -0400 (EDT) |
branch: externals/ergoemacs-mode
commit 6c4b4573e527343969b3228a2481bdeadb37c17c
Author: Matthew Fidler <514778+mattfidler@users.noreply.github.com>
Commit: Matthew Fidler <514778+mattfidler@users.noreply.github.com>
Add emacs type of command loop support.
---
ergoemacs-advice.el | 2 +-
ergoemacs-command-loop.el | 39 ++++++++++++++++++++++++++++++++++++---
ergoemacs-themes.el | 15 +++------------
3 files changed, 40 insertions(+), 16 deletions(-)
diff --git a/ergoemacs-advice.el b/ergoemacs-advice.el
index feb7724..9338ce6 100644
--- a/ergoemacs-advice.el
+++ b/ergoemacs-advice.el
@@ -74,7 +74,7 @@ TYPE is the type of translation installed."
(when (setq modal-p (ergoemacs :modal-p))
(setq local-keymap (ergoemacs-translation-struct-keymap-modal modal-p)))
;; This starts the command loop when DEL or MENU is replaced in the proper
place.
- (if (lookup-key local-keymap local-key)
+ (if (and (not (eq ergoemacs-command-loop-type :emacs)) (lookup-key
local-keymap local-key))
(let ((i 1)) ;; Setup history
(setq ergoemacs-command-loop--history nil)
(while (<= i (- (length keys) 1))
diff --git a/ergoemacs-command-loop.el b/ergoemacs-command-loop.el
index 3f1540b..290e09a 100644
--- a/ergoemacs-command-loop.el
+++ b/ergoemacs-command-loop.el
@@ -217,7 +217,8 @@ ignore the post-command hooks.")
:type '(choice
(const :tag "Replace emacs command loop (full)" :full)
;; (const :tag "Test mode; Don't actually run command " :test)
- (const :tag "No command loop support" nil))
+ (const :tag "Command Loop when called directly" nil)
+ (const :tag "Emacs" :emacs))
:group 'ergoemacs-comamnd-loop)
(defcustom ergoemacs-command-loop-hide-shift-translations t
@@ -252,7 +253,6 @@ ignore the post-command hooks.")
(defvar ergoemacs-mode)
(defvar ergoemacs-command-loop-type)
(defvar ergoemacs-keymap)
-(defvar ergoemacs-handle-ctl-c-or-ctl-x 'only-C-c-and-C-x)
(defvar ergoemacs-ctl-c-or-ctl-x-delay)
@@ -953,7 +953,6 @@ read."
modal tmp
tmp nil))
- ;; (ergoemacs-command-loop--read-key (read-kbd-macro "C-x" t)
:unchorded-ctl)
(when (functionp text)
(setq text (funcall text)))
@@ -2359,6 +2358,40 @@ For instance in QWERTY M-> is shift translated to M-."
(setq ergoemacs-this-command-keys-shift-translated t
this-command-keys-shift-translated t)
(ergoemacs-command-loop--call-interactively (key-binding shift-trans))))
+
+
+(defun ergoemacs-command-loop-C-c-unchorded ()
+ "Unchorded C-c."
+ (interactive)
+ (when (eq ergoemacs-command-loop-type :emacs)
+ (error "Unchorded C-c requires ergoemacs command loop"))
+ (let ((i 1)
+ (keys (this-single-command-keys)))
+ (setq ergoemacs-command-loop--history nil)
+ (while (<= i (- (length keys) 1))
+ (push (list (substring keys 0 i) :normal nil
+ current-prefix-arg (aref (substring keys (- i 1)
i) 0))
+ ergoemacs-command-loop--history)
+ (setq i (+ 1 i)))
+ (ergoemacs-command-loop "C-c" :unchorded-ctl nil nil
ergoemacs-command-loop--history)))
+
+
+(defun ergoemacs-command-loop-C-x-ctl-to-alt ()
+ "Unchorded C-x."
+ (interactive)
+ (when (eq ergoemacs-command-loop-type :emacs)
+ (error "Unchorded C-x requires ergoemacs command loop"))
+ (let ((i 1)
+ (keys (this-single-command-keys)))
+ (setq ergoemacs-command-loop--history nil)
+ (while (<= i (- (length keys) 1))
+ (push (list (substring keys 0 i) :normal nil
+ current-prefix-arg (aref (substring keys (- i 1)
i) 0))
+ ergoemacs-command-loop--history)
+ (setq i (+ 1 i)))
+ (ergoemacs-command-loop "C-x" :ctl-to-alt nil nil
ergoemacs-command-loop--history)))
+
+
(provide 'ergoemacs-command-loop)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ergoemacs-command-loop.el ends here
diff --git a/ergoemacs-themes.el b/ergoemacs-themes.el
index a35a946..8ac744d 100644
--- a/ergoemacs-themes.el
+++ b/ergoemacs-themes.el
@@ -618,17 +618,8 @@ These keys do not depend on the layout."
(ergoemacs-define-key keymap (kbd "<apps> SPC") 'set-mark-command)
(ergoemacs-define-key keymap (kbd "<apps> a") 'mark-whole-buffer)
- (ergoemacs-define-key ergoemacs-override-keymap
- (kbd "<apps> f")
- (lambda ()
- (interactive)
- (ergoemacs-command-loop "C-x" :ctl-to-alt)))
-
- (ergoemacs-define-key ergoemacs-override-keymap
- (kbd "<apps> d")
- (lambda ()
- (interactive)
- (ergoemacs-command-loop "C-c" :unchorded-ctl)))
+ (ergoemacs-define-key ergoemacs-override-keymap (kbd "<apps> f")
'ergoemacs-command-loop-C-x-ctl-to-alt)
+ (ergoemacs-define-key ergoemacs-override-keymap (kbd "<apps> d")
'ergoemacs-command-loop-C-c-unchorded)
(ergoemacs-define-key ergoemacs-override-keymap (kbd "<menu> n")
'org-agenda (kbd "a"))
(ergoemacs-define-key ergoemacs-override-keymap (kbd "<menu> n")
'org-capture (kbd "A"))
@@ -646,7 +637,7 @@ These keys do not depend on the layout."
(ergoemacs-define-key ergoemacs-override-keymap (kbd "<menu> n")
'org-capture (kbd "t"))
(ergoemacs-define-key ergoemacs-override-keymap (kbd "<menu> n")
'org-agenda (kbd "C-t"))
(ergoemacs-define-key ergoemacs-override-keymap (kbd "<menu> n")
'org-agenda (kbd "T"))
-
+
(define-key ergoemacs-translate--parent-map [f2]
'ergoemacs-command-loop--force-universal-argument)
(define-key ergoemacs-translate--parent-map (kbd "DEL")
'ergoemacs-command-loop--force-undo-last)
(define-key ergoemacs-translate--parent-map (if (eq system-type
'windows-nt) [apps] [menu])
- [elpa] externals/ergoemacs-mode a9cea74 303/325: Make ergoemacs-describe-current-theme and "C-h '" work., (continued)
- [elpa] externals/ergoemacs-mode a9cea74 303/325: Make ergoemacs-describe-current-theme and "C-h '" work., Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode e778e82 307/325: Take out debug echo AND fix backward delete, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode 187b07d 315/325: Describe keys for the current buffer, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode de3c5e7 262/325: Restore isearch-mode-map, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode 42833ac 264/325: Code cleanup, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode ac33443 265/325: Add back the M-n commands for the reduction keymap, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode 29ebf6e 271/325: Add compilation mode map to catch some of greps keys, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode 81466b3 284/325: Unwind protect the timer #505, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode a38e4f3 275/325: Add option for keeping emacs keys that are not overwritten by ergoemacs, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode 48c6d90 274/325: Merge branch 'mattfidler-master', Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode 6c4b457 280/325: Add emacs type of command loop support.,
Stefan Monnier <=
- [elpa] externals/ergoemacs-mode 4a8da69 288/325: Bug fix for mark-active keymap, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode aba186d 290/325: Add back cua keys without cua mode, back to ergoemacs-timeout, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode e50cc70 293/325: Remove C-X is execute extended command, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode fa095e8 295/325: Use Kim Storms approach for cua binding, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode b67e0f9 297/325: Remove ergoemacs-minor-alist, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode d49f5cf 296/325: Add Kim's name for the CUA approach, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode 3f961db 302/325: Fix parens, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode 6f93579 301/325: Use meta for term mode types items, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode b0a5d10 305/325: Remove R history, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode f5a7c78 306/325: Update command for calculate-bindings, Stefan Monnier, 2021/10/23