[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 43/117: Setup local overrides outside of minibuffers and overridi
From: |
Matthew Fidler |
Subject: |
[elpa] 43/117: Setup local overrides outside of minibuffers and overriding keymaps |
Date: |
Fri, 25 Jul 2014 13:24:07 +0000 |
mlf176f2 pushed a commit to branch externals/ergoemacs-mode
in repository elpa.
commit ccf88b6536c9276e88876891873389d5db91824c
Author: Matthew L. Fidler <address@hidden>
Date: Wed Jul 16 17:44:42 2014 -0500
Setup local overrides outside of minibuffers and overriding keymaps
---
ergoemacs-shortcuts.el | 44 +++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 43 insertions(+), 1 deletions(-)
diff --git a/ergoemacs-shortcuts.el b/ergoemacs-shortcuts.el
index ec714c0..6afc798 100644
--- a/ergoemacs-shortcuts.el
+++ b/ergoemacs-shortcuts.el
@@ -214,6 +214,7 @@ Used to help with translation keymaps like
`input-decode-map'"
(defvar ergoemacs-modal)
(defvar ergoemacs-universal-fns)
(defvar ergoemacs-read-input-keys)
+(defvar ergoemacs-read-local-emulation-mode-map-alist)
(declare-function ergoemacs-unicode-char "ergoemacs-translate.el")
(declare-function ergoemacs-translate "ergoemacs-translate.el")
(declare-function ergoemacs-local-map "ergoemacs-translate.el")
@@ -1853,7 +1854,7 @@ Setup C-c and C-x keys to be described properly.")
The keymaps are:
- `overriding-terminal-local-map'
- `overriding-local-map'
-- overlays with :keymap property
+- Overlays with :keymap property
- text property with :keymap property."
(let ((inhibit-read-only t)
deactivate-mark
@@ -1909,6 +1910,47 @@ The keymaps are:
;; (ergoemacs-debug-keymap 'override-text-map)
)))))
+(defvar ergoemacs-debug-keymap--temp-map)
+(declare-function ergoemacs-real-substitute-command-keys "ergoemacs-advice.el")
+(defun ergoemacs-extract-prefixes (keymap)
+ "Extract prefix commands for KEYMAP.
+Ignores command sequences starting with `ergoemacs-ignored-prefixes'."
+ (save-match-data
+ (let ((string (or (ignore-errors
+ (ergoemacs-real-substitute-command-keys (format
"\\{%s}" (symbol-name keymap))))
+ (progn
+ (setq ergoemacs-debug-keymap--temp-map keymap)
+ (ergoemacs-real-substitute-command-keys
"\\{ergoemacs-debug-keymap--temp-map}"))))
+ (pt 0)
+ (ret '()))
+ (while (string-match "^\\([^ \n][^ \n\t]*?\\) [^.].+*" string pt)
+ (unless (or (string-match-p "\\(--\\|key\\)" (match-string 1 string))
+ (member (match-string 1 string) ergoemacs-ignored-prefixes)
+ (member (match-string 1 string) ret))
+ (push (match-string 1 string) ret))
+ (setq pt (match-end 0)))
+ ret)))
+
+(defvar ergoemacs-ignore-advice)
+(defun ergoemacs-setup-local-prefixes ()
+ "Setup local prefixes to use `ergoemacs-read-key'.
+Do not do anything if you are:
+- In the minibuffer (determined by `minibufferp')
+- If overriding text maps are active, like `overriding-terminal-local-map' and
`overriding-local-map'"
+ (unless (or (minibufferp) overriding-terminal-local-map overriding-local-map)
+ (let* ((map (current-local-map))
+ (ergoemacs-ignore-advice t)
+ key-vector
+ (prefixes (ergoemacs-extract-prefixes map))
+ (read-map (make-sparse-keymap)))
+ (when prefixes
+ (dolist (prefix prefixes)
+ (setq key-vector (read-kbd-macro prefix prefix))
+ (ignore-errors
+ (define-key read-map key-vector 'ergoemacs-read-key-default)))
+ (set (make-local-variable
'ergoemacs-read-local-emulation-mode-map-alist)
+ (list (cons 'ergoemacs-read-input-keys read-map)))))))
+
(provide 'ergoemacs-shortcuts)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ergoemacs-shortcuts.el ends here
- [elpa] 34/117: Use abbreviated file name for shell here, (continued)
- [elpa] 34/117: Use abbreviated file name for shell here, Matthew Fidler, 2014/07/25
- [elpa] 32/117: Took out space requirement for dirtrack-list, Matthew Fidler, 2014/07/25
- [elpa] 41/117: Remove remnants of original local-set-key advice., Matthew Fidler, 2014/07/25
- [elpa] 42/117: Possibly address Issue #276, Matthew Fidler, 2014/07/25
- [elpa] 40/117: Make ergoemacs-shortcuts lexically scoped, Matthew Fidler, 2014/07/25
- [elpa] 45/117: Merge pull request #277 from pdg137/patch-1, Matthew Fidler, 2014/07/25
- [elpa] 44/117: Use M-h instead of M-H for comint-bol., Matthew Fidler, 2014/07/25
- [elpa] 48/117: Add support for dired+ prefixes, Matthew Fidler, 2014/07/25
- [elpa] 47/117: theme component support for if/dolist/mapc/mapcar/when, Matthew Fidler, 2014/07/25
- [elpa] 49/117: Merge branch 'master' of github.com:ergoemacs/ergoemacs-mode, Matthew Fidler, 2014/07/25
- [elpa] 43/117: Setup local overrides outside of minibuffers and overriding keymaps,
Matthew Fidler <=
- [elpa] 52/117: Take out org-italic, Matthew Fidler, 2014/07/25
- [elpa] 51/117: Fix F8 map, Matthew Fidler, 2014/07/25
- [elpa] 50/117: Add lookup of C-g to ergoemacs-keyboard-quit, Matthew Fidler, 2014/07/25
- [elpa] 55/117: Bug fix for ergoemacs-keyboard-quit, Matthew Fidler, 2014/07/25
- [elpa] 56/117: Add ability to "flatten" a composed keymap; Flatten maps that are always modified, Matthew Fidler, 2014/07/25
- [elpa] 58/117: Remove ergoemacs-read-modal-keymap function, Matthew Fidler, 2014/07/25
- [elpa] 53/117: Don't error on invalid menu., Matthew Fidler, 2014/07/25
- [elpa] 46/117: Install ergoemacs-read-default for every major mode, Matthew Fidler, 2014/07/25
- [elpa] 54/117: Fix menu keybinding preprocessing, Matthew Fidler, 2014/07/25
- [elpa] 57/117: Add first keyword, and use in minibuffer-setup-hook, Matthew Fidler, 2014/07/25