[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 109/287: Add ergoemacs-macros for all macros.
From: |
Matthew Fidler |
Subject: |
[elpa] 109/287: Add ergoemacs-macros for all macros. |
Date: |
Wed, 02 Jul 2014 14:45:05 +0000 |
mlf176f2 pushed a commit to branch externals/ergoemacs-mode
in repository elpa.
commit 78a6c662c0f0ae797c3b1a9e1a16dff169f57233
Author: Matthew L. Fidler <address@hidden>
Date: Tue Jun 17 09:27:19 2014 -0500
Add ergoemacs-macros for all macros.
---
ergoemacs-macros.el | 124 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 124 insertions(+), 0 deletions(-)
diff --git a/ergoemacs-macros.el b/ergoemacs-macros.el
new file mode 100644
index 0000000..4ac7df7
--- /dev/null
+++ b/ergoemacs-macros.el
@@ -0,0 +1,124 @@
+;;; ergoemacs-macros.el --- Macros for ergoemacs-mode
+
+;; Copyright © 2013, 2014 Free Software Foundation, Inc.
+
+;; Maintainer: Matthew L. Fidler
+;; Keywords: convenience
+
+;; ErgoEmacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published
+;; by the Free Software Foundation, either version 3 of the License,
+;; or (at your option) any later version.
+
+;; ErgoEmacs is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with ErgoEmacs. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;;
+
+;; Todo:
+
+;;
+
+;;; Code:
+
+;; These should only be called when byte compiled
+
+(defvar ergoemacs-mode)
+(declare-function ergoemacs-emulations "ergoemacs-mode.el")
+(declare-function ergoemacs-remove-shortcuts "ergoemacs-shortcuts.el")
+(defmacro ergoemacs-with-ergoemacs (&rest body)
+ "With basic `ergoemacs-mode' mode keys.
+major-mode, minor-mode, and global keys are ignored."
+ `(let ((ergoemacs-mode t)
+ (ergoemacs-unbind-keys t)
+ (ergoemacs-shortcut-keys t)
+ ergoemacs-modal
+ ergoemacs-read-input-keys
+ (minor-mode-map-alist
+ `((ergoemacs-mode ,@ergoemacs-keymap)
+ (ergoemacs-unbind-keys ,@ergoemacs-unbind-keymap)))
+ (ergoemacs-emulation-mode-map-alist '())
+ (ergoemacs-shortcut-emulation-mode-map-alist
+ `((ergoemacs-shortcut-keys ,@ergoemacs-shortcut-keymap)))
+ (old-global-map (current-global-map))
+ (old-local-map (current-local-map))
+ (new-local-map (make-sparse-keymap))
+ (new-global-map (make-sparse-keymap)))
+ (unwind-protect
+ (progn
+ (use-global-map new-global-map)
+ (use-local-map new-local-map)
+ ,@body)
+ (use-global-map old-global-map)
+ (use-local-map old-local-map))))t
+
+(defmacro ergoemacs-with-overrides (&rest body)
+ "With the `ergoemacs-mode' mode overrides.
+The global map is ignored, but major/minor modes keymaps are included."
+ `(let (ergoemacs-mode
+ ergoemacs-unbind-keys
+ ergoemacs-shortcut-keys
+ ergoemacs-modal
+ ergoemacs-read-input-keys
+ (old-global-map (current-global-map))
+ (new-global-map (make-sparse-keymap)))
+ (unwind-protect
+ (progn
+ (use-global-map new-global-map)
+ ,@body)
+ (use-global-map old-global-map))))
+
+
+(defmacro ergoemacs-with-global (&rest body)
+ "With global keymap, not ergoemacs keymaps."
+ `(ergoemacs-without-emulation
+ (let (ergoemacs-mode ergoemacs-unbind-keys)
+ ,@body)))
+
+(defmacro ergoemacs-with-major-and-minor-modes (&rest body)
+ "Without global keymaps and ergoemacs keymaps."
+ `(let ((old-global-map (current-global-map))
+ (new-global-map (make-sparse-keymap)))
+ (unwind-protect
+ (progn
+ (use-global-map new-global-map)
+ (ergoemacs-with-global
+ ,@body))
+ (use-global-map old-global-map))))
+
+(defmacro ergoemacs-without-emulation (&rest body)
+ "Without keys defined at `emulation-mode-map-alists'.
+
+Also temporarily remove any changes ergoemacs-mode made to:
+- `overriding-terminal-local-map'
+- `overriding-local-map'
+
+Will override any ergoemacs changes to the text properties by temporarily
+installing the original keymap above the ergoemacs-mode installed keymap.
+"
+ `(let ((overriding-terminal-local-map overriding-terminal-local-map)
+ (overriding-local-map overriding-local-map)
+ lookup tmp-overlay override-text-map)
+ ;; Remove most of ergoemacs-mode's key bindings
+ (ergoemacs-emulations 'remove)
+ (unwind-protect
+ (progn
+ ;; Install override-text-map changes above anything already
+ ;; installed.
+ (setq tmp-overlay (ergoemacs-remove-shortcuts t))
+ ,@body)
+ (when tmp-overlay
+ (delete-overlay tmp-overlay))
+ (when ergoemacs-mode
+ (ergoemacs-emulations)))))
+
+(provide 'ergoemacs-macros)
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; ergoemacs-macros.el ends here
- [elpa] 139/287: Make TEST_DIR first, (continued)
- [elpa] 139/287: Make TEST_DIR first, Matthew Fidler, 2014/07/02
- [elpa] 204/287: Allow ergoemacs-key to work outside of themes again, Matthew Fidler, 2014/07/02
- [elpa] 141/287: Add back ergoemacs-fixed-key and ergoemacs-key compatability., Matthew Fidler, 2014/07/02
- [elpa] 200/287: Declare undo-tree, Matthew Fidler, 2014/07/02
- [elpa] 111/287: No compiler warnings for ergoemacs-menus.el, Matthew Fidler, 2014/07/02
- [elpa] 112/287: Fix last compiler issue for ergoemacs-menus.el, Matthew Fidler, 2014/07/02
- [elpa] 91/287: All tests pass; ido-vertical doesn't have right keys, Matthew Fidler, 2014/07/02
- [elpa] 118/287: Move macros from ergoemacs-theme-engine, Matthew Fidler, 2014/07/02
- [elpa] 124/287: Refactor ergoemacs-open-in-external-app, Matthew Fidler, 2014/07/02
- [elpa] 138/287: Make the test directory., Matthew Fidler, 2014/07/02
- [elpa] 109/287: Add ergoemacs-macros for all macros.,
Matthew Fidler <=
- [elpa] 121/287: Remove cl dependence for ergoemacs-theme-engine.el, Matthew Fidler, 2014/07/02
- [elpa] 107/287: Remove save-variable-state, Matthew Fidler, 2014/07/02
- [elpa] 197/287: Merge branch 'master' of github.com:ergoemacs/ergoemacs-mode, Matthew Fidler, 2014/07/02
- [elpa] 106/287: Fix many byte-compile warnings in ergoemacs-extras.el, Matthew Fidler, 2014/07/02
- [elpa] 95/287: Revert "Fixed shortcut keys.", Matthew Fidler, 2014/07/02
- [elpa] 90/287: Allow unset keys to work too, Matthew Fidler, 2014/07/02
- [elpa] 115/287: Take away warnings from ergoemacs-mode.el, Matthew Fidler, 2014/07/02
- [elpa] 192/287: Add ergoemacs-test-layout, Matthew Fidler, 2014/07/02
- [elpa] 114/287: condition-case->ignore-errors ergoemacs-translate.el, Matthew Fidler, 2014/07/02
- [elpa] 92/287: Fix keys, Matthew Fidler, 2014/07/02