[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ergoemacs-mode 9b72665 304/325: Use passthrough for kil
From: |
Stefan Monnier |
Subject: |
[elpa] externals/ergoemacs-mode 9b72665 304/325: Use passthrough for kill-line |
Date: |
Sat, 23 Oct 2021 18:49:16 -0400 (EDT) |
branch: externals/ergoemacs-mode
commit 9b726651669fcee392628e6a80bd87093530bdfb
Author: Matthew Fidler <514778+mattfidler@users.noreply.github.com>
Commit: Matthew Fidler <514778+mattfidler@users.noreply.github.com>
Use passthrough for kill-line
---
ergoemacs-advice.el | 2 +-
ergoemacs-cua.el | 41 ++++++++++++++++++++++++++---------------
ergoemacs-functions.el | 25 +++++++++++++++++++++++++
ergoemacs-mode.el | 4 +++-
ergoemacs-themes.el | 2 +-
5 files changed, 56 insertions(+), 18 deletions(-)
diff --git a/ergoemacs-advice.el b/ergoemacs-advice.el
index 38af9d6..39da47e 100644
--- a/ergoemacs-advice.el
+++ b/ergoemacs-advice.el
@@ -96,7 +96,7 @@ TYPE is the type of translation installed."
(defun ergoemacs-advice-undefined (orig-fun)
"Allow `ergoemacs-mode' to display keys, and intercept ending <apps> keys."
- (if ergoemacs-mode
+ (if (and ergoemacs-mode (not ergoemacs--temporary-disable))
(ergoemacs-mode--undefined-advice)
(call-interactively orig-fun)))
diff --git a/ergoemacs-cua.el b/ergoemacs-cua.el
index 7a276ba..6584e63 100644
--- a/ergoemacs-cua.el
+++ b/ergoemacs-cua.el
@@ -113,21 +113,36 @@ This is also used to select the region keymaps.")
This override is enabled for active regions before the copy and paste are
enabled.")
-
-
(defvar ergoemacs-inhibit-cua-keys nil
"Buffer-local variable that may disable the CUA keymappings.")
(make-variable-buffer-local 'ergoemacs-inhibit-cua-keys)
(defvar ergeoemacs-mode-term-raw-mode)
+(defvar ergoemacs-mode)
+(defvar ergoemacs--temporary-disable)
(defun ergoemacs--select-keymaps ()
"Setup conditions for selecting the proper keymaps in
`ergoemacs--keymap-alist'."
- ;; The prefix override (when mark-active) operates in three substates:
- ;; [1] Before using a prefix key
- ;; [2] Immediately after using a prefix key
- ;; [3] A fraction of a second later
- (setq ergoemacs--ena-region-keymap ; Determines if the ergion is active
+ (when ergoemacs--temporary-disable
+ ;; The temporary disable commands set `ergoemacs--temporary-disable' to t
+ ;; The first time when the keys are put on the `unread-command-events',
`ergoemacs-mode' is disabled
+ ;; The second command is executed, and `ergoemacs-mode' is turned back on
and `ergoemacs--temporary-disable' is to nil
+ (if ergoemacs-mode
+ (progn
+ (setq ergoemacs--ena-region-keymap nil
+ ergoemacs--ena-prefix-override-keymap nil
+ ergoemacs--ena-prefix-repeat-keymap nil
+ ergoemacs-mode nil)
+ (message "disable ergoemacs again"))
+ (setq ergoemacs--temporary-disable nil
+ ergoemacs-mode t))
+ (message "enable ergoemacs again"))
+ (when ergoemacs-mode
+ ;; The prefix override (when mark-active) operates in three substates:
+ ;; [1] Before using a prefix key
+ ;; [2] Immediately after using a prefix key
+ ;; [3] A fraction of a second later
+ (setq ergoemacs--ena-region-keymap ; Determines if the ergion is active
(and (not ergeoemacs-mode-term-raw-mode) (region-active-p) (not
deactivate-mark))
;; Enable Override -- This is the first state where the keys are
intercepted; cua state [1]
ergoemacs--ena-prefix-override-keymap
@@ -144,10 +159,7 @@ This override is enabled for active regions before the
copy and paste are enable
(and ergoemacs--ena-region-keymap
(not ergeoemacs-mode-term-raw-mode)
(or (timerp ergoemacs--prefix-override-timer)
- (eq ergoemacs--prefix-override-timer 'shift))))
- ;; In ergoemacs-mode the corresponding `cua--ena-cua-keys-keymap' and
`cua--ena-global-mark-keymap' are not needed or used
- (message "r: %s po: %s pr: %s")
- )
+ (eq ergoemacs--prefix-override-timer 'shift))))))
(defun ergoemacs--prefix-override-timeout ()
"This is whap happens on the `ergoemacs-mode' timeout for C-c and C-v are
supplied."
@@ -253,10 +265,9 @@ Pass prefix ARG to the respective copy functions."
(defun ergoemacs--cua-post-command-handler ()
"Post command hook for `ergoemacs-mode' based cua keys."
- (when ergoemacs-mode
- (condition-case nil
- (ergoemacs--cua-post-command-handler-1)
- (error nil))))
+ (condition-case nil
+ (ergoemacs--cua-post-command-handler-1)
+ (error nil)))
(add-hook 'post-command-hook #'ergoemacs--cua-post-command-handler)
(add-hook 'pre-command-hook #'ergoemacs--cua-pre-command-handler)
diff --git a/ergoemacs-functions.el b/ergoemacs-functions.el
index e1773f3..14f6ffa 100644
--- a/ergoemacs-functions.el
+++ b/ergoemacs-functions.el
@@ -95,12 +95,37 @@
(declare-function w32-long-file-name "compat")
(declare-function term-paste "term")
(declare-function calc-yank "calc-yank")
+(defvar ergoemacs-temporary-disable)
(defcustom ergoemacs-isearch-backward-char-to-edit nil
"Backward char will edit isearch."
:type 'boolean
:group 'ergoemacs-mode)
+(defun ergoemacs--send-emacs-key (key)
+ "This replays the events from the intial key press.
+
+REPEAT is the flag that tells it if is repeated environmennt."
+ ;; Don't record this command
+ (setq ergoemacs--temporary-disable t
+ this-command last-command)
+ ;; Restore the prefix arg
+ (prefix-command-preserve-state)
+ ;; Push the key back on the event queue
+ (setq unread-command-events (list (cons 'no-record key))))
+
+(defun ergoemacs-kill-line (&optional arg)
+ "Kill the rest of the (visual) line.
+
+This is often `kill-visual-line' or `kill-line'.
+
+The ARG was is used in the above functions, and is called by
+temporarily turning off `ergoemacs-mode' and then sending the
+emacs defualt kill line control k key to the `unread-command-events'"
+ (interactive "P")
+ (ergoemacs--send-emacs-key ?\C-k))
+
+
(defvar ergoemacs-delete-functions
'(delete-backward-char delete-char kill-word backward-kill-word)
diff --git a/ergoemacs-mode.el b/ergoemacs-mode.el
index f407da6..7b0c219 100644
--- a/ergoemacs-mode.el
+++ b/ergoemacs-mode.el
@@ -118,7 +118,6 @@ Added beginning-of-buffer Alt+n (QWERTY notation) and
end-of-buffer Alt+Shift+n"
:initialize #'custom-initialize-default
:group 'ergoemacs-mode)
-
(defcustom ergoemacs-mode-line t
"Determines when the ergoemacs-mode modeline indicator is shown."
:type '(choice
@@ -155,6 +154,9 @@ The TEXT will be what the mode-line is set to be."
(font-lock-add-keywords 'emacs-lisp-mode ergoemacs-font-lock-keywords)
+(defvar ergoemacs--temporary-disable nil
+ "Variable for temporarily disabling `ergoemacs-mode'")
+
(defvar ergoemacs-mode-startup-hook nil
diff --git a/ergoemacs-themes.el b/ergoemacs-themes.el
index 04231fc..52431e4 100644
--- a/ergoemacs-themes.el
+++ b/ergoemacs-themes.el
@@ -544,7 +544,7 @@ These keys do not depend on the layout."
(defun ergoemacs-set-kill-line (keymap)
"Kill Line for KEYMAP."
- (ergoemacs-define-key keymap (kbd "M-g") 'kill-line)
+ (ergoemacs-define-key keymap (kbd "M-g") 'ergoemacs-kill-line)
(ergoemacs-define-key keymap (kbd "M-G") 'ergoemacs-kill-line-backward))
(defun ergoemacs-set-text-transform (keymap)
- [elpa] externals/ergoemacs-mode d7b86f6 279/325: Add urgoemacs-redo that requires undo-fu or emacs 28, (continued)
- [elpa] externals/ergoemacs-mode d7b86f6 279/325: Add urgoemacs-redo that requires undo-fu or emacs 28, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode 2fcad48 282/325: Allow toggling of ergoemacs-mode-term-raw-mode, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode 59c8ab0 285/325: Remove ergoemacs substitute command keys, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode 1ef93b5 277/325: Add major modes menu again, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode 821a910 287/325: Fix undo-fu, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode d2d29aa 289/325: Another fix for mark-active indent region, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode 97623ad 286/325: Remove cua-mode again, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode 87fe6ff 292/325: Remove shift C-c and C-x for now, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode 2ae2ebf 294/325: Remove command loop, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode 5689999 299/325: Fix CUA interference, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode 9b72665 304/325: Use passthrough for kill-line,
Stefan Monnier <=
- [elpa] externals/ergoemacs-mode 577997b 310/325: Pull in many more remaps for using Emacs keys, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode 0d2d1c6 308/325: Change how sending emacs keys works, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode dc2e1a6 321/325: Bind ergoemacs-M-O for more generic fix, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode ea5a7f5 322/325: Remove compilation mode map (emulation overrides); Fix isearch M-O, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode 5692fc1 325/325: Add replacement for `C-h k`, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode e718715 309/325: Add `mark-whole-buffer`, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode 465d265 312/325: Merge branch 'passthrough', Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode 500a2eb 314/325: Possibly Fix #505 search, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode 8ea6d54 320/325: Some fixes for shift-select mode, Stefan Monnier, 2021/10/23
- [elpa] externals/ergoemacs-mode 6b1b60e 039/325: Cleanup, Stefan Monnier, 2021/10/23