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

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

[elpa] 07/15: Allow short symbols to represent keys


From: Matthew Fidler
Subject: [elpa] 07/15: Allow short symbols to represent keys
Date: Sun, 06 Jul 2014 03:56:17 +0000

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

commit 240c7cf95a2a6c651f110e8efc239dda66eff51c
Author: Matthew L. Fidler <address@hidden>
Date:   Thu Jul 3 11:56:06 2014 -0500

    Allow short symbols to represent keys
---
 ergoemacs-translate.el |   30 ++++++++++++++++++++++++++----
 1 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/ergoemacs-translate.el b/ergoemacs-translate.el
index 4aca702..781914f 100644
--- a/ergoemacs-translate.el
+++ b/ergoemacs-translate.el
@@ -115,6 +115,12 @@ This assumes `ergoemacs-use-unicode-char' is non-nil.  When
   :type 'boolean
   :group 'ergoemacs-mode)
 
+;; FIXME: invalidate/fix cache when changing.
+(defcustom ergoemacs-use-small-symbols nil
+  "Use small symbols to represent alt+ ctl+ etc. on windows/linux."
+  :type 'boolean
+  :group 'ergoemacs-mode)
+
 (defvar ergoemacs-use-M-x-p nil)
 
 (defvar ergoemacs-M-x)
@@ -208,10 +214,11 @@ This assumes `ergoemacs-use-unicode-char' is non-nil.  
When
             (goto-char (point-min))
             (while (re-search-forward "[+]\\([[:lower:]]\\)\\(】\\|\\]\\)" nil 
t)
               (replace-match (upcase (match-string 0)) t t))
-            (when (and (eq system-type 'darwin)
-                       (string= "⇧" (ergoemacs-unicode-char "⇧" ""))
-                       (string= "⌘" (ergoemacs-unicode-char "⌘" ""))
-                       (string= "⌥" (ergoemacs-unicode-char "⌥" "")))
+            (cond
+             ((and (eq system-type 'darwin)
+                   (string= "⇧" (ergoemacs-unicode-char "⇧" ""))
+                   (string= "⌘" (ergoemacs-unicode-char "⌘" ""))
+                   (string= "⌥" (ergoemacs-unicode-char "⌥" "")))
               (goto-char (point-min))
               (while (re-search-forward ".Opt[+]" nil t)
                 (replace-match "⌥"))
@@ -224,6 +231,21 @@ This assumes `ergoemacs-use-unicode-char' is non-nil.  When
               (goto-char (point-min))
               (while (re-search-forward "Ctl[+]" nil t)
                 (replace-match "^")))
+             ((and ergoemacs-use-small-symbols
+                   (string= "⇧" (ergoemacs-unicode-char "⇧" ""))
+                   (string= "♦" (ergoemacs-unicode-char "♦" "")))
+              (goto-char (point-min))
+              (while (re-search-forward ".Alt[+]" nil t)
+                (replace-match "♦"))
+              (goto-char (point-min))
+              (while (re-search-forward ".Shift[+]" nil t)
+                (replace-match "⇧"))
+              (goto-char (point-min))
+              (while (re-search-forward "Ctl[+]" nil t)
+                (replace-match "^"))))
+            (goto-char (point-min))
+            (unless (looking-at (regexp-quote ob))
+              (insert ob))
             (setq ret (buffer-string)))))
       ret))))
 



reply via email to

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