[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 20/117: Add left/right to pretty key descriptions
From: |
Matthew Fidler |
Subject: |
[elpa] 20/117: Add left/right to pretty key descriptions |
Date: |
Fri, 25 Jul 2014 13:23:56 +0000 |
mlf176f2 pushed a commit to branch externals/ergoemacs-mode
in repository elpa.
commit 0ef52ce4ca71fc3c33ecf0e5e04bdc48e9dc7472
Author: Matthew L. Fidler <address@hidden>
Date: Tue Jul 15 13:09:12 2014 -0500
Add left/right to pretty key descriptions
---
ergoemacs-translate.el | 175 ++++++++++++++++++++++++++----------------------
1 files changed, 94 insertions(+), 81 deletions(-)
diff --git a/ergoemacs-translate.el b/ergoemacs-translate.el
index b7dc65c..13b036a 100644
--- a/ergoemacs-translate.el
+++ b/ergoemacs-translate.el
@@ -134,91 +134,104 @@ This assumes `ergoemacs-use-unicode-char' is non-nil.
When
(if ergoemacs-use-M-x-p
code
(replace-match ergoemacs-M-x t t code))
- (let* ((ob (or (and ergoemacs-use-unicode-brackets
(ergoemacs-unicode-char "【" "[")) "["))
- (cb (or (and ergoemacs-use-unicode-brackets
(ergoemacs-unicode-char "】" "]")) "]"))
- (ret (concat ob (replace-regexp-in-string
- " +$" "" (replace-regexp-in-string "^ +" ""
code)) cb))
- (case-fold-search nil)
- (pt 0))
- (when ergoemacs-use-ergoemacs-key-descriptions
- (while (string-match "<f\\([0-9]+\\)>" ret pt)
- (setq ret (replace-match "<F\\1>" t nil ret)
- pt (match-end 0)))
- (setq pt 0)
- (while (string-match "\\(-[A-Z]\\)\\>\\([^-]\\|$\\)" ret pt)
- (setq pt (+ (match-end 0) 2)
- ret (replace-match (format "-S%s%s" (downcase (match-string
1 ret)) (match-string 2 ret)) t t ret)))
- (setq pt 0)
- (while (string-match "\\_<[A-Z]\\_>" ret pt)
- (setq pt (+ (match-end 0) 2)
- ret (replace-match (format "S-%s" (match-string 0 ret)) t t
ret)))
- (setq pt 0)
- (while (string-match "\\(S-\\)\\{2,\\}" ret pt)
- (setq pt (+ (match-beginning 0) 2)
- ret (replace-match "S-" t t ret)))
- (dolist (args `(("\\<M-" ,(if (eq system-type 'darwin)
- (cond
- ((or (and (boundp
'mac-command-modifier)
- (eq mac-command-modifier
'meta))
- (and (boundp 'ns-command-modifier)
- (eq ns-command-modifier
'meta)))
- (format "%sCmd+"
- (ergoemacs-unicode-char "⌘"
"")))
- ((or (and (boundp
'mac-alternate-modifier)
- (eq mac-alternate-modifier
'meta))
- (and (boundp
'ns-alternate-modifier)
- (eq ns-alternate-modifier
'meta)))
- (format "%sOpt+"
- (ergoemacs-unicode-char "⌥"
"")))
- (t "Alt+"))
- "Alt+"))
- ("\\<C-" "Ctrl+")
- ("\\<S-" ,(format "%sShift+"
- (ergoemacs-unicode-char "⇧" "")))
- ("[<>]" "")
- ("\\<\\(RET\\|[Rr]eturn\\)\\>" ,(format "Enter%s"
-
(ergoemacs-unicode-char "⏎" "")))
- ("\\<TAB\\>" ,(format "%sTab"
- (ergoemacs-unicode-char "↹"
"")))
- ("\\_<\\(menu\\|apps\\)\\_>" ,(format "%s"
-
(ergoemacs-unicode-char "▤" "Menu")))
- ("\\_<prior\\_>" "PgUp")
- ("\\_<next\\_>" "PgDn")
- (" +" ,(concat cb ob))
- (,(regexp-quote (concat cb " +" ob)) ,(concat cb
ob))))
+ (save-match-data
+ (let* ((ob (or (and ergoemacs-use-unicode-brackets
(ergoemacs-unicode-char "【" "[")) "["))
+ (cb (or (and ergoemacs-use-unicode-brackets
(ergoemacs-unicode-char "】" "]")) "]"))
+ (ret (concat ob (replace-regexp-in-string
+ " +$" "" (replace-regexp-in-string "^ +" ""
code)) cb))
+ (case-fold-search nil)
+ (pt 0))
+ (when ergoemacs-use-ergoemacs-key-descriptions
+ (while (string-match "<f\\([0-9]+\\)>" ret pt)
+ (setq ret (replace-match "<F\\1>" t nil ret)
+ pt (match-end 0)))
(setq pt 0)
- (while (string-match (nth 0 args) ret pt)
- (setq pt (+ (length (nth 1 args)) (match-beginning 0))
- ret (replace-match (nth 1 args) t t ret))))
- (setq pt 0)
- (while (string-match "[+]\\([[:lower:]]\\)\\(】\\|\\]\\)" ret pt)
- (setq ret (replace-match (upcase (match-string 0 ret)) t t ret)
- pt (match-end 0)))
- (setq pt 0)
- (cond
- ((and (eq system-type 'darwin)
- (string= "⇧" (ergoemacs-unicode-char "⇧" ""))
- (string= "⌘" (ergoemacs-unicode-char "⌘" ""))
- (string= "⌥" (ergoemacs-unicode-char "⌥" "")))
- (dolist (args `((".Opt[+]" "⌥")
- (".Cmd[+]" "⌘")
- (".Shift[+]" "⇧")
- (".Ctr?l[+]" "^")))
- (setq pt 0)
- (while (string-match (nth 0 args) ret pt)
- (setq pt (+ (length (nth 1 args)) (match-beginning 0))
- ret (replace-match (nth 1 args) t t ret)))))
- ((and ergoemacs-use-small-symbols
- (string= "⇧" (ergoemacs-unicode-char "⇧" ""))
- (string= "♦" (ergoemacs-unicode-char "♦" "")))
- (dolist (args `((".Alt[+]" "♦")
- (".Shift[+]" "⇧")
- (".Ctr?l[+]" "^")))
+ (while (string-match "\\(-[A-Z]\\)\\>\\([^-]\\|$\\)" ret pt)
+ (setq pt (+ (match-end 0) 2)
+ ret (replace-match (format "-S%s%s" (downcase
(match-string 1 ret)) (match-string 2 ret)) t t ret)))
+ (setq pt 0)
+ (while (string-match "\\_<[A-Z]\\_>" ret pt)
+ (setq pt (+ (match-end 0) 2)
+ ret (replace-match (format "S-%s" (match-string 0 ret)) t
t ret)))
+ (setq pt 0)
+ (while (string-match "\\(S-\\)\\{2,\\}" ret pt)
+ (setq pt (+ (match-beginning 0) 2)
+ ret (replace-match "S-" t t ret)))
+ (setq pt 0)
+ (while (string-match "<\\(\\(?:C-\\|S-\\|M-\\)?[A-Za-z0-9]+\\)>"
ret pt)
+ (setq pt (- (match-end 0) 2)
+ ret (replace-match (match-string 1 ret) t t ret)))
+ (dolist (args `(("\\<M-" ,(if (eq system-type 'darwin)
+ (cond
+ ((or (and (boundp
'mac-command-modifier)
+ (eq mac-command-modifier
'meta))
+ (and (boundp
'ns-command-modifier)
+ (eq ns-command-modifier
'meta)))
+ (format "%sCmd+"
+ (ergoemacs-unicode-char
"⌘" "")))
+ ((or (and (boundp
'mac-alternate-modifier)
+ (eq
mac-alternate-modifier 'meta))
+ (and (boundp
'ns-alternate-modifier)
+ (eq ns-alternate-modifier
'meta)))
+ (format "%sOpt+"
+ (ergoemacs-unicode-char
"⌥" "")))
+ (t "Alt+"))
+ "Alt+"))
+ ("\\<C-" "Ctrl+")
+ ("\\<S-" ,(format "%sShift+"
+ (ergoemacs-unicode-char "⇧" "")))
+ ("\\<\\(RET\\|[Rr]eturn\\)\\>" ,(format "Enter%s"
+
(ergoemacs-unicode-char "⏎" "")))
+ ("\\<TAB\\>" ,(format "%sTab"
+ (ergoemacs-unicode-char "↹"
"")))
+ ("\\_<\\(menu\\|apps\\)\\_>" ,(format "%s"
+
(ergoemacs-unicode-char "▤" "Menu")))
+ ("\\_<prior\\_>" "PgUp")
+ ("\\_<next\\_>" "PgDn")
+ ("\\_<left\\_>" ,(ergoemacs-unicode-char "←"
"left"))
+ ("\\_<right\\_>" ,(ergoemacs-unicode-char "→"
"right"))
+ ("\\_<up\\_>" ,(ergoemacs-unicode-char "↑" "up"))
+ ("\\_<down\\_>" ,(ergoemacs-unicode-char "↓"
"down"))
+
+ ("+left\\_>" ,(concat "+" (ergoemacs-unicode-char
"←" "left")))
+ ("+right\\_>" ,(concat "+" (ergoemacs-unicode-char
"→" "right")))
+ ("+up\\_>" ,(concat "+" (ergoemacs-unicode-char
"↑" "up")))
+ ("+down\\_>" ,(concat "+" (ergoemacs-unicode-char
"↓" "down")))
+ (" +" ,(concat cb ob))
+ (,(regexp-quote (concat cb " +" ob)) ,(concat cb
ob))))
(setq pt 0)
(while (string-match (nth 0 args) ret pt)
(setq pt (+ (length (nth 1 args)) (match-beginning 0))
- ret (replace-match (nth 1 args) t t ret)))))))
- ret))))
+ ret (replace-match (nth 1 args) t t ret))))
+ (setq pt 0)
+ (while (string-match "[+]\\([[:lower:]]\\)\\(】\\|\\]\\)" ret pt)
+ (setq ret (replace-match (upcase (match-string 0 ret)) t t ret)
+ pt (match-end 0)))
+ (setq pt 0)
+ (cond
+ ((and (eq system-type 'darwin)
+ (string= "⇧" (ergoemacs-unicode-char "⇧" ""))
+ (string= "⌘" (ergoemacs-unicode-char "⌘" ""))
+ (string= "⌥" (ergoemacs-unicode-char "⌥" "")))
+ (dolist (args `((".Opt[+]" "⌥")
+ (".Cmd[+]" "⌘")
+ (".Shift[+]" "⇧")
+ (".Ctr?l[+]" "^")))
+ (setq pt 0)
+ (while (string-match (nth 0 args) ret pt)
+ (setq pt (+ (length (nth 1 args)) (match-beginning 0))
+ ret (replace-match (nth 1 args) t t ret)))))
+ ((and ergoemacs-use-small-symbols
+ (string= "⇧" (ergoemacs-unicode-char "⇧" ""))
+ (string= "♦" (ergoemacs-unicode-char "♦" "")))
+ (dolist (args `((".Alt[+]" "♦")
+ (".Shift[+]" "⇧")
+ (".Ctr?l[+]" "^")))
+ (setq pt 0)
+ (while (string-match (nth 0 args) ret pt)
+ (setq pt (+ (length (nth 1 args)) (match-beginning 0))
+ ret (replace-match (nth 1 args) t t ret)))))))
+ ret)))))
- [elpa] 11/117: Fix Variable binding byte compile warnings, (continued)
- [elpa] 11/117: Fix Variable binding byte compile warnings, Matthew Fidler, 2014/07/25
- [elpa] 12/117: Lexical binding for ergoemacs-macros, Matthew Fidler, 2014/07/25
- [elpa] 10/117: Lexical binding for ergoemacs-theme-engine, Matthew Fidler, 2014/07/25
- [elpa] 15/117: Don't exit if region is active., Matthew Fidler, 2014/07/25
- [elpa] 16/117: Advise describe-buffer-bindings, Matthew Fidler, 2014/07/25
- [elpa] 06/117: Lexical binding for ergoemacs-layouts., Matthew Fidler, 2014/07/25
- [elpa] 18/117: Use save-match-data with ergoemacs-pretty-key, Matthew Fidler, 2014/07/25
- [elpa] 13/117: Remove pop dependence, Matthew Fidler, 2014/07/25
- [elpa] 17/117: Add rudimentary guide-key support; F1/C-h activates guide-key, Matthew Fidler, 2014/07/25
- [elpa] 14/117: Attempt Lexical Scoping for ergoemacs-translate.el, Matthew Fidler, 2014/07/25
- [elpa] 20/117: Add left/right to pretty key descriptions,
Matthew Fidler <=
- [elpa] 19/117: Pretty key cleanup, Matthew Fidler, 2014/07/25
- [elpa] 22/117: Fix guide-key-mode requirement, Matthew Fidler, 2014/07/25
- [elpa] 24/117: Comment ergoemacs-substitute-command-keys, Matthew Fidler, 2014/07/25
- [elpa] 21/117: Better guide-key support, Matthew Fidler, 2014/07/25
- [elpa] 25/117: Add command prompt here and powershell here, Matthew Fidler, 2014/07/25
- [elpa] 23/117: Fix (substitute-command-keys "\\[recover-session]"), Matthew Fidler, 2014/07/25
- [elpa] 27/117: Fix recursive loading in ergoemacs-mode source, Matthew Fidler, 2014/07/25
- [elpa] 30/117: Declare w32-long-file-name, Matthew Fidler, 2014/07/25
- [elpa] 29/117: Cleanup byte compile, Matthew Fidler, 2014/07/25
- [elpa] 31/117: More emcompassing shell prompt regexp, Matthew Fidler, 2014/07/25