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

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

[elpa] 01/35: Fix key lookup for menus. isearch <-> text search Issue #2


From: Matthew Fidler
Subject: [elpa] 01/35: Fix key lookup for menus. isearch <-> text search Issue #265.
Date: Fri, 11 Jul 2014 22:33:18 +0000

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

commit 051dd3c2181903d28ad4a9114f3ff19787819ef9
Author: Matthew L. Fidler <address@hidden>
Date:   Sun Jul 6 22:24:32 2014 -0500

    Fix key lookup for menus. isearch <-> text search
    Issue #265.
---
 ergoemacs-advices.el      |    2 +-
 ergoemacs-extras.el       |    2 +-
 ergoemacs-functions.el    |    1 +
 ergoemacs-macros.el       |    6 ++-
 ergoemacs-menus.el        |  115 ++++++++++++++++++++++++++-------------------
 ergoemacs-modal.el        |    1 +
 ergoemacs-mode.el         |   14 +++++-
 ergoemacs-shortcuts.el    |    6 ++-
 ergoemacs-test.el         |   20 ++++++++
 ergoemacs-theme-engine.el |   22 +++++++--
 ergoemacs-translate.el    |    1 +
 ergoemacs-unbind.el       |    1 +
 12 files changed, 132 insertions(+), 59 deletions(-)

