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

[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



reply via email to

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