emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/ergoemacs-mode c3e7830 023/325: Remove option to bind C


From: Stefan Monnier
Subject: [elpa] externals/ergoemacs-mode c3e7830 023/325: Remove option to bind C-c and C-x as copy/cut
Date: Sat, 23 Oct 2021 18:48:13 -0400 (EDT)

branch: externals/ergoemacs-mode
commit c3e7830f380cca75e2c0544a1b4752b2c927c1a0
Author: Walter Landry <wlandry@caltech.edu>
Commit: Walter Landry <wlandry@caltech.edu>

    Remove option to bind C-c and C-x as copy/cut
---
 ergoemacs-command-loop.el |  34 +--------------
 ergoemacs-functions.el    |   8 ----
 ergoemacs-lib.el          |   5 ---
 ergoemacs-test.el         | 109 ----------------------------------------------
 ergoemacs-theme-engine.el |  24 ----------
 ergoemacs-themes.el       |  32 +-------------
 6 files changed, 4 insertions(+), 208 deletions(-)

diff --git a/ergoemacs-command-loop.el b/ergoemacs-command-loop.el
index dacfbd1..523730f 100644
--- a/ergoemacs-command-loop.el
+++ b/ergoemacs-command-loop.el
@@ -188,7 +188,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)
 
 
 (defun ergoemacs-command-loop--modal-show ()
@@ -815,13 +814,7 @@ KEYS is the keys information"
       (when (ergoemacs-keymapp (setq ret (key-binding keys)))
        (when (setq timeout (key-binding (vconcat keys [ergoemacs-timeout])))
          (cond
-          ((eq ergoemacs-handle-ctl-c-or-ctl-x 'only-copy-cut) 
-           (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)))
-          ((eq ergoemacs-handle-ctl-c-or-ctl-x 'both)
-           (push 'ergoemacs-timeout unread-command-events))
            (t
             (setq ergoemacs-command--timeout-keys keys
                  ergoemacs-command--timeout-timer 
ergoemacs-command--timer-timeout
@@ -2180,32 +2173,11 @@ pressed the translated key by changing
               (cond
                ((equal orig-key (nth 0 trials))
                 (setq ergoemacs-command-loop--single-command-keys new-key)
-               ;; (message "History %s" (length 
ergoemacs-command-loop--history))
-                (when (and (not (eq ergoemacs-handle-ctl-c-or-ctl-x 
'only-C-c-and-C-x))
-                          (ergoemacs-keymapp ret)
-                           (setq tmp (lookup-key ret [ergoemacs-timeout])))
-                  (cond
-                   ((eq ergoemacs-handle-ctl-c-or-ctl-x 'only-copy-cut)
-                    (setq ret tmp))
-                  ((< 1  (length ergoemacs-command-loop--history)))
-                   ((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)))
-                   ;; Immediate
-                   (setq ret tmp)
-                   )
-                  )
                 (ergoemacs-command-loop--message-binding new-key ret))
                ((equal orig-key (nth 1 trials)) ;; `ergoemacs-mode' shift 
translation
                 (setq this-command-keys-shift-translated t
                       ergoemacs-command-loop--single-command-keys (nth 0 
trials))
                 
-                ;; Shift+Control+c
-                (when (and (ergoemacs-keymapp ret)
-                           (setq tmp (lookup-key ret [ergoemacs-timeout]))
-                           (eq ergoemacs-handle-ctl-c-or-ctl-x 'both))
-                  (setq ret tmp))
                 (ergoemacs-command-loop--message-binding new-key ret key))
                (t
                 (ergoemacs-command-loop--message-binding new-key ret key)
@@ -2305,10 +2277,8 @@ For instance in QWERTY M-> is shift translated to M-."
   "This is the shift-timeout function for a key."
   (interactive)
   (let ((shift-trans (ergoemacs-translate--emacs-shift 
(this-single-command-keys))))
-    (if (eq ergoemacs-handle-ctl-c-or-ctl-x 'only-copy-cut)
-       (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))))
+    (setq ergoemacs-this-command-keys-shift-translated t)
+    (ergoemacs-command-loop--internal shift-trans)))
 
 (defun ergoemacs-command-loop--shift-translate ()
   "Shift translation."
diff --git a/ergoemacs-functions.el b/ergoemacs-functions.el
index afede56..6aeb54e 100644
--- a/ergoemacs-functions.el
+++ b/ergoemacs-functions.el
@@ -102,14 +102,6 @@
   '(delete-backward-char delete-char kill-word backward-kill-word)
   "Defines deletion functions that ergoemacs is aware of.")
 
-(defcustom ergoemacs-handle-ctl-c-or-ctl-x 'both
-  "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))
-  :group 'ergoemacs-mode)
-
 (defvar ergoemacs-revert-buffer 0)
 (defun ergoemacs-revert-buffer ()
   "Ergoemacs replacement of `revert-buffer'.
diff --git a/ergoemacs-lib.el b/ergoemacs-lib.el
index 261578a..f35adb7 100644
--- a/ergoemacs-lib.el
+++ b/ergoemacs-lib.el
@@ -48,7 +48,6 @@
 
 (defvar package-archives)
 
-(defvar ergoemacs-handle-ctl-c-or-ctl-x)
 (defvar ergoemacs-dir)
 
 
@@ -409,10 +408,6 @@ 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))
-         (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))
-         (eq cmd 'ergoemacs-copy-line-or-region)) 
(ergoemacs-key-description--menu (kbd "C-c")))
    (t
     ;;; FIXME: faster startup by creating component alists
     ;; SLOW: 2-seconds
diff --git a/ergoemacs-test.el b/ergoemacs-test.el
index c8b4001..2eb6f5e 100644
--- a/ergoemacs-test.el
+++ b/ergoemacs-test.el
@@ -430,55 +430,6 @@ Tests issue #347"
 
 ;;; Copy/Paste
 
-
-(ert-deftest ergoemacs-test-copy-paste-issue-184 ()
-  "Issue #184; Not replace the \"selected all\" by paste."
-  :tags '(:copy :interactive)
-  (let ((ret t)
-        (ergoemacs-handle-ctl-c-or-ctl-x 'both))
-    (ergoemacs-test-layout
-     :macro "C-v"
-     (save-excursion
-       (switch-to-buffer (get-buffer-create "*ergoemacs-test*"))
-       (delete-region (point-min) (point-max))
-       (insert ergoemacs-test-lorem-ipsum)
-       (goto-char (point-min))
-       (push-mark)
-       (end-of-line)
-       (ergoemacs-copy-line-or-region)
-       (push-mark (point))
-       (push-mark (point-max) nil t)
-       (goto-char (point-min))
-       ;; Make sure the `pre-command-hook' and `post-command-hook' is
-       ;; run by calling the macro.
-       (execute-kbd-macro macro) 
-       ;; (ergoemacs-paste)
-       (should (string= "Lorem ipsum dolor sit amet, consectetur adipisicing 
elit, sed\n"
-                        (buffer-string)))
-       (kill-buffer (current-buffer))))))
-
-(ert-deftest ergoemacs-test-copy-paste-issue-184-paste-should-clear-mark ()
-  "Issue #186.
-Selected mark would not be cleared after paste."
-  :tags '(:copy)
-  (ergoemacs-test-layout
-   (let ((ergoemacs-handle-ctl-c-or-ctl-x 'both))
-     (save-excursion
-       (switch-to-buffer (get-buffer-create "*ergoemacs-test*"))
-       (delete-region (point-min) (point-max))
-       (insert ergoemacs-test-lorem-ipsum)
-       (goto-char (point-min))
-       (push-mark)
-       (end-of-line)
-       (ergoemacs-copy-line-or-region)
-       (push-mark (point))
-       (push-mark (point-max) nil t)
-       (goto-char (point-min))
-       (ergoemacs-paste)
-       (should (or deactivate-mark (not mark-active)))
-       (kill-buffer (current-buffer))))))
-
-
 (ert-deftest ergoemacs-test-copy-paste-cut-line-or-region ()
   "Issue #68.
 kill-ring function name is used and such doesn't exist. It errs when
@@ -500,47 +451,6 @@ not using cua or cutting line. I think kill-region is what 
is meant."
      (should ret))))
 
 
-(ert-deftest ergoemacs-test-copy-paste-issue-130-cut ()
-  "Attempts to test Issue #130 -- Cut"
-  :tags '(:copy :interactive)
-  (ergoemacs-test-layout
-   (let ((ret t)
-         (ergoemacs-handle-ctl-c-or-ctl-x 'both))
-     (save-excursion
-       (switch-to-buffer (get-buffer-create "*ergoemacs-test*"))
-       (delete-region (point-min) (point-max))
-       (insert ergoemacs-test-lorem-ipsum)
-       (push-mark (point))
-       (push-mark (point-max) nil t)
-       (goto-char (point-min))
-       (ergoemacs-command-loop--internal "C-x <ergoemacs-timeout>")
-       (setq ret (string= "" (buffer-string)))
-       (kill-buffer (current-buffer)))
-     (should ret))))
-
-(ert-deftest ergoemacs-test-copy-paste-issue-130-copy ()
-  "Attempts to test Issue #130 -- Copy"
-  :tags '(:copy :interactive)
-  (ergoemacs-test-layout
-   (let ((ergoemacs-handle-ctl-c-or-ctl-x 'both)
-         (txt "Text\n123"))
-     (with-temp-buffer
-       (switch-to-buffer (get-buffer-create "*ergoemacs-test*"))
-       (delete-region (point-min) (point-max))
-       (insert txt)
-       (push-mark (point))
-       (push-mark (point-max) nil t)
-       ;; (message "Region Active: %s" transient-mark-mode)
-       (setq last-command nil
-             this-command nil)
-       (goto-char (point-min))
-       (ergoemacs-command-loop--internal "C-c <ergoemacs-timeout>")
-       (goto-char (point-max))
-       (ergoemacs-paste)
-       (should (string= (concat txt txt)
-                        (buffer-string)))
-       (kill-buffer (current-buffer))))))
-
 (ert-deftest ergoemacs-test-copy-paste-apps-cut ()
   "Tests <apps> x on QWERTY cutting a region, not just a line."
   :tags '(:copy :interactive)
@@ -1761,25 +1671,6 @@ hash appropriaetly."
         ,minibuffer-call)
        nil))
 
-(ert-deftest ergoemacs-test-icy-407-minibuffer ()
-  "Test minibuffer keybindings for `icy-mode'.
-[f11] = `previous-history-element'
-[f12] = `next-history-element'
-M-s   = `ergoemacs-move-cursor-next-pane'
-M-r   = `kill-word'"
-  :tags '(:icy-mode :interactive)
-  (icy-mode 1)
-  (let ((keys))
-(ergoemacs-test-layout
- :layout "us"
- :theme "standard"
- (should (equal (ergoemacs-minibuffer-key-bindings
-                (call-interactively 'icicle-execute-extended-command)
-                [f11] [f12] (read-kbd-macro "M-o") (read-kbd-macro "M-s") 
(read-kbd-macro "M-r"))
-               '(previous-history-element next-history-element forward-word 
ergoemacs-move-cursor-next-pane kill-word)))))
-(icy-mode -1))
-
-
 (provide 'ergoemacs-test)
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; ergoemacs-test.el ends here
diff --git a/ergoemacs-theme-engine.el b/ergoemacs-theme-engine.el
index 875cfd3..be12fcd 100644
--- a/ergoemacs-theme-engine.el
+++ b/ergoemacs-theme-engine.el
@@ -362,28 +362,6 @@ When AT-END is non-nil, append a $ to the regular 
expression."
     ,(ergoemacs-theme--menu-options theme)
     ,(ergoemacs-theme--version-menu theme)
     (ergoemacs-c-x-sep "--")
-    (ergoemacs-c-x-c-c
-     menu-item "Ctrl+C and Ctrl+X behavior"
-     (keymap
-      (c-c-c-x-emacs
-       menu-item "Ctrl+C and Ctrl+X are for Emacs Commands"
-       (lambda()
-         (interactive)
-         (ergoemacs-save 'ergoemacs-handle-ctl-c-or-ctl-x 'only-C-c-and-C-x))
-       :button (:radio . (eq ergoemacs-handle-ctl-c-or-ctl-x 
'only-C-c-and-C-x)))
-      (c-c-c-x-cua
-       menu-item "Ctrl+C and Ctrl+X are only Copy/Cut"
-       (lambda()
-         (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-v
      menu-item "Paste behavior"
      (keymap
@@ -729,8 +707,6 @@ See also `find-function-recenter-line' and 
`find-function-after-hook'."
         (ergoemacs-copy-all "copy all")
         (ergoemacs-copy-all "copy all")
         (ergoemacs-copy-line-or-region "copy")
-        (ergoemacs-ctl-c "Copy/Ctl+c")
-        (ergoemacs-ctl-x "Cut/Ctl+x")
         (ergoemacs-cut-all "✂ all")
         (ergoemacs-cut-all "✂ all")
         (ergoemacs-cut-line-or-region "✂ region")
diff --git a/ergoemacs-themes.el b/ergoemacs-themes.el
index 1dd6f68..5dc5ae5 100644
--- a/ergoemacs-themes.el
+++ b/ergoemacs-themes.el
@@ -203,10 +203,6 @@
   (global-set-key (kbd "C-S-z") '(redo undo-tree-redo))
   (global-set-key (kbd "M-S-z") '(redo undo-tree-redo))
   (global-set-key (kbd "<S-delete>") 'ergoemacs-cut-line-or-region)
-  (if (not (eq ergoemacs-handle-ctl-c-or-ctl-x 'only-C-c-and-C-x))
-      (global-set-key (kbd "C-c <ergoemacs-timeout>")
-                      'ergoemacs-copy-line-or-region)
-    )
   (global-set-key (kbd "<C-insert>") 'ergoemacs-copy-line-or-region)
   (global-set-key (kbd "C-S-v") 'ergoemacs-paste-cycle)
   
@@ -291,9 +287,6 @@
 
   (global-set-key (kbd "C-x k") nil)
   (global-set-key (kbd "C-w") 'ergoemacs-close-current-buffer)
-  (if (not (eq ergoemacs-handle-ctl-c-or-ctl-x 'only-C-c-and-C-x))
-      (global-set-key (kbd "C-x <ergoemacs-timeout>") 
'ergoemacs-cut-line-or-region)
-    )
   (global-set-key (kbd "C-x C-b") 'ibuffer)
   (global-set-key (kbd "C-y") '(redo undo-tree-redo) "↷ redo")
   
@@ -335,9 +328,6 @@
   (define-key isearch-mode-map (kbd "C-M-f") 'isearch-occur)
   (define-key isearch-mode-map (kbd "<S-insert>") 'ergoemacs-paste)
   (define-key isearch-mode-map (kbd "C-S-v") 'ergoemacs-paste-cycle)
-  (if (not (eq ergoemacs-handle-ctl-c-or-ctl-x 'only-C-c-and-C-x))
-      (define-key isearch-mode-map (kbd "C-c") 'isearch-yank-word-or-char)
-    )
   (define-key isearch-mode-map (kbd "M-c") 'isearch-yank-word-or-char)
   (define-key isearch-mode-map (kbd "M-v") 'ergoemacs-paste)
   (define-key isearch-mode-map (kbd "C-v") 'ergoemacs-paste))
@@ -656,22 +646,12 @@
   (global-set-key (kbd "C-x u") nil)
   (global-set-key (kbd "M-z") '("C-_" :emacs))
   
-  ;; Fixed Component; Note that <timeout> is the actual function.
-  (if (not (eq ergoemacs-handle-ctl-c-or-ctl-x 'only-C-c-and-C-x))
-      (progn
-        (global-set-key (kbd "C-c <ergoemacs-timeout>") 
'ergoemacs-copy-line-or-region)
-        (global-set-key (kbd "C-x <ergoemacs-timeout>") 
'ergoemacs-cut-line-or-region)
-        )
-    )
   (global-set-key (kbd "C-S-x") ("C-x" :normal))
   (global-set-key (kbd "C-z") 'undo)
   (global-set-key (kbd "C-S-z") '(redo undo-tree-redo))
   (global-set-key (kbd "C-y") '(redo undo-tree-redo))
 
   ;; Mode specific changes
-  (if (not (eq ergoemacs-handle-ctl-c-or-ctl-x 'only-C-c-and-C-x))
-      (define-key isearch-mode-map (kbd "C-c") 'isearch-yank-word-or-char)
-    )
   (define-key isearch-mode-map (kbd "M-c") 'isearch-yank-word-or-char)
   (define-key isearch-mode-map (kbd "M-v") 'ergoemacs-paste)
   (define-key isearch-mode-map (kbd "M-V") 'ergoemacs-paste-cycle)
@@ -1231,12 +1211,10 @@
                           (redo-sep menu-item "--")
                           (cut menu-item "Cut" ergoemacs-cut-line-or-region
                                :help "Delete text in Line/region and copy it 
to the clipboard"
-                               :enable (or (eq ergoemacs-handle-ctl-c-or-ctl-x 
'only-copy-cut)
-                                           (region-active-p)))
+                               :enable (region-active-p))
                           (copy menu-item "Copy" ergoemacs-copy-line-or-region
                                 :help "Copy text in line/region to the 
clipboard"
-                                :enable (or (eq 
ergoemacs-handle-ctl-c-or-ctl-x 'only-copy-cut)
-                                            (region-active-p)))
+                                :enable (region-active-p))
                           (paste menu-item "Paste" ergoemacs-paste
                                  :help "Paste text from clipboard")
                           (paste-from-menu menu-item "Paste from Kill Menu" 
yank-menu
@@ -1688,12 +1666,6 @@
 
 (ergoemacs-theme lvl0 ()
   "CUA-mode style"
-  (if (not (eq ergoemacs-handle-ctl-c-or-ctl-x 'only-C-c-and-C-x))
-      (progn
-        (global-set-key (kbd "C-c <ergoemacs-timeout>") 
'ergoemacs-copy-line-or-region)
-        (global-set-key (kbd "C-x <ergoemacs-timeout>") 
'ergoemacs-cut-line-or-region)
-        )
-    )
   (global-set-key (kbd "<C-insert>") 'ergoemacs-copy-line-or-region)
   (global-set-key (kbd "C-S-v") 'ergoemacs-paste-cycle)
   



reply via email to

[Prev in Thread] Current Thread [Next in Thread]