[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 15/35: Misc Code Cleanup
From: |
Matthew Fidler |
Subject: |
[elpa] 15/35: Misc Code Cleanup |
Date: |
Fri, 11 Jul 2014 22:33:24 +0000 |
mlf176f2 pushed a commit to branch externals/ergoemacs-mode
in repository elpa.
commit 89e2b10ec951a1bd0e245f7f5fd219cd897fc0dd
Author: Matthew L. Fidler <address@hidden>
Date: Wed Jul 9 10:14:28 2014 -0500
Misc Code Cleanup
---
ergoemacs-advices.el | 3 +
ergoemacs-extras.el | 2 +-
ergoemacs-functions.el | 3 +
ergoemacs-layouts.el | 4 +-
ergoemacs-macros.el | 3 +
ergoemacs-modal.el | 3 +
ergoemacs-mode.el | 84 ++++++++--------
ergoemacs-shortcuts.el | 8 ++-
ergoemacs-theme-engine.el | 3 +
ergoemacs-translate.el | 235 +++++++++++++++++++++++----------------------
ergoemacs-unbind.el | 81 ++++-----------
11 files changed, 209 insertions(+), 220 deletions(-)
diff --git a/ergoemacs-advices.el b/ergoemacs-advices.el
index 3307236..0750eaf 100644
--- a/ergoemacs-advices.el
+++ b/ergoemacs-advices.el
@@ -306,6 +306,7 @@ Uses `ergoemacs-real-key-description'."
(defvar ergoemacs-original-keys-to-shortcut-keys-regexp)
(defvar ergoemacs-original-keys-to-shortcut-keys)
+(defvar ergoemacs-unbind-keys)
(declare-function ergoemacs-emulations "ergoemacs-mode.el")
(declare-function ergoemacs-remove-shortcuts "ergoemacs-shortcuts.el")
(defun ergoemacs-substitute-command (string &optional map)
@@ -511,4 +512,6 @@ Assumes ergoemacs-real-FUNCTION and ergoemacs-FUNCTION as
the two functions to t
(provide 'ergoemacs-advices)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ergoemacs-advices.el ends here
+;; Local Variables:
;; coding: utf-8-emacs
+;; End:
diff --git a/ergoemacs-extras.el b/ergoemacs-extras.el
index 8f772cb..8d26c46 100644
--- a/ergoemacs-extras.el
+++ b/ergoemacs-extras.el
@@ -1723,4 +1723,4 @@ IS-PREFIX tell ergoemacs if this is a prefix diagram."
;;; ergoemacs-extras.el ends here
;; Local Variables:
;; coding: utf-8-emacs
-;; End
+;; End:
diff --git a/ergoemacs-functions.el b/ergoemacs-functions.el
index 340b286..f51a556 100644
--- a/ergoemacs-functions.el
+++ b/ergoemacs-functions.el
@@ -543,6 +543,7 @@ This will not honor `shift-select-mode'."
(defvar ergoemacs-beginning-of-line-or-what-last-command nil)
(declare-function comment-search-backward "newcomment.el")
(declare-function comment-search-forward "newcomment.el")
+(defvar comment-start-skip)
(defun ergoemacs-beginning-of-line-or-what (&optional N)
"Move cursor to beginning of indentation, line, or text block, or beginning
of buffer.
(a text block is separated by empty lines).
@@ -1219,6 +1220,8 @@ Emacs buffers are those whose name starts with *."
(while (and (not (string-equal "*" (substring (buffer-name) 0 1))) (< i
20))
(setq i (1+ i)) (previous-buffer) )))
+(defvar initial-major-mode)
+(defvar buffer-offer-save)
(defun ergoemacs-new-empty-buffer ()
"Opens a new empty buffer."
(interactive)
diff --git a/ergoemacs-layouts.el b/ergoemacs-layouts.el
index fb85f27..8c82560 100644
--- a/ergoemacs-layouts.el
+++ b/ergoemacs-layouts.el
@@ -402,8 +402,8 @@
(setq ret (cons (replace-regexp-in-string
"ergoemacs-layout-" "" sn) ret))))))
ob)
(if aliases
- (setq ergoemacs-get-layouts-aliases)
- (setq ergoemacs-get-layouts-no-aliases))
+ (setq ergoemacs-get-layouts-aliases nil)
+ (setq ergoemacs-get-layouts-no-aliases nil))
ret))))
(provide 'ergoemacs-layouts)
diff --git a/ergoemacs-macros.el b/ergoemacs-macros.el
index 206b10b..a84c8fe 100644
--- a/ergoemacs-macros.el
+++ b/ergoemacs-macros.el
@@ -443,3 +443,6 @@ This was stole/modified from `c-save-buffer-state'"
(provide 'ergoemacs-macros)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ergoemacs-macros.el ends here
+;; Local Variables:
+;; coding: utf-8-emacs
+;; End:
diff --git a/ergoemacs-modal.el b/ergoemacs-modal.el
index 82a13f5..cdf3a3e 100644
--- a/ergoemacs-modal.el
+++ b/ergoemacs-modal.el
@@ -438,3 +438,6 @@ the translation type defined by `ergoemacs-modal-list' as
long as it should."
(provide 'ergoemacs-modal)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ergoemacs-modal.el ends here
+;; Local Variables:
+;; coding: utf-8-emacs
+;; End:
diff --git a/ergoemacs-mode.el b/ergoemacs-mode.el
index d1bc027..5858132 100644
--- a/ergoemacs-mode.el
+++ b/ergoemacs-mode.el
@@ -74,11 +74,13 @@
(defvar ergoemacs-debug-buffer " *ErgoEmacs-mode Debug Log*"
"Variable for ergoemacs debugging buffer.")
+(defvar ergoemacs-debug-keymap--temp-map nil)
(defun ergoemacs-debug-keymap (keymap)
"Print keymap bindings."
(if (not (ignore-errors (symbolp (symbol-name keymap))))
- (let ((temp-map keymap))
- (ergoemacs-debug "%s" (substitute-command-keys "\\{temp-map}")))
+ (progn
+ (setq ergoemacs-debug-keymap--temp-map keymap)
+ (ergoemacs-debug "%s" (substitute-command-keys
"\\{ergoemacs-debug-keymap--temp-map}")))
(ergoemacs-debug-heading "%s"
(format "Keymap Description: %s" (symbol-name
keymap)))
(ergoemacs-debug "%s" (substitute-command-keys (format "\\{%s}"
(symbol-name keymap))))))
@@ -91,7 +93,7 @@
(ergoemacs-debug (concat "** "
(condition-case err
(apply 'format arg)
- (eurror (format "Bad format string: %s" arg)))))
+ (error (format "Bad format string: %s (%s)" arg
err)))))
(ergoemacs-debug "Time Since Start ergoemacs-mode: %1f sec" (- (float-time)
ergoemacs-debug-heading-start-time))
(ergoemacs-debug "Time Since Last Heading: %1f sec" (- (float-time)
ergoemacs-debug-heading-last-time))
(setq ergoemacs-debug-heading-last-time (float-time)))
@@ -112,7 +114,7 @@
ergoemacs-debug
(condition-case err
(apply 'format arg)
- (error (format "Bad Format String: %s" arg)))))))
+ (error (format "Bad Format String: %s (%s)" arg err)))))))
(defun ergoemacs-debug-clear ()
"Clears the variable `ergoemacs-debug' and `ergoemacs-debug-buffer'"
@@ -681,40 +683,37 @@ This is done by checking if this is a command that
supports shift selection or c
(when transient-mark-mode ;; restore transient-mark-mode state
(setq transient-mark-mode ergoemacs-mark-active)))
(let (deactivate-mark)
- (condition-case err
- (progn
- (ergoemacs-restore-post-command-hook)
- (when (and ergoemacs-repeat-keys
- (keymapp ergoemacs-repeat-keymap)
- (not (lookup-key ergoemacs-repeat-keymap
(this-single-command-keys))))
- (setq ergoemacs-repeat-keys nil)
- (ergoemacs-mode-line))
- (when (and (not ergoemacs-read-input-keys)
- (not unread-command-events))
- (setq ergoemacs-read-input-keys t)
- (when (ergoemacs-real-key-binding [ergoemacs-single-command-keys])
- (if (not ergoemacs-read-key-overriding-overlay-save)
- (setq overriding-terminal-local-map
ergoemacs-read-key-overriding-terminal-local-save)
- (delete-overlay ergoemacs-read-key-overriding-overlay-save)
- (setq ergoemacs-read-key-overriding-overlay-save nil))))
- (setq ergoemacs-this-command this-command)
- (when ergoemacs-mode
- ;; Raise shortcuts and modal modes.
- (ergoemacs-shuffle-keys)
- (let ((ergoemacs-real-key-binding
- (read-kbd-macro
- (format
- "<override> %s" (key-description
(this-single-command-keys))))))
- (cond
- ((condition-case err
- (interactive-form ergoemacs-real-key-binding)
- (error nil))
- (setq this-command ergoemacs-real-key-binding))))
- ;; Used to check for `saved-overriding-map', but changed
- ;; in emacs 24.4, and `ergoemacs-mode' deals with
- ;; universal functions independent of emacs...
- (ergoemacs-install-shortcuts-up)))
- (error nil)))
+ (ignore-errors
+ (progn
+ (ergoemacs-restore-post-command-hook)
+ (when (and ergoemacs-repeat-keys
+ (keymapp ergoemacs-repeat-keymap)
+ (not (lookup-key ergoemacs-repeat-keymap
(this-single-command-keys))))
+ (setq ergoemacs-repeat-keys nil)
+ (ergoemacs-mode-line))
+ (when (and (not ergoemacs-read-input-keys)
+ (not unread-command-events))
+ (setq ergoemacs-read-input-keys t)
+ (when (ergoemacs-real-key-binding [ergoemacs-single-command-keys])
+ (if (not ergoemacs-read-key-overriding-overlay-save)
+ (setq overriding-terminal-local-map
ergoemacs-read-key-overriding-terminal-local-save)
+ (delete-overlay ergoemacs-read-key-overriding-overlay-save)
+ (setq ergoemacs-read-key-overriding-overlay-save nil))))
+ (setq ergoemacs-this-command this-command)
+ (when ergoemacs-mode
+ ;; Raise shortcuts and modal modes.
+ (ergoemacs-shuffle-keys)
+ (let ((ergoemacs-real-key-binding
+ (read-kbd-macro
+ (format
+ "<override> %s" (key-description
(this-single-command-keys))))))
+ (cond
+ ((commandp ergoemacs-real-key-binding t)
+ (setq this-command ergoemacs-real-key-binding))))
+ ;; Used to check for `saved-overriding-map', but changed
+ ;; in emacs 24.4, and `ergoemacs-mode' deals with
+ ;; universal functions independent of emacs...
+ (ergoemacs-install-shortcuts-up)))))
(unless (ergoemacs-smart-function-p this-command)
(run-hooks 'ergoemacs-pre-command-hook))
t)
@@ -725,10 +724,9 @@ This is done by checking if this is a command that
supports shift selection or c
"Ergoemacs post-command-hook"
(when ergoemacs-read-input-keys
(if (and mark-active deactivate-mark
- (or (ergoemacs-is-movement-command-p this-command)
- (condition-case err
- (string-match "\\<mark\\>" (symbol-name this-command))
- (error nil))))
+ (or (ergoemacs-is-movement-command-p this-command)
+ (ignore-errors
+ (string-match "\\<mark\\>" (symbol-name this-command)))))
(progn
(setq deactivate-mark nil))))
(let (deactivate-mark)
@@ -767,7 +765,7 @@ This is done by checking if this is a command that supports
shift selection or c
t)
(provide 'ergoemacs-mode)
-
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ergoemacs-mode.el ends here
;; Local Variables:
;; coding: utf-8-emacs
diff --git a/ergoemacs-shortcuts.el b/ergoemacs-shortcuts.el
index f27de3a..513dc03 100644
--- a/ergoemacs-shortcuts.el
+++ b/ergoemacs-shortcuts.el
@@ -573,6 +573,9 @@ It will replace anything defined by `ergoemacs-translation'"
(defvar keyfreq-table)
(declare-function ergoemacs-emulations "ergoemacs-mode.el")
(declare-function ergoemacs-smart-function-p "ergoemacs-model.el")
+(defvar ergoemacs-test-fn nil
+ "Flag to have `ergoemacs-read-key-call' assign the function to
+ this variable.")
(defun ergoemacs-read-key-call (function &optional record-flag keys)
"`ergoemacs-mode' replacement for `call-interactively'.
@@ -597,7 +600,7 @@ In addition, when the function is called:
"
(setq ergoemacs-deactivate-mark nil)
(cond
- ((and (boundp 'ergoemacs-test-fn) ergoemacs-test-fn)
+ (ergoemacs-test-fn
(setq ergoemacs-test-fn function))
(ergoemacs-describe-key
(let ((pt (point))
@@ -1890,3 +1893,6 @@ The keymaps are:
(provide 'ergoemacs-shortcuts)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ergoemacs-shortcuts.el ends here
+;; Local Variables:
+;; coding: utf-8-emacs
+;; End:
diff --git a/ergoemacs-theme-engine.el b/ergoemacs-theme-engine.el
index ed42b69..9382e7f 100644
--- a/ergoemacs-theme-engine.el
+++ b/ergoemacs-theme-engine.el
@@ -2395,3 +2395,6 @@ Ignores DESC."
(provide 'ergoemacs-theme-engine)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ergoemacs-theme-engine.el ends here
+;; Local Variables:
+;; coding: utf-8-emacs
+;; End:
diff --git a/ergoemacs-translate.el b/ergoemacs-translate.el
index 8ba0e83..e377335 100644
--- a/ergoemacs-translate.el
+++ b/ergoemacs-translate.el
@@ -56,7 +56,16 @@
;;; ergoemacs pretty keys
-
+(defvar ergoemacs-shortcut-emulation-mode-map-alist)
+(defvar ergoemacs-no-shortcut-emulation-mode-map-alist)
+(defvar ergoemacs-read-input-keys)
+(defvar ergoemacs-shortcut-keys)
+(defvar ergoemacs-no-shortcut-keys)
+(defvar ergoemacs-modal)
+(defvar ergoemacs-unbind-keys)
+(defvar ergoemacs-emulation-mode-map-alist)
+(defvar ergoemacs-mode)
+(defvar ergoemacs-ignore-advice)
(defvar ergoemacs-display-char-list nil
"List of characters and fonts and if they display or not.")
@@ -555,7 +564,7 @@ This function is made in `ergoemacs-translation' and calls
`ergoemacs-modal-togg
Translates C-A into C-S-a."
(if (not kbd) nil
(let ((ret kbd)
- case-fold-match)
+ case-fold-search)
(unless (string-match
"\\(^<.+>$\\|\\<SPC\\>\\|\\<DEL\\>\\|\\<ESC\\>\\|\\<RET\\>\\|\\<TAB\\>\\)" ret)
(if (string-match "C-" ret)
(when (and (string-match "\\(.\\)$" ret)
@@ -700,120 +709,117 @@ and `ergoemacs-pretty-key' descriptions.
"
(let* ((ret (gethash key ergoemacs-translate-hash))
(orig-key key)
- tmp
case-fold-search
- (key key)
only-key
shift-translated
(ergoemacs-use-ergoemacs-key-descriptions t)
shifted-key
unshifted-key)
- (or ret
- (progn
- (unless (stringp key)
- (setq key (key-description key))
- (setq orig-key key))
- (cond
- ((string-match "\\(^<.+>$\\|SPC\\|DEL\\|ESC\\|RET\\|TAB\\)" key)
- (setq only-key (replace-regexp-in-string "[CMS]-" "" key t))
- (if (string-match "S-" key)
- (setq shifted-key (replace-match "" t nil key))
- (setq shifted-key (concat "S-" key))))
- (t
- (setq only-key (replace-regexp-in-string "^.*\\(.\\)$" "\\1" key t)
- shifted-key (assoc only-key ergoemacs-shifted-assoc))
- (when shifted-key
- (setq shifted-key (cdr shifted-key)))))
- (when (and (string-match "\\([A-Z]\\)$" key)
- (not (string-match
"\\<\\(SPC\\|DEL\\|ESC\\|RET\\|TAB\\)\\>" key)))
- (setq key
- (replace-match
- (concat "S-" (downcase (match-string 1 key))) t t key)))
- (when shifted-key
- (setq unshifted-key only-key)
- (unless (string-match
"\\(^<.+>$\\|\\<SPC\\>\\|\\<DEL\\>\\|\\<ESC\\>\\|\\<RET\\>\\|\\<TAB\\>\\)"
shifted-key)
- (when (string-match "[A-Z]" shifted-key)
- (setq shifted-key (concat "S-" (downcase shifted-key))))
- (when (string-match "[A-Z]" unshifted-key)
- (setq unshifted-key (concat "S-" (downcase unshifted-key))))))
- (when (string-match "S-" key)
- (setq shift-translated (replace-regexp-in-string "S-" "" key t)))
-
- (if shift-translated
- (progn
- (setq ret (plist-put ret ':shift-translated
(ergoemacs-translate-shifted shift-translated)))
- (setq ret (plist-put ret ':shift-translated-key
(read-kbd-macro (ergoemacs-translate-shifted shift-translated) t)))
- (setq ret (plist-put ret ':shift-translated-pretty
(ergoemacs-pretty-key shift-translated))))
- (setq ret (plist-put ret ':shift-translated nil))
- (setq ret (plist-put ret ':shift-translated-key nil))
- (setq ret (plist-put ret ':shift-translated-pretty nil)))
-
- (when shifted-key
- (setq ret (plist-put ret ':shifted (ergoemacs-translate-shifted
shifted-key)))
- (setq ret (plist-put ret ':shifted-key (read-kbd-macro
(ergoemacs-translate-shifted shifted-key) t)))
- (setq ret (plist-put ret ':shifted-pretty (ergoemacs-pretty-key
shifted-key))))
- (when unshifted-key
- (setq ret (plist-put ret ':unshifted (ergoemacs-translate-shifted
unshifted-key)))
- (setq ret (plist-put ret ':unshifted-key (read-kbd-macro
(ergoemacs-translate-shifted unshifted-key) t)))
- (setq ret (plist-put ret ':unshifted-pretty (ergoemacs-pretty-key
unshifted-key))))
- (setq ret (plist-put ret ':ctl (ergoemacs-translate-shifted
- (concat "C-" unshifted-key))))
- (setq ret (plist-put ret ':ctl-key (read-kbd-macro (plist-get ret
':ctl) t)))
- (setq ret (plist-put ret ':ctl-pretty (ergoemacs-pretty-key
(plist-get ret ':ctl))))
-
- (setq ret (plist-put ret ':raw (ergoemacs-translate-shifted
- (replace-regexp-in-string
- "\\<[CSMS]-" "" key))))
- (setq ret (plist-put ret ':raw-key (read-kbd-macro (plist-get ret
':raw) t)))
- (setq ret (plist-put ret ':raw-pretty (ergoemacs-pretty-key
- (plist-get ret ':raw))))
- (if (assoc (plist-get ret ':raw) ergoemacs-shifted-assoc)
- (progn
- (setq ret (plist-put ret ':raw-shift
- (ergoemacs-translate-shifted
+ (if ret ret
+ (unless (stringp key)
+ (setq key (key-description key)
+ orig-key key))
+ (cond
+ ((string-match "\\(^<.+>$\\|SPC\\|DEL\\|ESC\\|RET\\|TAB\\)" key)
+ (setq only-key (replace-regexp-in-string "[CMS]-" "" key t))
+ (if (string-match "S-" key)
+ (setq shifted-key (replace-match "" t nil key))
+ (setq shifted-key (concat "S-" key))))
+ (t
+ (setq only-key (replace-regexp-in-string "^.*\\(.\\)$" "\\1" key t)
+ shifted-key (assoc only-key ergoemacs-shifted-assoc))
+ (when shifted-key
+ (setq shifted-key (cdr shifted-key)))))
+ (when (and (string-match "\\([A-Z]\\)$" key)
+ (not (string-match "\\<\\(SPC\\|DEL\\|ESC\\|RET\\|TAB\\)\\>"
key)))
+ (setq key
+ (replace-match
+ (concat "S-" (downcase (match-string 1 key))) t t key)))
+ (when shifted-key
+ (setq unshifted-key only-key)
+ (unless (string-match
"\\(^<.+>$\\|\\<SPC\\>\\|\\<DEL\\>\\|\\<ESC\\>\\|\\<RET\\>\\|\\<TAB\\>\\)"
shifted-key)
+ (when (string-match "[A-Z]" shifted-key)
+ (setq shifted-key (concat "S-" (downcase shifted-key))))
+ (when (string-match "[A-Z]" unshifted-key)
+ (setq unshifted-key (concat "S-" (downcase unshifted-key))))))
+ (when (string-match "S-" key)
+ (setq shift-translated (replace-regexp-in-string "S-" "" key t)))
+
+ (if shift-translated
+ (progn
+ (setq ret (plist-put ret ':shift-translated
(ergoemacs-translate-shifted shift-translated)))
+ (setq ret (plist-put ret ':shift-translated-key (read-kbd-macro
(ergoemacs-translate-shifted shift-translated) t)))
+ (setq ret (plist-put ret ':shift-translated-pretty
(ergoemacs-pretty-key shift-translated))))
+ (setq ret (plist-put ret ':shift-translated nil))
+ (setq ret (plist-put ret ':shift-translated-key nil))
+ (setq ret (plist-put ret ':shift-translated-pretty nil)))
+
+ (when shifted-key
+ (setq ret (plist-put ret ':shifted (ergoemacs-translate-shifted
shifted-key)))
+ (setq ret (plist-put ret ':shifted-key (read-kbd-macro
(ergoemacs-translate-shifted shifted-key) t)))
+ (setq ret (plist-put ret ':shifted-pretty (ergoemacs-pretty-key
shifted-key))))
+ (when unshifted-key
+ (setq ret (plist-put ret ':unshifted (ergoemacs-translate-shifted
unshifted-key)))
+ (setq ret (plist-put ret ':unshifted-key (read-kbd-macro
(ergoemacs-translate-shifted unshifted-key) t)))
+ (setq ret (plist-put ret ':unshifted-pretty (ergoemacs-pretty-key
unshifted-key))))
+ (setq ret (plist-put ret ':ctl (ergoemacs-translate-shifted
+ (concat "C-" unshifted-key))))
+ (setq ret (plist-put ret ':ctl-key (read-kbd-macro (plist-get ret ':ctl)
t)))
+ (setq ret (plist-put ret ':ctl-pretty (ergoemacs-pretty-key (plist-get
ret ':ctl))))
+
+ (setq ret (plist-put ret ':raw (ergoemacs-translate-shifted
(replace-regexp-in-string
- "\\<[CSM]-" ""
- (cdr (assoc (plist-get ret ':raw)
ergoemacs-shifted-assoc))))))
- (setq ret (plist-put ret ':raw-shift-key
- (read-kbd-macro (plist-get ret
':raw-shift) t)))
- (setq ret (plist-put ret ':raw-shift-pretty
- (ergoemacs-pretty-key
- (plist-get ret ':raw-shift)))))
- (setq ret (plist-put ret ':raw-shift nil))
- (setq ret (plist-put ret ':raw-shift-key nil))
- (setq ret (plist-put ret ':raw-shift-pretty nil)))
-
- (setq ret (plist-put ret ':alt (ergoemacs-translate-shifted
- (concat "M-" unshifted-key))))
- (setq ret (plist-put ret ':alt-key (read-kbd-macro (plist-get ret
':alt) t)))
- (setq ret (plist-put ret ':alt-pretty (ergoemacs-pretty-key
(plist-get ret ':alt))))
-
- (when unshifted-key
- (setq ret (plist-put ret ':alt-ctl (ergoemacs-translate-shifted
- (concat "M-C-"
unshifted-key))))
- (setq ret (plist-put ret ':alt-ctl-key (read-kbd-macro (plist-get
ret ':alt-ctl) t)))
- (setq ret (plist-put ret ':alt-ctl-pretty (ergoemacs-pretty-key
(plist-get ret ':alt-ctl)))))
-
- (when shifted-key
- (setq ret (plist-put ret ':ctl-shift (ergoemacs-translate-shifted
- (concat "C-" shifted-key))))
- (setq ret (plist-put ret ':ctl-shift-key (read-kbd-macro
(plist-get ret ':ctl-shift) t)))
- (setq ret (plist-put ret ':ctl-shift-pretty (ergoemacs-pretty-key
(plist-get ret ':ctl-shift))))
- (setq ret (plist-put ret ':alt-shift (ergoemacs-translate-shifted
- (concat "M-" shifted-key))))
- (setq ret (plist-put ret ':alt-shift-key (read-kbd-macro
(plist-get ret ':alt-shift) t)))
- (setq ret (plist-put ret ':alt-shift-pretty (ergoemacs-pretty-key
(plist-get ret ':alt-shift))))
- (setq ret (plist-put ret ':alt-ctl-shift
(ergoemacs-translate-shifted
- (concat "M-C-"
shifted-key))))
- (setq ret (plist-put ret ':alt-ctl-shift-key (read-kbd-macro
(plist-get ret ':alt-ctl-shift) t)))
- (setq ret (plist-put ret ':alt-ctl-shift-pretty
(ergoemacs-pretty-key (plist-get ret ':alt-ctl-shift)))))
- (maphash
- (lambda(key plist)
- (setq ret (ergoemacs-translation-install plist orig-key ret)))
- ergoemacs-translations)
- (puthash orig-key ret ergoemacs-translate-hash)
- (puthash key ret ergoemacs-translate-hash)
- ret))))
+ "\\<[CSMS]-" "" key))))
+ (setq ret (plist-put ret ':raw-key (read-kbd-macro (plist-get ret
':raw) t)))
+ (setq ret (plist-put ret ':raw-pretty (ergoemacs-pretty-key
+ (plist-get ret ':raw))))
+ (if (assoc (plist-get ret ':raw) ergoemacs-shifted-assoc)
+ (progn
+ (setq ret (plist-put ret ':raw-shift
+ (ergoemacs-translate-shifted
+ (replace-regexp-in-string
+ "\\<[CSM]-" ""
+ (cdr (assoc (plist-get ret ':raw)
ergoemacs-shifted-assoc))))))
+ (setq ret (plist-put ret ':raw-shift-key
+ (read-kbd-macro (plist-get ret ':raw-shift)
t)))
+ (setq ret (plist-put ret ':raw-shift-pretty
+ (ergoemacs-pretty-key
+ (plist-get ret ':raw-shift)))))
+ (setq ret (plist-put ret ':raw-shift nil))
+ (setq ret (plist-put ret ':raw-shift-key nil))
+ (setq ret (plist-put ret ':raw-shift-pretty nil)))
+
+ (setq ret (plist-put ret ':alt (ergoemacs-translate-shifted
+ (concat "M-" unshifted-key))))
+ (setq ret (plist-put ret ':alt-key (read-kbd-macro (plist-get ret ':alt)
t)))
+ (setq ret (plist-put ret ':alt-pretty (ergoemacs-pretty-key (plist-get
ret ':alt))))
+
+ (when unshifted-key
+ (setq ret (plist-put ret ':alt-ctl (ergoemacs-translate-shifted
+ (concat "M-C-" unshifted-key))))
+ (setq ret (plist-put ret ':alt-ctl-key (read-kbd-macro (plist-get ret
':alt-ctl) t)))
+ (setq ret (plist-put ret ':alt-ctl-pretty (ergoemacs-pretty-key
(plist-get ret ':alt-ctl)))))
+
+ (when shifted-key
+ (setq ret (plist-put ret ':ctl-shift (ergoemacs-translate-shifted
+ (concat "C-" shifted-key))))
+ (setq ret (plist-put ret ':ctl-shift-key (read-kbd-macro (plist-get
ret ':ctl-shift) t)))
+ (setq ret (plist-put ret ':ctl-shift-pretty (ergoemacs-pretty-key
(plist-get ret ':ctl-shift))))
+ (setq ret (plist-put ret ':alt-shift (ergoemacs-translate-shifted
+ (concat "M-" shifted-key))))
+ (setq ret (plist-put ret ':alt-shift-key (read-kbd-macro (plist-get
ret ':alt-shift) t)))
+ (setq ret (plist-put ret ':alt-shift-pretty (ergoemacs-pretty-key
(plist-get ret ':alt-shift))))
+ (setq ret (plist-put ret ':alt-ctl-shift (ergoemacs-translate-shifted
+ (concat "M-C-"
shifted-key))))
+ (setq ret (plist-put ret ':alt-ctl-shift-key (read-kbd-macro
(plist-get ret ':alt-ctl-shift) t)))
+ (setq ret (plist-put ret ':alt-ctl-shift-pretty (ergoemacs-pretty-key
(plist-get ret ':alt-ctl-shift)))))
+ (maphash
+ (lambda(key plist)
+ (setq ret (ergoemacs-translation-install plist orig-key ret)))
+ ergoemacs-translations)
+ (puthash orig-key ret ergoemacs-translate-hash)
+ (puthash key ret ergoemacs-translate-hash)
+ ret)))
(defun ergoemacs-setup-translation (layout &optional base-layout)
"Setup translation from BASE-LAYOUT to LAYOUT."
@@ -951,10 +957,8 @@ If JUST-TRANSLATE is non-nil, just return the KBD code,
not the actual emacs key
(replace-regexp-in-string
"\\<\\(ENTER\\|enter\\)\\>" "<return>" new-key t
t)))))
(if (not just-translate)
- (condition-case err
- (read-kbd-macro new-key t)
- (error
- (read-kbd-macro (encode-coding-string new-key
locale-coding-system) t)))
+ (or (ignore-errors (read-kbd-macro new-key t))
+ (read-kbd-macro (encode-coding-string new-key
locale-coding-system) t))
(puthash `(,key ,just-translate ,only-first
,ergoemacs-translation-from ,ergoemacs-translation-to) new-key
ergoemacs-kbd-hash)
new-key))))))
@@ -967,7 +971,7 @@ For example, on dvorak, change C-j to C-c (copy/command)."
:initialize #'custom-initialize-default
:group 'ergoemacs-mode)
-(defun ergoemacs-get-kbd-translation (pre-kbd-code &optional dont-swap)
+(defun ergoemacs-get-kbd-translation (pre-kbd-code)
"This allows a translation from the listed kbd-code and the true kbd code."
(let ((ret (replace-regexp-in-string
"[Cc]\\(?:on\\)?tro?l[+-]" "C-"
@@ -1002,3 +1006,6 @@ Based on `ergoemacs-with-ergoemacs'"
(provide 'ergoemacs-translate)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ergoemacs-translate.el ends here
+;; Local Variables:
+;; coding: utf-8-emacs
+;; End:
diff --git a/ergoemacs-unbind.el b/ergoemacs-unbind.el
index f484046..4cc5463 100644
--- a/ergoemacs-unbind.el
+++ b/ergoemacs-unbind.el
@@ -632,7 +632,7 @@
("M-}" (forward-paragraph))
("M-~" (not-modified))
("RET" (newline)))
- "Default Emacs Key Bindings")
+ "Default Emacs Key Bindings.")
(defvar ergoemacs-single-command-keys)
(defvar ergoemacs-shortcut-keymap)
@@ -643,17 +643,12 @@
(defvar ergoemacs-describe-key)
(declare-function ergoemacs-debug "ergoemacs-mode.el")
(declare-function ergoemacs-real-key-binding "ergoemacs-advices.el" (key
&optional accept-default no-remap position) t)
-(defun ergoemacs-undefined (&optional arg)
- "Ergoemacs Undefined key, tells where to perform the old action."
- (interactive "P")
+(defun ergoemacs-undefined ()
+ "Ergoemacs Undefined key, echo new key for old action."
+ (interactive)
(let* ((key-kbd (or ergoemacs-single-command-keys
(this-single-command-keys)))
- (key (key-description key-kbd))
- (fn (assoc key ergoemacs-emacs-default-bindings))
tmp
- (local-fn nil)
- (last (substring key -1))
- (ergoemacs-where-is-skip t)
- (curr-fn nil))
+ (local-fn nil))
;; Lookup local key, if present and then issue that
;; command instead...
;;
@@ -696,9 +691,7 @@
;; defined there.
(setq local-fn (get-char-property (point) 'local-map))
(if (and local-fn
- (condition-case err
- (keymapp local-fn)
- (error nil)))
+ (ignore-errors (keymapp local-fn)))
(setq local-fn (lookup-key local-fn key-kbd))
(if (current-local-map)
(setq local-fn (lookup-key (current-local-map) key-kbd))
@@ -747,7 +740,7 @@
;;;###autoload
(defun ergoemacs-ignore-prev-global ()
- "Ignores previously defined global keys."
+ "Ignore previously defined global keys."
(setq ergoemacs-emacs-default-bindings
(mapcar
(lambda(elt)
@@ -762,39 +755,15 @@
ergoemacs-emacs-default-bindings))
(ergoemacs-reset-global-where-is))
-
-(defun ergoemacs-format-where-is-buffer (&optional include-menu-bar
include-alias)
- "Format a buffer created from a `where-is' command."
- (when (and (boundp 'fn)
- (eq (nth 0 (nth 1 fn)) 'digit-argument))
- (goto-char (point-min))
- (while (re-search-forward "\\<\\([CMS]-\\)+" nil t)
- (when (and (boundp 'last)
- (not (save-match-data (looking-at last))))
- (replace-match "")
- (delete-char 1)
- (when (looking-at " *, *")
- (replace-match "")))))
- ;; Delete menu entires
- (unless include-menu-bar
- (goto-char (point-min))
- (when (re-search-forward "\\(?:, *\\)?<menu-bar>.*\\([(,]\\)" nil t)
- (replace-match "\\1")))
- ;; Reformat aliases
- (unless include-alias
- (goto-char (point-min))
- (when (re-search-forward " *([^)]*);\n.*alias *" nil t)
- (replace-match ""))))
-
(defun ergoemacs-translate-current-key (key)
- "Translate the current key."
+ "Translate the current KEY."
(cond
((string= (key-description key) "<backspace>")
(read-kbd-macro "DEL" t))
(t key)))
(defun ergoemacs-translate-current-function (curr-fn)
- "Translate the current function"
+ "Translate the current function CURR-FN."
(cond
((eq 'delete-horizontal-space curr-fn)
'ergoemacs-shrink-whitespaces)
@@ -836,11 +805,10 @@ This should only be run when no global keys have been set.
((eq (type-of key) 'string)
(if is-variable
(ergoemacs-kbd key)
- (condition-case err
- (read-kbd-macro key)
- (error (read-kbd-macro
- (encode-coding-string
- key locale-coding-system))))))
+ (or (ignore-errors (read-kbd-macro key))
+ (read-kbd-macro
+ (encode-coding-string
+ key locale-coding-system)))))
(t key)))
(key-kbd (key-description key-code)))
(if (string-match "\\(mouse\\|wheel\\)" key-kbd)
@@ -850,9 +818,7 @@ This should only be run when no global keys have been set.
(when (or fix complain)
(let* ((key-function (lookup-key (current-global-map) key-code
t))
(old-bindings (assoc key-kbd
ergoemacs-emacs-default-bindings))
- (trans-function (if (condition-case err
- (keymapp key-function)
- (error nil))
+ (trans-function (if (ignore-errors (keymapp key-function))
'prefix
key-function)))
(message "Warning %s has been set globally. It is bound to %s
not in %s." key-kbd
@@ -862,9 +828,7 @@ This should only be run when no global keys have been set.
nil
(let* ((key-function (lookup-key (current-global-map) key-code t))
(old-bindings (assoc key-kbd
ergoemacs-emacs-default-bindings))
- (trans-function (if (condition-case err
- (keymapp key-function)
- (error nil))
+ (trans-function (if (ignore-errors (keymapp key-function))
'prefix
key-function))
(has-changed nil))
@@ -878,11 +842,9 @@ This should only be run when no global keys have been set.
(while (< i trans-function)
(aset prefix-vector i (elt key-as-vector i))
(setq i (+ 1 i)))
- (unless (condition-case err ; If it is a prefix vector,
- ; assume not globally
- ; changed
- (keymapp (lookup-key (current-global-map)
prefix-vector))
- (error nil))
+ ;; If it is a prefix vector, assume not globally
+ ;; changed
+ (unless (ignore-errors (keymapp (lookup-key
(current-global-map) prefix-vector)))
;; Not a prefix, see if the key had actually changed
;; by recursively calling `ergoemacs-global-changed-p'
(setq has-changed
@@ -912,20 +874,21 @@ This should only be run when no global keys have been set.
"Warns about globally changed keys. If FIX is true, fix the ergoemacs-unbind
file."
(interactive)
(dolist (x ergoemacs-emacs-default-bindings)
- (ergoemacs-global-changed-p (nth 0 x) nil t t))
+ (ergoemacs-global-changed-p (nth 0 x) nil t fix))
(message "Ergoemacs Keys warnings for this layout:")
(dolist (x (symbol-value (ergoemacs-get-fixed-layout)))
(and (eq 'string (type-of (nth 0 x)))
- (ergoemacs-global-changed-p (nth 0 x) nil t t)))
+ (ergoemacs-global-changed-p (nth 0 x) nil t fix)))
(dolist (x (symbol-value (ergoemacs-get-variable-layout)))
(and (eq 'string (type-of (nth 0 x)))
- (ergoemacs-global-changed-p (nth 0 x) t t))))
+ (ergoemacs-global-changed-p (nth 0 x) t t fix))))
;; Based on describe-key-briefly
(declare-function ergoemacs-key-fn-lookup "ergoemacs-translate.el")
(declare-function ergoemacs-pretty-key "ergoemacs-translate.el")
+(defvar yank-menu)
(defun ergoemacs-where-is-old-binding (&optional key only-new-key)
"Print the name of the function KEY invoked before to start ErgoEmacs minor
mode."
(interactive
- [elpa] 20/35: Make Open Last Closed show Ctl+Shift+T, (continued)
- [elpa] 20/35: Make Open Last Closed show Ctl+Shift+T, Matthew Fidler, 2014/07/11
- [elpa] 16/35: Add open last closed to recentf menu, Matthew Fidler, 2014/07/11
- [elpa] 19/35: More accessible printer setup (Issue #236 and #235), Matthew Fidler, 2014/07/11
- [elpa] 17/35: Add Scroll up/down command for other window, Matthew Fidler, 2014/07/11
- [elpa] 09/35: Change startup messages, Matthew Fidler, 2014/07/11
- [elpa] 21/35: Add load path to batch byte compile, Matthew Fidler, 2014/07/11
- [elpa] 22/35: Fix byte compile warning, Matthew Fidler, 2014/07/11
- [elpa] 23/35: Start modal shift-select (Issue #215), Matthew Fidler, 2014/07/11
- [elpa] 24/35: Fix keys on web-page, Matthew Fidler, 2014/07/11
- [elpa] 18/35: Fix Issue #270, Matthew Fidler, 2014/07/11
- [elpa] 15/35: Misc Code Cleanup,
Matthew Fidler <=
- [elpa] 27/35: Use pr-interface when available, Matthew Fidler, 2014/07/11
- [elpa] 25/35: Fix Issue #271, Matthew Fidler, 2014/07/11
- [elpa] 26/35: Should display the correct key now., Matthew Fidler, 2014/07/11
- [elpa] 28/35: Another attempt to fix the webpage, Matthew Fidler, 2014/07/11
- [elpa] 30/35: Delete Frame/Close Emacs for Alt+f4, Matthew Fidler, 2014/07/11
- [elpa] 29/35: Fix webpage (tested works), Matthew Fidler, 2014/07/11
- [elpa] 32/35: browse-kill-ring-mode no longer needs work-around, Matthew Fidler, 2014/07/11
- [elpa] 31/35: ergoemacs-keyboard-quit calls 【q】 when applicable, Matthew Fidler, 2014/07/11
- [elpa] 35/35: v5.14.7.2 - Removed ergoemacs-pushnew, and use add-to-list for variables that are defined with defvar (Allows work-around of calling adjoin at runtime for emacs 24.1; Thaks to Stefan Monnier for pointing this out). - Expanded ã€ESC】 to exit modes that use ã€q】 for quitting the current operation. This includes many packages like magit and browse-kill-ring. - Expanded ã€Alt+f4】 to close the current frame when it is the only frame present. - Added Recent files menu that includes Open Last Closed ã€Ctl+⇧Shift+T】. - Changed ergoemacs-mode printing to use printing package when available. The file-menu has been replaced - The default theme is now selected automatically (Issue #269) - Show goto-line as ã€Ctl+L】, although the test doesn't work (Issue #265) - Added an option to move lines up and down with ã€Alt+up】, ã€Alt+down】 like Gedit (See #266) - Changed the emacs startup messages to reflect emacs keys (#267) - Other miscellaneous cleanups and fixes, Matthew Fidler, 2014/07/11
- [elpa] 34/35: The translations will fail :(, Matthew Fidler, 2014/07/11