branch: externals/ergoemacs-mode
commit 30ed2020e3f770e237aaa2562b210517c8d3a38b
Author: Walter Landry <[email protected]>
Commit: Walter Landry <[email protected]>
Remove cttl-x-c 'both' option
It uses a timer to choose which one
---
ergoemacs-command-loop.el | 28 ++++++++++++----------------
ergoemacs-functions.el | 12 ++----------
ergoemacs-lib.el | 4 ++--
ergoemacs-test.el | 10 ++++------
ergoemacs-theme-engine.el | 11 +----------
5 files changed, 21 insertions(+), 44 deletions(-)
diff --git a/ergoemacs-command-loop.el b/ergoemacs-command-loop.el
index 8628dbb..cf2358a 100644
--- a/ergoemacs-command-loop.el
+++ b/ergoemacs-command-loop.el
@@ -189,7 +189,6 @@ ignore the post-command hooks.")
(defvar ergoemacs-command-loop-type)
(defvar ergoemacs-keymap)
(defvar ergoemacs-handle-ctl-c-or-ctl-x)
-(defvar ergoemacs-ctl-c-or-ctl-x-delay)
(defun ergoemacs-command-loop--modal-show ()
@@ -663,11 +662,11 @@ inconjunction with `input-method-function' to translate
keys if
(ergoemacs-keymapp test-ret))
;; The translation needs more keys...
(if timeout-key
- (setq next-key (with-timeout (ergoemacs-ctl-c-or-ctl-x-delay
- (progn
- (setq
ergoemacs-command-loop--decode-event-timeout-p t)
- nil))
- (ergoemacs-command-loop--history nil
ergoemacs-command-loop--decode-event-delay current-key)))
+ (setq next-key (ergoemacs-command-loop--history
+ nil
+ ergoemacs-command-loop--decode-event-delay
+ current-key)
+ )
(setq next-key (ergoemacs-command-loop--history nil
ergoemacs-command-loop--decode-event-delay current-key)))
(when next-key ;; Since a key was read, save it to be read later.
(push last-command-event new-ergoemacs-input))
@@ -822,14 +821,13 @@ KEYS is the keys information"
(push 'ergoemacs-timeout unread-command-events))
((not (region-active-p))) ;; active
((and (or ergoemacs-this-command-keys-shift-translated
this-command-keys-shift-translated)
- (eq ergoemacs-handle-ctl-c-or-ctl-x 'both)))
- ((and (not ergoemacs-ctl-c-or-ctl-x-delay) ;; Immediate
- (eq ergoemacs-handle-ctl-c-or-ctl-x 'both))
+ (eq ergoemacs-handle-ctl-c-or-ctl-x 'only-copy-cut)))
+ ((eq ergoemacs-handle-ctl-c-or-ctl-x 'only-copy-cut)
(push 'ergoemacs-timeout unread-command-events))
(t
(setq ergoemacs-command--timeout-keys keys
ergoemacs-command--timeout-timer
- (run-at-time t ergoemacs-ctl-c-or-ctl-x-delay
#'ergoemacs-command--timer-timeout)))))
+ (ergoemacs-command--timer-timeout)))))
(unless unread-command-events
(ergoemacs-command-loop--message
"%s" (ergoemacs-command-loop--key-msg
@@ -2194,19 +2192,17 @@ pressed the translated key by changing
((not (region-active-p))) ;; its a key sequence.
((and (or ergoemacs-this-command-keys-shift-translated
this-command-keys-shift-translated)
- (eq ergoemacs-handle-ctl-c-or-ctl-x 'both)))
+ (eq ergoemacs-handle-ctl-c-or-ctl-x 'only-copy-cut)))
;; Immediate
- ((and (not ergoemacs-ctl-c-or-ctl-x-delay)
- (eq ergoemacs-handle-ctl-c-or-ctl-x 'both))
+ ((eq ergoemacs-handle-ctl-c-or-ctl-x 'only-copy-cut)
(setq ret tmp))
(t ;; with delay
(if ergoemacs-command-loop--decode-event-timeout-p
(setq tmp2 nil
ergoemacs-command-loop--decode-event-timeout-p
nil))
- (setq tmp2 (with-timeout (ergoemacs-ctl-c-or-ctl-x-delay
nil)
- (ergoemacs-command-loop--read-event nil key)))
+ (setq tmp2 (ergoemacs-command-loop--read-event nil key))
(if (not tmp2)
(setq ret tmp) ;; timeout, use copy/cut
;; Actual key
@@ -2219,7 +2215,7 @@ pressed the translated key by changing
;; Shift+Control+c
(when (and (ergoemacs-keymapp ret)
(setq tmp (lookup-key ret [ergoemacs-timeout]))
- (eq ergoemacs-handle-ctl-c-or-ctl-x 'both))
+ (eq ergoemacs-handle-ctl-c-or-ctl-x 'only-copy-cut))
(setq ret tmp))
(ergoemacs-command-loop--message-binding new-key ret key))
(t
diff --git a/ergoemacs-functions.el b/ergoemacs-functions.el
index 74b23f1..cad8069 100644
--- a/ergoemacs-functions.el
+++ b/ergoemacs-functions.el
@@ -102,19 +102,11 @@
'(delete-backward-char delete-char kill-word backward-kill-word)
"Defines deletion functions that ergoemacs is aware of.")
-(defcustom ergoemacs-ctl-c-or-ctl-x-delay 0.2
- "Delay before sending Cut or Copy.
-This is applied when using Ctrl+c and Ctrl+x."
- :type '(choice (number :tag "Inhibit delay")
- (const :tag "No delay" nil))
- :group 'ergoemacs-mode)
-
-(defcustom ergoemacs-handle-ctl-c-or-ctl-x 'both
+(defcustom ergoemacs-handle-ctl-c-or-ctl-x 'only-C-c-and-C-x
"Type of Copy and Paste handling for `ergoemacs-mode'."
:type '(choice
(const :tag "C-c/C-x only copy/cut" only-copy-cut)
- (const :tag "C-c/C-x only Emacs C-c and C-x" only-C-c-and-C-x)
- (const :tag "C-c/C-x copy/paste when region active, Emacs C-c/C-x
otherwise." both))
+ (const :tag "C-c/C-x only Emacs C-c and C-x" only-C-c-and-C-x))
:group 'ergoemacs-mode)
(defvar ergoemacs-revert-buffer 0)
diff --git a/ergoemacs-lib.el b/ergoemacs-lib.el
index 8cd92a6..845533d 100644
--- a/ergoemacs-lib.el
+++ b/ergoemacs-lib.el
@@ -435,9 +435,9 @@ All other modes are assumed to be minor modes or
unimportant.
"Figures out ergoemacs-mode menu's preferred key-binding for CMD."
(cond
((not cmd))
- ((and (memq ergoemacs-handle-ctl-c-or-ctl-x '(only-copy-cut both))
+ ((and (eq ergoemacs-handle-ctl-c-or-ctl-x 'only-copy-cut)
(eq cmd 'ergoemacs-cut-line-or-region))
(ergoemacs-key-description--menu (kbd "C-x")) )
- ((and (memq ergoemacs-handle-ctl-c-or-ctl-x '(only-copy-cut both))
+ ((and (eq ergoemacs-handle-ctl-c-or-ctl-x 'only-copy-cut)
(eq cmd 'ergoemacs-copy-line-or-region))
(ergoemacs-key-description--menu (kbd "C-c")))
(t
;;; FIXME: faster startup by creating component alists
diff --git a/ergoemacs-test.el b/ergoemacs-test.el
index 168694d..dfdffef 100644
--- a/ergoemacs-test.el
+++ b/ergoemacs-test.el
@@ -379,7 +379,7 @@ Tests issue #347"
"Issue #184; Not replace the \"selected all\" by paste."
:tags '(:copy :interactive)
(let ((ret t)
- (ergoemacs-handle-ctl-c-or-ctl-x 'both))
+ (ergoemacs-handle-ctl-c-or-ctl-x 'only-copy-cut))
(ergoemacs-test-layout
:macro "C-v"
(save-excursion
@@ -406,7 +406,7 @@ Tests issue #347"
Selected mark would not be cleared after paste."
:tags '(:copy)
(ergoemacs-test-layout
- (let ((ergoemacs-handle-ctl-c-or-ctl-x 'both))
+ (let ((ergoemacs-handle-ctl-c-or-ctl-x 'only-copy-cut))
(save-excursion
(switch-to-buffer (get-buffer-create "*ergoemacs-test*"))
(delete-region (point-min) (point-max))
@@ -449,8 +449,7 @@ not using cua or cutting line. I think kill-region is what
is meant."
:tags '(:copy :interactive)
(ergoemacs-test-layout
(let ((ret t)
- (ergoemacs-ctl-c-or-ctl-x-delay 0.1)
- (ergoemacs-handle-ctl-c-or-ctl-x 'both))
+ (ergoemacs-handle-ctl-c-or-ctl-x 'only-copy-cut))
(save-excursion
(switch-to-buffer (get-buffer-create "*ergoemacs-test*"))
(delete-region (point-min) (point-max))
@@ -467,8 +466,7 @@ not using cua or cutting line. I think kill-region is what
is meant."
"Attempts to test Issue #130 -- Copy"
:tags '(:copy :interactive)
(ergoemacs-test-layout
- (let ((ergoemacs-ctl-c-or-ctl-x-delay 0.1)
- (ergoemacs-handle-ctl-c-or-ctl-x 'both)
+ (let ((ergoemacs-handle-ctl-c-or-ctl-x 'only-copy-cut)
(txt "Text\n123"))
(with-temp-buffer
(switch-to-buffer (get-buffer-create "*ergoemacs-test*"))
diff --git a/ergoemacs-theme-engine.el b/ergoemacs-theme-engine.el
index 60ef0d8..48b24c1 100644
--- a/ergoemacs-theme-engine.el
+++ b/ergoemacs-theme-engine.el
@@ -377,16 +377,7 @@ When AT-END is non-nil, append a $ to the regular
expression."
(interactive)
(ergoemacs-save 'ergoemacs-handle-ctl-c-or-ctl-x 'only-copy-cut))
:button (:radio . (eq ergoemacs-handle-ctl-c-or-ctl-x 'only-copy-cut)))
- (c-c-c-x-both
- menu-item "Ctrl+C and Ctrl+X are both Emacs Commands & Copy/Cut"
- (lambda()
- (interactive)
- (ergoemacs-save 'ergoemacs-handle-ctl-c-or-ctl-x 'both))
- :button (:radio . (eq ergoemacs-handle-ctl-c-or-ctl-x 'both)))
- (c-c-c-x-timeout
- menu-item "Customize Ctrl+C and Ctrl+X Cut/Copy Timeout"
- (lambda() (interactive)
- (ergoemacs-save 'ergoemacs-ctl-c-or-ctl-x-delay)))))
+ ))
(c-v
menu-item "Paste behavior"
(keymap