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

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

[elpa] 198/287: More flexible redo, Issue #239


From: Matthew Fidler
Subject: [elpa] 198/287: More flexible redo, Issue #239
Date: Wed, 02 Jul 2014 14:45:57 +0000

mlf176f2 pushed a commit to branch externals/ergoemacs-mode
in repository elpa.

commit 7f3d55a4a1f822f1c79881d5609b0c45afd864b3
Author: Matthew L. Fidler <address@hidden>
Date:   Mon Jun 23 09:06:55 2014 -0500

    More flexible redo, Issue #239
---
 ergoemacs-functions.el |   20 ++++++++++++++++++++
 ergoemacs-menus.el     |    2 +-
 ergoemacs-themes.el    |   31 +++++++++++++++++--------------
 3 files changed, 38 insertions(+), 15 deletions(-)

diff --git a/ergoemacs-functions.el b/ergoemacs-functions.el
index ea6ef26..882f193 100644
--- a/ergoemacs-functions.el
+++ b/ergoemacs-functions.el
@@ -1275,6 +1275,26 @@ by `ergoemacs-maximum-number-of-files-to-open'.
     (when (> (length ergoemacs-recently-closed-buffers) 
ergoemacs-recently-closed-buffers-max)
       (setq ergoemacs-recently-closed-buffers (butlast 
ergoemacs-recently-closed-buffers 1)))))
 
+(defun ergoemacs-redo (&optional arg)
+  "Redo using either `redo' or `undo-tree-redo'.
+Installs `undo-tree' if not present."
+  (interactive "*P")
+  (require 'undo-tree nil t)
+  (cond
+   ((fboundp 'undo-tree-redo)
+    (call-interactively 'undo-tree-redo))
+   ((fboundp 'redo)
+    (call-interactively 'redo))
+   (t
+    (if (not (yes-or-no-p "Redo command not found, install undo-tree for 
redo?"))
+        (error "Redo not found, need undo-tree or redo commands present.")
+      (package-refresh-contents) ;;available in gnu elpa.
+      (package-initialize)
+      (package-install 'undo-tree)
+      (require 'undo-tree)
+      (undo-tree-mode 1)
+      (call-interactively 'undo-tree-redo)))))
+
 (declare-function ergoemacs-get-override-function "ergoemacs-shortcuts.el")
 (declare-function minibuffer-keyboard-quit "delsel.el")
 (declare-function org-edit-src-save "org-src.el")
diff --git a/ergoemacs-menus.el b/ergoemacs-menus.el
index 445ec79..bfebcd7 100644
--- a/ergoemacs-menus.el
+++ b/ergoemacs-menus.el
@@ -258,7 +258,7 @@ All other modes are assumed to be minor modes or 
unimportant.
                      (consp buffer-undo-list)))
           :help "Undo last operation"
           :keys "Ctrl+Z")
-    (redo menu-item "Redo" redo
+    (redo menu-item "Redo" ergoemacs-redo
           :keys "Ctrl+Y")
     (redo-sep menu-item "--")
     (cut menu-item "Cut" clipboard-kill-region
diff --git a/ergoemacs-themes.el b/ergoemacs-themes.el
index b316b25..6ddd5b8 100644
--- a/ergoemacs-themes.el
+++ b/ergoemacs-themes.el
@@ -48,14 +48,15 @@
 
 (ergoemacs-theme-component standard-vars ()
   "Enabled/changed variables/modes"
-  (setq org-CUA-compatible t)
-  (setq org-support-shift-select t)
+  (setq org-CUA-compatible t
+        org-support-shift-select t
+        set-mark-command-repeat-pop t
+        org-special-ctrl-a/e t
+        ido-vertical-define-keys 'C-n-C-p-up-down-left-right
+        scroll-error-top-bottom t)
+  (undo-tree-mode 1)
   (shift-select-mode t)
   (delete-selection-mode 1)
-  (setq set-mark-command-repeat-pop t)
-  (setq org-special-ctrl-a/e t)
-  (setq ido-vertical-define-keys 'C-n-C-p-up-down-left-right)
-  (setq scroll-error-top-bottom t)
   ;; (setq cua--rectangle-modifier-key ergoemacs-cua-rect-modifier)
   ;; (setq cua--rectangle-keymap (make-sparse-keymap))
   ;; (setq cua--rectangle-initialized nil)
@@ -102,7 +103,7 @@
   (global-set-key (kbd "<M-backspace>") '(undo-tree-undo undo))
   (global-set-key (kbd "C-z") 'undo)
 
-  (global-set-key (kbd "C-S-z") '(undo-tree-redo redo))
+  (global-set-key (kbd "C-S-z") '(undo-tree-redo redo ergoemacs-redo))
   (global-set-key (kbd "<S-delete>") 'ergoemacs-cut-line-or-region)
   (global-set-key (kbd "C-c <timeout>") 'ergoemacs-copy-line-or-region)
   (global-set-key (kbd "C-c") 'ergoemacs-ctl-c)
@@ -192,7 +193,7 @@
   (global-set-key (kbd "C-x <timeout>") 'ergoemacs-cut-line-or-region)
   (global-set-key (kbd "C-x C-b") 'ibuffer)
   (global-set-key (kbd "C-x") 'ergoemacs-ctl-x "Cut")
-  (global-set-key (kbd "C-y") '(undo-tree-redo redo) "↷ redo")
+  (global-set-key (kbd "C-y") '(undo-tree-redo redo ergoemacs-redo) "↷ redo")
   
   (global-set-key (kbd "M-S-<next>") 'forward-page)
   (global-set-key (kbd "M-S-<prior>") 'backward-page)
@@ -262,12 +263,12 @@
   (global-set-key (kbd "<C-f2>") 'ergoemacs-cut-all)
   (global-set-key (kbd "<C-f3>") 'ergoemacs-copy-all)
   (global-set-key (kbd "<C-f4>") 'ergoemacs-paste-cycle)
-  (global-set-key (kbd "<C-f5>") '(undo-tree-redo redo))
+  (global-set-key (kbd "<C-f5>") '(undo-tree-redo redo ergoemacs-redo))
   (global-set-key (kbd "<C-f8>") 'highlight-symbol-prev)
   (global-set-key (kbd "<C-f9>") 'highlight-symbol-next)
   (global-set-key (kbd "<M-f2>") 'ergoemacs-cut-all)
   (global-set-key (kbd "<M-f3>") 'ergoemacs-copy-all)
-  (global-set-key (kbd "<M-f5>") '(undo-tree-redo redo))
+  (global-set-key (kbd "<M-f5>") '(undo-tree-redo redo ergoemacs-redo))
   (global-set-key (kbd "<S-f3>") 'ergoemacs-toggle-letter-case)
   (global-set-key (kbd "<f11>") 'previous-line)
   (global-set-key (kbd "<f12>") 'next-line)
@@ -510,7 +511,7 @@
   
   (global-set-key (kbd "M-C") 'ergoemacs-copy-all)
   (global-set-key (kbd "M-X") 'ergoemacs-cut-all)
-  (global-set-key (kbd "M-Z") '(undo-tree-redo redo))
+  (global-set-key (kbd "M-Z") '(undo-tree-redo redo ergoemacs-redo))
 
   ;; Undo
   (global-set-key (kbd "C-_") nil)
@@ -524,8 +525,8 @@
   (global-set-key (kbd "C-x <timeout>") 'ergoemacs-cut-line-or-region)
   (global-set-key (kbd "C-x") 'ergoemacs-ctl-x)
   (global-set-key (kbd "C-z") 'undo)
-  (global-set-key (kbd "C-S-z") '(undo-tree-redo redo))
-  (global-set-key (kbd "C-y") '(undo-tree-redo redo))
+  (global-set-key (kbd "C-S-z") '(undo-tree-redo redo ergoemacs-redo))
+  (global-set-key (kbd "C-y") '(undo-tree-redo redo ergoemacs-redo))
 
   ;; Mode specific changes
   (when isearch-mode-hook
@@ -701,7 +702,7 @@
   (global-set-key (kbd "<apps> x") 'ergoemacs-cut-line-or-region)
   (global-set-key (kbd "<apps> c") 'ergoemacs-copy-line-or-region)
   (global-set-key (kbd "<apps> v") 'ergoemacs-paste)
-  (global-set-key (kbd "<apps> b") '(undo-tree-redo redo))
+  (global-set-key (kbd "<apps> b") '(undo-tree-redo redo ergoemacs-redo))
   (global-set-key (kbd "<apps> t") 'switch-to-buffer)
   (global-set-key (kbd "<apps> z") 'undo)
   (global-set-key (kbd "<apps> r") goto-map))
@@ -876,6 +877,8 @@
 
 (ergoemacs-theme-component ergoemacs-remaps ()
   "Remaps for ergoemacs-mode"
+  (when undo-tree-mode
+    (global-set-key [remap ergoemacs-redo] 'undo-tree-redo))
   (when ergoemacs-mode
     (global-set-key [remap universal-argument]
                     'ergoemacs-universal-argument)



reply via email to

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