[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)
- [elpa] 105/287: move misplaced function, (continued)
- [elpa] 105/287: move misplaced function, Matthew Fidler, 2014/07/02
- [elpa] 187/287: Change to eieio-named, Matthew Fidler, 2014/07/02
- [elpa] 98/287: Modified ergoemacs-init not to depend on anything..., Matthew Fidler, 2014/07/02
- [elpa] 137/287: Get old-style fixed & variable layouts, Matthew Fidler, 2014/07/02
- [elpa] 143/287: Make test dir the same as work dir, Matthew Fidler, 2014/07/02
- [elpa] 196/287: Clean up open last closed buffer. (Issue #237), Matthew Fidler, 2014/07/02
- [elpa] 100/287: Reduce Readme.md and add build status, Matthew Fidler, 2014/07/02
- [elpa] 94/287: Fixed shortcut keys., Matthew Fidler, 2014/07/02
- [elpa] 127/287: Update documentation again., Matthew Fidler, 2014/07/02
- [elpa] 203/287: Fix the C-e test, Matthew Fidler, 2014/07/02
- [elpa] 198/287: More flexible redo, Issue #239,
Matthew Fidler <=
- [elpa] 96/287: Fix shortcut keys again., Matthew Fidler, 2014/07/02
- [elpa] 199/287: Update ergoemacs-test-layout so it wont parse the function, Matthew Fidler, 2014/07/02
- [elpa] 135/287: Fix defcustom, Matthew Fidler, 2014/07/02
- [elpa] 104/287: Fix many compiler warnings with ergoemacs-advices.el, Matthew Fidler, 2014/07/02
- [elpa] 97/287: First attempt for Cask without Cask (I'm on windows), Matthew Fidler, 2014/07/02
- [elpa] 116/287: Take out compiler warnings from ergoemacs-shortcuts.el, Matthew Fidler, 2014/07/02
- [elpa] 89/287: Fix most keybinding issues, Matthew Fidler, 2014/07/02
- [elpa] 113/287: No more warnings for ergoemacs-modal.el; mapc->dolist, Matthew Fidler, 2014/07/02
- [elpa] 132/287: Be more careful when redefining maps., Matthew Fidler, 2014/07/02
- [elpa] 129/287: Fix compiler warnings for ergoemacs-unbind.el, Matthew Fidler, 2014/07/02