[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 73/117: Try to make compatible with emacs 23
From: |
Matthew Fidler |
Subject: |
[elpa] 73/117: Try to make compatible with emacs 23 |
Date: |
Fri, 25 Jul 2014 13:24:21 +0000 |
mlf176f2 pushed a commit to branch externals/ergoemacs-mode
in repository elpa.
commit 914a30cde44d345873a24de2a3d6f57b15882a70
Author: Matthew L. Fidler <address@hidden>
Date: Fri Jul 18 12:15:38 2014 -0500
Try to make compatible with emacs 23
---
ergoemacs-modal.el | 8 +++++---
ergoemacs-mode.el | 21 +++++++++++++++++++++
ergoemacs-shortcuts.el | 14 ++++++++------
3 files changed, 34 insertions(+), 9 deletions(-)
diff --git a/ergoemacs-modal.el b/ergoemacs-modal.el
index f9df88b..d72e64e 100644
--- a/ergoemacs-modal.el
+++ b/ergoemacs-modal.el
@@ -378,6 +378,7 @@ the translation type defined by `ergoemacs-modal-list' as
long as it should."
(defvar ergoemacs-modal-emulation-mode-map-alist)
(defvar ergoemacs-ignore-advice)
+(declare-function ergoemacs-flatten-composed-keymap "ergoemacs-mode.el")
(defun ergoemacs-modal-toggle (type)
"Toggle ergoemacs command modes."
(let* ((help-list (gethash type ergoemacs-translation-text))
@@ -423,9 +424,10 @@ the translation type defined by `ergoemacs-modal-list' as
long as it should."
(progn ;; Turn off current modal, turn on last modal.
(setq help-list (gethash type ergoemacs-translation-text))
(setq ergoemacs-modal-keymap
- (make-composed-keymap
- (list (ergoemacs-local-map type t)
- (ergoemacs-modal-base-keymap))))
+ (ergoemacs-flatten-composed-keymap
+ (make-composed-keymap
+ (list (ergoemacs-local-map type t)
+ (ergoemacs-modal-base-keymap)))))
(setq ergoemacs-modal-emulation-mode-map-alist
`((ergoemacs-modal ,@ergoemacs-modal-keymap)))
(set-default 'ergoemacs-modal type)
diff --git a/ergoemacs-mode.el b/ergoemacs-mode.el
index d8aaf41..a3086db 100644
--- a/ergoemacs-mode.el
+++ b/ergoemacs-mode.el
@@ -99,6 +99,27 @@ If it is not a composed KEYMAP, return the keymap as is."
(ergoemacs-flatten-composed-keymap--define-key sub-keymap new-keymap))
new-keymap)))
+(when (not (fboundp 'make-composed-keymap))
+ (defun make-composed-keymap (maps &optional parent)
+ "Construct a new keymap composed of MAPS and inheriting from PARENT.
+
+This dose not work in emacs 23 or below, but ergoemacs-mode uses
+it to create the same structure and flatten them later.
+
+In emacs 24, this is how the function behaves:
+
+When looking up a key in the returned map, the key is looked in each
+keymap of MAPS in turn until a binding is found.
+If no binding is found in MAPS, the lookup continues in PARENT, if non-nil.
+As always with keymap inheritance, a nil binding in MAPS overrides
+any corresponding binding in PARENT, but it does not override corresponding
+bindings in other keymaps of MAPS.
+MAPS can be a list of keymaps or a single keymap.
+PARENT if non-nil should be a keymap."
+ `(keymap
+ ,@(if (keymapp maps) (list maps) maps)
+ ,@parent)))
+
(defvar ergoemacs-debug ""
"Debugging for `ergoemacs-mode'.")
diff --git a/ergoemacs-shortcuts.el b/ergoemacs-shortcuts.el
index b31bccf..c37f7e6 100644
--- a/ergoemacs-shortcuts.el
+++ b/ergoemacs-shortcuts.el
@@ -1789,6 +1789,7 @@ Setup C-c and C-x keys to be described properly.")
(defvar ergoemacs-read-input-keymap)
(defvar ergoemacs-modal-keymap)
+(declare-function ergoemacs-flatten-composed-keymap "ergoemacs-mode.el")
(defun ergoemacs-install-shortcut-up--internal (text keymap &optional
dont-complete)
(let* ((keymap keymap)
read-map
@@ -1810,12 +1811,13 @@ Setup C-c and C-x keys to be described properly.")
(let ((map (make-sparse-keymap)))
(setq map ergoemacs-modal-keymap)
(setq map
- (make-composed-keymap
- (list
- (ergoemacs-local-map
- (nth 0 ergoemacs-modal-list)
- t)
- map)))
+ (ergoemacs-flatten-composed-keymap
+ (make-composed-keymap
+ (list
+ (ergoemacs-local-map
+ (nth 0 ergoemacs-modal-list)
+ t)
+ map))))
map))
(setq keymap
(copy-keymap
- [elpa] 61/117: Set ergoemacs-mode-line default to t, (continued)
- [elpa] 61/117: Set ergoemacs-mode-line default to t, Matthew Fidler, 2014/07/25
- [elpa] 63/117: Attempt to fix Issue #278, Matthew Fidler, 2014/07/25
- [elpa] 67/117: Fix Issue #278, Matthew Fidler, 2014/07/25
- [elpa] 59/117: Add ergoemacs-mode-line option, Matthew Fidler, 2014/07/25
- [elpa] 64/117: Add run-hook property, Matthew Fidler, 2014/07/25
- [elpa] 66/117: Allow keymaps to be copied before modifying them, Matthew Fidler, 2014/07/25
- [elpa] 69/117: Fix Issue #279, Matthew Fidler, 2014/07/25
- [elpa] 70/117: Fix unbound keys test, Matthew Fidler, 2014/07/25
- [elpa] 72/117: Add back emacs 23, Matthew Fidler, 2014/07/25
- [elpa] 71/117: Use flat keymaps (start supporting emacs 23?), Matthew Fidler, 2014/07/25
- [elpa] 73/117: Try to make compatible with emacs 23,
Matthew Fidler <=
- [elpa] 74/117: Remove debugging for iswitch-buffer, Matthew Fidler, 2014/07/25
- [elpa] 65/117: Allow hooks to be run before modifying keymaps, Matthew Fidler, 2014/07/25
- [elpa] 75/117: Declare some of the package functions to compile cleanly on Emacs 23, Matthew Fidler, 2014/07/25
- [elpa] 76/117: Add toggle component, Matthew Fidler, 2014/07/25
- [elpa] 78/117: Fix visual line support, Matthew Fidler, 2014/07/25
- [elpa] 77/117: Take out the toggling of the themes, Matthew Fidler, 2014/07/25
- [elpa] 68/117: Use remaps more, Matthew Fidler, 2014/07/25
- [elpa] 81/117: Fix apps-toggle. Apparently the other method was mispecified, Matthew Fidler, 2014/07/25
- [elpa] 79/117: Allow repeated visual beginning/end of line, Matthew Fidler, 2014/07/25
- [elpa] 80/117: Dont flatten keymaps, Matthew Fidler, 2014/07/25