emacs-devel
[Top][All Lists]
Advanced

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

Re: APL mode


From: Rustom Mody
Subject: Re: APL mode
Date: Mon, 14 Oct 2013 12:15:37 +0530

Ive made the earlier code standalone-executable (without rest of
apl.el) and more readable.
Once the following code is executed, f8 and f9 should work as prefixes
for entering Apl characters, irrespective of mode.
----------------------------------------

;; Following 2 lines needed for the rest to work
;; Assumed defined elsewhere (apl.el)
(defvar apl-mode-map (make-sparse-keymap))
(use-local-map apl-mode-map)


;; Data Structure representing keyboard with APL layout
;; Keys separated from its  neighbour by a ¶
;; Each key is a triplet of 3 characters:
;; 1st is the usual key as seen on a normal keyboard
;; 2nd and 3rd are APL specific variants

(setq apl-keyboard '(

;; top (number) row
"`◊⍨¶1¨¡¶2¯€¶3<£¶4≤⍧¶5= ¶6≥ ¶7> ¶8≠⍂¶9∨⍱¶0∧⍲¶-×≡¶=÷⌹"

;; qwertyuiop row
"q?¿¶w⍵⌽¶e∈⍷¶r⍴ ¶t∼⍉¶y↑¥¶u↓ ¶i⍳⍸¶o○⍥¶p⋆⍟¶[← ¶]→ "

;; asdfghjkl row
"a⍺⊖¶s⌈ ¶d⌊ ¶f_⍫¶g∇⍒¶h∆⍋¶j∘⍤¶k'⌺¶l⎕⍞¶;⊢ ¶'⊣ "

;; zxcvbnm row
"z⊂ ¶x⊃ ¶c∩⍝¶v∪ ¶b⊥⍎¶n⊤⍕¶m|⌶¶,⌷⍪¶.⍎⍙¶/⍕⌿"

))


(setq apl-map1 (make-sparse-keymap))
(define-key apl-mode-map (kbd "<f8>") apl-map1)
(setq apl-map2 (make-sparse-keymap))
(define-key apl-mode-map (kbd "<f9>") apl-map2)

(dolist (line apl-keyboard)
  (dolist (key (split-string line "¶"))
    (let ((kb-key   (string (aref key 0)))
      (apl-key1 (string (aref key 1)))
      (apl-key2 (string (aref key 2))))
      (define-key apl-map1 kb-key apl-key1)
      (define-key apl-map2 kb-key apl-key2)))
)



reply via email to

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