diff --git a/ergoemacs-advices.el b/ergoemacs-advices.el
index aa597d6..e4f6573 100644
--- a/ergoemacs-advices.el
+++ b/ergoemacs-advices.el
@@ -273,7 +273,7 @@ Uses `ergoemacs-real-key-description'."
         (setq test
               (replace-match "" nil nil test)))
       (let (ergoemacs-modal ergoemacs-repeat-keys ergoemacs-read-input-keys
-                            ergoemacs-shortcut-keys)
+                            ergoemacs-shortcut-keys ergoemacs-no-shortcut-keys)
         (setq test (funcall function string))
         (when (string-match ".*\n.*\n" test)
           (setq ret (ergoemacs-substitute-map--1
diff --git a/ergoemacs-extras.el b/ergoemacs-extras.el
index 587004d..9242f95 100644
--- a/ergoemacs-extras.el
+++ b/ergoemacs-extras.el
@@ -1153,7 +1153,7 @@ Files are generated in the dir 〔ergoemacs-extras〕 at 
`user-emacs-directory'.
     (message "Calculating key frequencies based on key-position")
     (let ((table (copy-hash-table keyfreq-table))
           list
-          fileg
+          file
           (total-n 0)
           (cmd-n 0)
           (i 0)
diff --git a/ergoemacs-functions.el b/ergoemacs-functions.el
index 0793f20..1e23f62 100644
--- a/ergoemacs-functions.el
+++ b/ergoemacs-functions.el
@@ -2200,6 +2200,7 @@ See also `ergoemacs-lookup-word-on-internet'."
     (apropos-variable regexp)))
 
 (defvar ergoemacs-shortcut-keys)
+(defvar ergoemacs-no-shortcut-keys)
 (defvar ergoemacs-read-input-keys)
 (defvar ergoemacs-unbind-keys)
 (defvar ergoemacs-read-emulation-mode-map-alist)
diff --git a/ergoemacs-macros.el b/ergoemacs-macros.el
index ae7c801..5f99c76 100644
--- a/ergoemacs-macros.el
+++ b/ergoemacs-macros.el
@@ -37,6 +37,7 @@ major-mode, minor-mode, and global keys are ignored."
   `(let ((ergoemacs-mode t)
          (ergoemacs-unbind-keys t)
          (ergoemacs-shortcut-keys t)
+         (ergoemacs-no-shortcut-keys nil)
          ergoemacs-modal
          ergoemacs-read-input-keys
          (minor-mode-map-alist
@@ -44,7 +45,9 @@ major-mode, minor-mode, and global keys are ignored."
             (ergoemacs-unbind-keys ,@ergoemacs-unbind-keymap)))
          (ergoemacs-emulation-mode-map-alist '())
          (ergoemacs-shortcut-emulation-mode-map-alist
-          `((ergoemacs-shortcut-keys ,@ergoemacs-shortcut-keymap)))
+          `())
+         (ergoemacs-no-shortcut-emulation-mode-map-alist
+          `((ergoemacs-no-shortcut-keys ,@ergoemacs-no-shortcut-keymap)))
          (old-global-map (current-global-map))
          (old-local-map (current-local-map))
          (new-local-map (make-sparse-keymap))
@@ -64,6 +67,7 @@ The global map is ignored, but major/minor modes keymaps are 
included."
   `(let (ergoemacs-mode
          ergoemacs-unbind-keys
          ergoemacs-shortcut-keys
+         ergoemacs-no-shortcut-keys
          ergoemacs-modal
          ergoemacs-read-input-keys
          (old-global-map (current-global-map))
diff --git a/ergoemacs-menus.el b/ergoemacs-menus.el
index c20aaca..232fbbb 100644
--- a/ergoemacs-menus.el
+++ b/ergoemacs-menus.el
@@ -86,9 +86,35 @@
                                         ;(message "Submenu: %s" (car (cdr (cdr 
x))))
       (ergoemacs-preprocess-menu-keybindings (car (cdr (cdr (cdr x))))))))
 
+(defvar ergoemacs-handle-ctl-c-or-ctl-x)
 (defun ergoemacs-shortcut-for-command (cmd)
-  (let ((key (key-description (where-is-internal cmd nil t nil t))))
-    (ergoemacs-kbd-to-key key)))
+  "Figures out ergoemacs-mode menu's preferred key-binding for CMD."
+  (cond
+   ((and (memq ergoemacs-handle-ctl-c-or-ctl-x '(only-copy-cut both))
+         (eq cmd 'ergoemacs-cut-line-or-region)) (ergoemacs-kbd-to-key "C-x") )
+   ((and (memq ergoemacs-handle-ctl-c-or-ctl-x '(only-copy-cut both))
+         (eq cmd 'ergoemacs-copy-line-or-region)) (ergoemacs-kbd-to-key "C-c"))
+   (t
+    (let ((key (key-description
+                (let ((ergoemacs-read-input-keys)
+                      ergoemacs-shortcut-keys
+                      (ergoemacs-no-shortcut-keys t)
+                      (min-len 1000)
+                      (ret ""))
+                  (dolist (item (where-is-internal cmd nil nil nil t))
+                    (cond
+                     ((and (< (length item) min-len) item
+                           (not (memq (elt item 0) '(menu-bar remap again redo 
cut copy paste help))))
+                      (setq ret item)
+                      (setq min-len (length item)))
+                     ((and item (= (length item) min-len)
+                           (string-match-p "^C-.$" (key-description item)))
+                      (setq ret item))
+                     ((and item (= (length item) min-len) (not (eq (elt item 
0) 'help))
+                           (string-match-p "\\<[Ff]1\\>" (key-description 
item)))
+                      (setq ret item))))
+                  ret))))
+      (ergoemacs-kbd-to-key key)))))
 
 
 (defvar ergoemacs-menu-bar-old-file-menu (lookup-key global-map [menu-bar 
file]))
@@ -225,13 +251,13 @@ All other modes are assumed to be minor modes or 
unimportant.
           (save-buffer menu-item "Save" save-buffer)
           (write-file menu-item "Save As..." write-file)
           (revert-buffer menu-item "Revert to Saved" revert-buffer)
-          (print-buffer menu-item "Print" print-buffer)
-          (ps-print-buffer-faces menu-item "Print (font+color)" 
ps-print-buffer-faces)
+          (print-buffer menu-item "Print" ergoemacs-print-buffer-confirm)
+          ;; (ps-print-buffer-faces menu-item "Print (font+color)" 
ps-print-buffer-faces)
           (separator4 menu-item "--")
-          (split-window menu-item "Split Window"
-                        split-window-vertically)
-          (split-window-leftright menu-item "Split Window left/right"
-                                  split-window-horizontally)
+          (split-window-below menu-item "Split Window"
+                              split-window-below)
+          (split-window-right menu-item "Split Window right"
+                                  split-window-right)
           (one-window menu-item "Unsplit Window"
                       delete-other-windows)
           (separator5 menu-item "--")
@@ -257,8 +283,7 @@ All other modes are assumed to be minor modes or 
unimportant.
                        (eq last-command 'undo)
                        (listp pending-undo-list)
                      (consp buffer-undo-list)))
-          :help "Undo last operation"
-          :keys "Ctrl+Z")
+          :help "Undo last operation")
     (redo menu-item "Redo" ergoemacs-redo
           :enable (and
                    (not buffer-read-only)
@@ -266,18 +291,18 @@ All other modes are assumed to be minor modes or 
unimportant.
                    (or
                     (not (and (boundp 'undo-tree-mode) undo-tree-mode))
                     (and (and (boundp 'undo-tree-mode) undo-tree-mode)
-                            (null (undo-tree-node-next (undo-tree-current 
buffer-undo-tree))))))
-          :keys "Ctrl+Y")
+                            (null (undo-tree-node-next (undo-tree-current 
buffer-undo-tree)))))))
     (redo-sep menu-item "--")
-    (cut menu-item "Cut" clipboard-kill-region
-         :help "Delete text in region and copy it to the clipboard"
-         :keys "Ctrl+X")
-    (copy menu-item "Copy" clipboard-kill-ring-save
-          :help "Copy text in region to the clipboard"
-          :keys "Ctrl+C")
-    (paste menu-item "Paste" clipboard-yank
-           :help "Paste text from clipboard"
-           :keys "Ctrl+V")
+    (cut menu-item "Cut" ergoemacs-cut-line-or-region
+         :help "Delete text in Line/region and copy it to the clipboard"
+         :enable (or (eq ergoemacs-handle-ctl-c-or-ctl-x 'only-copy-cut)
+                     (region-active-p)))
+    (copy menu-item "Copy" ergoemacs-copy-line-or-region
+          :help "Copy text in line/region to the clipboard"
+          :enable (or (eq ergoemacs-handle-ctl-c-or-ctl-x 'only-copy-cut)
+                      (region-active-p)))
+    (paste menu-item "Paste" ergoemacs-paste
+           :help "Paste text from clipboard")
     (paste-from-menu menu-item "Paste from Kill Menu" yank-menu
                      :enable (and
                               (cdr yank-menu)
@@ -285,11 +310,9 @@ All other modes are assumed to be minor modes or 
unimportant.
                      :help "Choose a string from the kill ring and paste it")
     (clear menu-item "Clear" delete-region
            :enable (and mark-active (not buffer-read-only))
-           :help "Delete the text in region between mark and current position"
-           :keys "Del")
+           :help "Delete the text in region between mark and current position")
     (mark-whole-buffer menu-item "Select All" mark-whole-buffer
-                       :help "Mark the whole buffer for a subsequent cut/copy"
-                       :keys "Ctrl+A")
+                       :help "Mark the whole buffer for a subsequent cut/copy")
     (separator-search menu-item "--")
     (blank-operations menu-item "Blank/Whitespace Operations"
                       (keymap
@@ -524,10 +547,14 @@ All other modes are assumed to be minor modes or 
unimportant.
 ;;; `Search' menu
 (defvar ergoemacs-menu-bar-search-menu
   '(keymap
-    (search-forward menu-item "String Forward..." search-forward)
-    (search-backward menu-item "    Backward..." search-backward)
-    (re-search-forward menu-item "Regexp Forward..." re-search-forward)
-    (re-search-backward menu-item "    Backward..." re-search-backward)
+    (isearch-forward menu-item "String Forward..." isearch-forward
+                     :help "Search forward for a string as you type it")
+    (isearch-backward menu-item "    Backward..." isearch-backward
+                      :help "Search backwards for a string as you type it")
+    (re-isearch-forward menu-item "Regexp Forward..." isearch-forward-regexp
+                        :help "Search forward for a regular expression as you 
type it")
+    (re-isearch-backward menu-item "    Backward..." isearch-backward-regexp
+                         :help "Search backwards for a regular expression as 
you type it")
     (separator-repeat-search menu-item "--" )
     (repeat-forward menu-item "Repeat Forward" 
nonincremental-repeat-search-forward
                     :enable (or (and (memq menu-bar-last-search-type '(string 
word)) search-ring)
@@ -538,17 +565,13 @@ All other modes are assumed to be minor modes or 
unimportant.
                                  (and (eq menu-bar-last-search-type 'regexp) 
regexp-search-ring))
                      :help "Repeat last search forward")
     (separator-isearch menu-item "--")
-    (i-search menu-item "Incremental Search"
+    (i-search menu-item "String Search"
               (keymap
-               (isearch-forward menu-item "Forward String..." isearch-forward
-                                :help "Search forward for a string as you type 
it")
-               (isearch-backward menu-item "    Backward..." isearch-backward
-                                 :help "Search backwards for a string as you 
type it")
-               (isearch-forward-regexp menu-item "Forward Regexp..." 
isearch-forward-regexp
-                                       :help "Search forward for a regular 
expression as you type it")
-               (isearch-backward-regexp menu-item "    Backward..." 
isearch-backward-regexp
-                                        :help "Search backwards for a regular 
expression as you type it")
-               "Incremental Search"))
+               (search-forward menu-item "Forward String..." search-forward)
+               (search-backward menu-item "    Backward..." search-backward)
+               (search-forward-regexp menu-item "Forward Regexp..." 
re-search-forward)
+               (search-backward-regexp menu-item "    Backward..." 
re-search-backward)
+               "String Search"))
     
     (replace menu-item "Replace"
              (keymap
@@ -640,7 +663,7 @@ All other modes are assumed to be minor modes or 
unimportant.
     
     (menu-set-font menu-item "Set Default Font..." menu-set-font :visible
                    (display-multi-font-p)
-                   :help "Select a default font" :keys "")
+                   :help "Select a default font")
     
     ,(when (fboundp 'customize-themes)
        '(color-theme menu-item "Customize Color Themes" customize-themes
@@ -708,22 +731,18 @@ All other modes are assumed to be minor modes or 
unimportant.
                                 (frame-live-p
                                  speedbar-frame)
                                 (frame-visible-p
-                                 speedbar-frame))
-                       :keys "")
+                                 speedbar-frame)))
     ;; (datetime-separator)
     ;; (showhide-date-time)
     (linecolumn-separator "--")
     (line-number-mode menu-item "Line Numbers" line-number-mode :help "Show 
the current line number in the mode line" :button
                       (:toggle and
                                (default-boundp 'line-number-mode)
-                               (default-value 'line-number-mode))
-                      :keys "")
+                               (default-value 'line-number-mode)))
     (global-whitespace-mode menu-item "Show/Hide whitespaces" 
global-whitespace-mode :button
-                            (:toggle . global-whitespace-mode)
-                            :keys "")
+                            (:toggle . global-whitespace-mode))
     (global-linum-mode menu-item "Show/Hide line numbers in margin" 
global-linum-mode :button
-                       (:toggle . global-linum-mode)
-                       :keys "")))
+                       (:toggle . global-linum-mode))))
 
 
 ;;; `Help' menus
diff --git a/ergoemacs-modal.el b/ergoemacs-modal.el
index e13cbe2..82a13f5 100644
--- a/ergoemacs-modal.el
+++ b/ergoemacs-modal.el
@@ -50,6 +50,7 @@
 ;; 
 ;;; Code:
 
+(defvar ergoemacs-handle-ctl-c-or-ctl-x)
 (defgroup ergoemacs-modal nil
   "Modal ergoemacs"
   :group 'ergoemacs-mode)
diff --git a/ergoemacs-mode.el b/ergoemacs-mode.el
index d8ad4ac..4675f32 100644
--- a/ergoemacs-mode.el
+++ b/ergoemacs-mode.el
@@ -236,6 +236,7 @@ Valid values are:
 (defvar ergoemacs-curr-prefix-arg nil)
 (defvar ergoemacs-repeat-keys nil)
 (defvar ergoemacs-shortcut-keys nil)
+(defvar ergoemacs-no-shortcut-keys nil)
 (defvar ergoemacs-unbind-keys nil)
 (defvar ergoemacs-read-input-keys nil)
 
@@ -261,6 +262,9 @@ Valid values are:
 (defvar ergoemacs-shortcut-keymap (make-sparse-keymap)
   "ErgoEmacs minor mode shortcut keymap")
 
+(defvar ergoemacs-no-shortcut-keymap (make-sparse-keymap)
+  "ErgoEmacs minor mode shortcut-free keymap")
+
 (defvar ergoemacs-read-input-keymap (make-sparse-keymap)
   "Ergoemacs minor mode shortcut input keymap.")
 
@@ -363,6 +367,9 @@ Valid values are:
 (defvar ergoemacs-shortcut-emulation-mode-map-alist nil
   "Override keys in `ergoemacs-mode' for `emulation-mode-map-alist'")
 
+(defvar ergoemacs-no-shortcut-emulation-mode-map-alist nil
+  "Override keys in `ergoemacs-mode' for `emulation-mode-map-alist'")
+
 (defun ergoemacs-emulations (&optional remove)
   "Add ergoemacs emulations to `emulation-mode-map-alist'.
 When REMOVE is true, remove the emulations."
@@ -370,7 +377,8 @@ When REMOVE is true, remove the emulations."
                            ergoemacs-read-emulation-mode-map-alist
                            ergoemacs-repeat-emulation-mode-map-alist
                            ergoemacs-emulation-mode-map-alist
-                           ergoemacs-shortcut-emulation-mode-map-alist)))
+                           ergoemacs-shortcut-emulation-mode-map-alist
+                           ergoemacs-no-shortcut-emulation-mode-map-alist)))
     (funcall (if remove #'remove-hook #'add-hook) 'emulation-mode-map-alists 
hook)))
 
 (defvar ns-alternate-modifier)
@@ -426,7 +434,8 @@ bindings the keymap is:
         ;;   (setq ergoemacs-org-CUA-compatible org-CUA-compatible))
         (ergoemacs-emulations)
         ;; Setup keys
-        (setq ergoemacs-shortcut-keymap (make-sparse-keymap))
+        (setq ergoemacs-shortcut-keymap (make-sparse-keymap)
+              ergoemacs-no-shortcut-keymap (make-sparse-keymap))
         (ergoemacs-setup-keys t)
         (ergoemacs-debug-heading "Ergoemacs Keys have loaded.")
         (when (and ergoemacs-use-mac-command-as-meta
@@ -736,6 +745,7 @@ This is done by checking if this is a command that supports 
shift selection or c
         (progn
           (when ergoemacs-mode
             (setq ergoemacs-shortcut-keys t)
+            (setq ergoemacs-no-shortcut-keys nil)
             (ergoemacs-shuffle-keys)
             (when (not unread-command-events)
               (ergoemacs-install-shortcuts-up)))
diff --git a/ergoemacs-shortcuts.el b/ergoemacs-shortcuts.el
index 2d598bc..f27de3a 100644
--- a/ergoemacs-shortcuts.el
+++ b/ergoemacs-shortcuts.el
@@ -524,8 +524,9 @@ It will replace anything defined by `ergoemacs-translation'"
          (fboundp 'cua-clear-rectangle-mark))
     (cua-clear-rectangle-mark))
    (t
-     (let (defined-fn
+    (let (defined-fn
            ergoemacs-shortcut-keys
+           ergoemacs-no-shortcut-keys
            ergoemacs-read-input-keys
            ergoemacs-mode)
       (setq defined-fn (ergoemacs-key-fn-lookup 'keyboard-quit))
@@ -629,7 +630,7 @@ In addition, when the function is called:
                            (push (ergoemacs-pretty-key (key-description 
global-key))
                                  keys))))))
                   (let (ergoemacs-modal ergoemacs-repeat-keys 
ergoemacs-read-input-keys
-                                        ergoemacs-shortcut-keys)
+                                        ergoemacs-shortcut-keys 
ergoemacs-no-shortcut-keys)
                     (dolist (global-key (where-is-internal function))
                       (unless (eq (elt global-key 0) 'menu-bar)
                         (push (ergoemacs-pretty-key (key-description 
global-key))
@@ -778,6 +779,7 @@ FORCE-KEY forces keys like <escape> to work properly.
       (let* (ergoemacs-read-input-keys
              ergoemacs-modal
              ergoemacs-shortcut-keys
+             ergoemacs-no-shortcut-keys
              (hash (and key (gethash key ergoemacs-command-shortcuts-hash)))
              lookup
              tmp-overlay use-override
diff --git a/ergoemacs-test.el b/ergoemacs-test.el
index 1503445..e85af57 100644
--- a/ergoemacs-test.el
+++ b/ergoemacs-test.el
@@ -1017,6 +1017,26 @@ Selected mark would not be cleared after paste."
   "Make sure the unbound keys work"
   (should (eq 'ergoemacs-undefined (ergoemacs-real-key-binding (read-kbd-macro 
"C-x C-s")))))
 
+(declare-function ergoemacs-shortcut-for-command "ergoemacs-menus.el")
+(declare-function ergoemacs-kbd-to-key "ergoemacs-menus.el")
+(ert-deftest ergoemacs-test-keyboard-translations ()
+  "Should test Issue #265"
+  (ergoemacs-test-layout ;; Us/standard
+   (should (string= (ergoemacs-shortcut-for-command 'goto-line) 
(ergoemacs-kbd-to-key "C-l")))
+   (should (string= (ergoemacs-shortcut-for-command 
'ergoemacs-new-empty-buffer) (ergoemacs-kbd-to-key "C-n")))
+   (should (string= (ergoemacs-shortcut-for-command 'make-frame-command) 
(ergoemacs-kbd-to-key "C-N")))
+   (should (string= (ergoemacs-shortcut-for-command 'find-file) 
(ergoemacs-kbd-to-key "C-o")))
+   (should (string= (ergoemacs-shortcut-for-command 
'ergoemacs-open-last-closed) (ergoemacs-kbd-to-key "C-T")))
+   (should (string= (ergoemacs-shortcut-for-command 
'ergoemacs-close-current-buffer) (ergoemacs-kbd-to-key "C-w")))
+   (should (string= (ergoemacs-shortcut-for-command 'revert-buffer) 
(ergoemacs-kbd-to-key "C-r")))
+   (should (string= (ergoemacs-shortcut-for-command 
'ergoemacs-print-buffer-confirm) (ergoemacs-kbd-to-key "C-p")))
+   (should (string= (ergoemacs-shortcut-for-command 'save-buffer) 
(ergoemacs-kbd-to-key "C-s")))
+   (should (string= (ergoemacs-shortcut-for-command 'write-file) 
(ergoemacs-kbd-to-key "C-S")))
+   (should (string= (ergoemacs-shortcut-for-command 'split-window-below) 
(ergoemacs-kbd-to-key "M-4")))
+   (should (string= (ergoemacs-shortcut-for-command 'split-window-right) 
(ergoemacs-kbd-to-key "M-$")))
+   (should (string= (ergoemacs-shortcut-for-command 'delete-other-windows) 
(ergoemacs-kbd-to-key "M-3")))
+   (should (string= (ergoemacs-shortcut-for-command 'execute-extended-command) 
(ergoemacs-kbd-to-key "M-a")))))
+
 ;; (ert-deftest ergoemacs-test-5.3.7 ()
 ;;   "Test Ergoemacs 5.3.7 keys"
 ;;   (let ((ergoemacs-test-fn t))
diff --git a/ergoemacs-theme-engine.el b/ergoemacs-theme-engine.el
index 842bfa3..ec3d83d 100644
--- a/ergoemacs-theme-engine.el
+++ b/ergoemacs-theme-engine.el
@@ -1220,14 +1220,17 @@ FULL-SHORTCUT-MAP-P "
 (defvar ergoemacs-theme)
 (defvar ergoemacs-keymap)
 (defvar ergoemacs-shortcut-keys)
+(defvar ergoemacs-no-shortcut-keys)
 (defvar ergoemacs-read-input-keys)
 (defvar ergoemacs-unbind-keys)
 (defvar ergoemacs-unbind-keymap)
 (defvar ergoemacs-read-input-keymap)
 (defvar ergoemacs-read-emulation-mode-map-alist)
 (defvar ergoemacs-shortcut-keymap)
+(defvar ergoemacs-no-shortcut-keymap)
 (defvar ergoemacs-emulation-mode-map-alist)
 (defvar ergoemacs-shortcut-emulation-mode-map-alist)
+(defvar ergoemacs-no-shortcut-emulation-mode-map-alist)
 (defvar ergoemacs-mode)
 (defmethod ergoemacs-theme-obj-install ((obj 
ergoemacs-theme-component-map-list) &optional remove-p)
   (with-slots (read-map
@@ -1242,7 +1245,8 @@ FULL-SHORTCUT-MAP-P "
           ;; (shortcut-map (or shortcut-map (make-sparse-keymap)))
           ;; (map (or map (make-sparse-keymap)))
           (menu-keymap (make-sparse-keymap))
-          final-map final-shortcut-map final-read-map final-unbind-map
+          final-map final-shortcut-map final-no-shortcut-map
+          final-read-map final-unbind-map
           (rm-list (append rm-keys ergoemacs-global-override-rm-keys)) 
           (i 0))
       ;; Get all the major-mode hooks that will be called or modified
@@ -1338,6 +1342,7 @@ The actual keymap changes are included in 
`ergoemacs-emulation-mode-map-alist'."
         ;; respect.
         ;; The removing of keys doesn't really work right now.
         (setq final-shortcut-map (copy-keymap shortcut-map)
+              final-no-shortcut-map (copy-keymap no-shortcut-map)
               final-unbind-map (copy-keymap unbind-map)
               final-read-map (copy-keymap read-map)
               final-map (copy-keymap map)
@@ -1352,6 +1357,7 @@ The actual keymap changes are included in 
`ergoemacs-emulation-mode-map-alist'."
                                           final-read-map)
                                      (ergoemacs-rm-key final-read-map key))
                   final-shortcut-map (ergoemacs-rm-key final-shortcut-map key)
+                  final-no-shortcut-map (ergoemacs-rm-key 
final-no-shortcut-map key)
                   final-map (ergoemacs-rm-key final-map key)
                   final-unbind-map (ergoemacs-rm-key final-unbind-map key))))
         ;; Add `ergoemacs-mode' menu.
@@ -1387,16 +1393,19 @@ The actual keymap changes are included in 
`ergoemacs-emulation-mode-map-alist'."
       ;; Turn on/off ergoemacs-mode
       (set-default 'ergoemacs-mode (not remove-p))
       (set-default 'ergoemacs-shortcut-keys (not remove-p))
+      (set-default 'ergoemacs-no-shortcut-keys nil)
       (set-default 'ergoemacs-read-input-keys (not remove-p))
       (set-default 'ergoemacs-unbind-keys (not remove-p))
       (setq ergoemacs-mode (not remove-p)
             ergoemacs-keymap final-map
             ergoemacs-shortcut-keys (not remove-p)
+            ergoemacs-no-shortcut-keys nil
             ergoemacs-read-input-keys (not remove-p)
             ergoemacs-unbind-keys (not remove-p)
             ergoemacs-read-input-keymap final-read-map
             ergoemacs-read-emulation-mode-map-alist 
`((ergoemacs-read-input-keys ,@final-read-map))
             ergoemacs-shortcut-keymap final-shortcut-map
+            ergoemacs-no-shortcut-keymap final-no-shortcut-map
             ergoemacs-unbind-keymap final-unbind-map
             ergoemacs-emulation-mode-map-alist
             (reverse
@@ -1412,7 +1421,10 @@ The actual keymap changes are included in 
`ergoemacs-emulation-mode-map-alist'."
                    (cons remap map)))
                (ergoemacs-get-hooks obj "-mode\\'"))))
             ergoemacs-shortcut-emulation-mode-map-alist
-            `((ergoemacs-shortcut-keys ,@final-shortcut-map)))
+            `((ergoemacs-shortcut-keys ,@final-shortcut-map))
+            ergoemacs-no-shortcut-emulation-mode-map-alist
+            `((ergoemacs-no-shortcut-keys ,@final-no-shortcut-map))
+            )
       ;; Apply variables and mode changes.
       (if remove-p
           (progn
@@ -1847,7 +1859,7 @@ DONT-COLLAPSE doesn't collapse empty keymaps"
         (when (ergoemacs-global-changed-p key)
           (when reset ;; Reset keymaps
             ;; Reset keymaps.
-            (dolist (map '(ergoemacs-shortcut-keymap 
ergoemacs-read-input-keymap ergoemacs-keymap ergoemacs-unbind-keymap))
+            (dolist (map '(ergoemacs-no-shortcut-keymap 
ergoemacs-shortcut-keymap ergoemacs-read-input-keymap ergoemacs-keymap 
ergoemacs-unbind-keymap))
               (when (symbol-value map)
                 (set map (ergoemacs-rm-key (symbol-value map) key))
                 (setq lk (lookup-key (symbol-value map) key))
@@ -1872,7 +1884,9 @@ DONT-COLLAPSE doesn't collapse empty keymaps"
             (setq ergoemacs-read-emulation-mode-map-alist
                   (list (cons 'ergoemacs-read-input-keys 
ergoemacs-read-input-keymap))
                   ergoemacs-shortcut-emulation-mode-map-alist
-                  (list (cons 'ergoemacs-shortcut-keys 
ergoemacs-shortcut-keymap)))
+                  (list (cons 'ergoemacs-shortcut-keys 
ergoemacs-shortcut-keymap))
+                  ergoemacs-no-shortcut-emulation-mode-map-alist
+                  (list (cons 'ergoemacs-no-shortcut-keys 
ergoemacs-no-shortcut-keymap)))
             ;;Put maps in `minor-mode-map-alist'
             (ergoemacs-shuffle-keys t))
           (when (and (or (commandp lk t)
diff --git a/ergoemacs-translate.el b/ergoemacs-translate.el
index 6fdc92b..8ba0e83 100644
--- a/ergoemacs-translate.el
+++ b/ergoemacs-translate.el
@@ -978,6 +978,7 @@ For example, on dvorak, change C-j to C-c (copy/command)."
 (defvar ergoemacs-keymap)
 (defvar ergoemacs-unbind-keymap)
 (defvar ergoemacs-shortcut-keymap)
+(defvar ergoemacs-no-shortcut-keymap)
 (defvar ergoemacs-command-shortcuts-hash)
 (defun ergoemacs-key-fn-lookup (function &optional use-apps)
   "Looks up the key binding for FUNCTION based on.
diff --git a/ergoemacs-unbind.el b/ergoemacs-unbind.el
index 2770019..f484046 100644
--- a/ergoemacs-unbind.el
+++ b/ergoemacs-unbind.el
@@ -636,6 +636,7 @@
 
 (defvar ergoemacs-single-command-keys)
 (defvar ergoemacs-shortcut-keymap)
+(defvar ergoemacs-no-shortcut-keymap)
 (defvar ergoemacs-keymap)
 (defvar keyfreq-mode)
 (defvar keyfreq-table)



reply via email to

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