aboutsummaryrefslogtreecommitdiff
path: root/tamil99.el
diff options
context:
space:
mode:
authorArun Isaac2022-08-14 00:12:18 +0530
committerArun Isaac2022-08-14 00:16:54 +0530
commit2f5032ea5d4d7073c1c7e8f5437e4a0eaa4a05a1 (patch)
tree5b863053ce3f6977bd67a41fc33e5b809b3d089f /tamil99.el
downloadtamil99-2f5032ea5d4d7073c1c7e8f5437e4a0eaa4a05a1.tar.gz
tamil99-2f5032ea5d4d7073c1c7e8f5437e4a0eaa4a05a1.tar.lz
tamil99-2f5032ea5d4d7073c1c7e8f5437e4a0eaa4a05a1.zip
Initial commit
Diffstat (limited to 'tamil99.el')
-rw-r--r--tamil99.el203
1 files changed, 203 insertions, 0 deletions
diff --git a/tamil99.el b/tamil99.el
new file mode 100644
index 0000000..7b95316
--- /dev/null
+++ b/tamil99.el
@@ -0,0 +1,203 @@
+;;; tamil99.el --- Tamil99 input method -*- lexical-binding: t -*-
+
+;; Tamil99 input method for Emacs
+;; Copyright (C) 2022 Arun Isaac
+;;
+;; Author: Arun Isaac <arunisaac@systemreboot.net>
+;; Version: 0.1.0
+;; Keywords: abbrev, convenience, i18n
+;; Homepage: https://git.systemreboot.net/tamil99
+;; Package-Requires: ((emacs "25.1"))
+
+;; This file is part of tamil99.
+
+;; tamil99 is free software: you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; tamil99 is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with tamil99. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+;;
+;; tamil99 is an implementation of the tamil99 input method for Emacs.
+;;
+;; Usage:
+;;
+;; Switch to the tamil99 input method using
+;;
+;; M-x set-input-method tamil99 RET
+;;
+;; Enjoy typing in Tamil!
+;;
+;; tamil99 Emacs தொகுப்பிக்கு tamil99 உள்ளீட்டு முறையை அளிப்பது.
+;;
+;; பயன்பாடு:
+;;
+;; tamil99 உள்ளீட்டு முறைக்கு மாற
+;;
+;; M-x set-input-method tamil99 RET
+;;
+;; தமிழில் தட்டச்சிட்டு மகிழ்க!
+
+;;; Code:
+
+(require 'quail)
+
+(quail-define-package
+ "tamil99" "Tamil" "tamil99"
+ t "Tamil99 input method")
+
+(defconst tamil99-vowels
+ '(("q" "ஆ")
+ ("w" "ஈ")
+ ("e" "ஊ")
+ ("r" "ஐ")
+ ("t" "ஏ")
+ ("a" "அ")
+ ("s" "இ")
+ ("d" "உ")
+ ("g" "எ")
+ ("z" "ஔ")
+ ("x" "ஓ")
+ ("c" "ஒ"))
+ "Mapping for vowels.")
+
+(defconst tamil99-vowel-modifiers
+ '(("q" "ா")
+ ("w" "ீ")
+ ("e" "ூ")
+ ("r" "ை")
+ ("t" "ே")
+ ("a" "")
+ ("s" "ி")
+ ("d" "ு")
+ ("g" "ெ")
+ ("z" "ௌ")
+ ("x" "ோ")
+ ("c" "ொ")
+ ("f" "்"))
+ "Mapping for vowel modifiers.")
+
+(defconst tamil99-vallinam-consonants
+ '(("h" "க")
+ ("[" "ச")
+ ("o" "ட")
+ ("l" "த")
+ ("j" "ப")
+ ("u" "ற"))
+ "Mapping for vallinam consonants.")
+
+(defconst tamil99-mellinam-consonants
+ '(("b" "ங")
+ ("]" "ஞ")
+ ("p" "ண")
+ (";" "ந")
+ ("k" "ம")
+ ("i" "ன"))
+ "Mapping for mellinam consonants.")
+
+(defconst tamil99-idaiinam-consonants
+ '(("'" "ய")
+ ("m" "ர")
+ ("n" "ல")
+ ("v" "வ")
+ ("/" "ழ")
+ ("y" "ள"))
+ "Mapping for idaiinam consonants.")
+
+(defconst tamil99-grantham-consonants
+ '(("Q" "ஸ")
+ ("W" "ஷ")
+ ("E" "ஜ")
+ ("R" "ஹ"))
+ "Mapping for grantham consonants.")
+
+(defconst tamil99-consonants
+ (append tamil99-vallinam-consonants
+ tamil99-mellinam-consonants
+ tamil99-idaiinam-consonants
+ tamil99-grantham-consonants)
+ "Mapping for all consonants.")
+
+(defconst tamil99-other
+ `(("T" ,(vector "க்ஷ"))
+ ("Y" ,(vector "ஶஂரீ"))
+ ("O" "[")
+ ("P" "]")
+ ("[" "{")
+ ("]" "}")
+ ("A" "௹")
+ ("S" "௺")
+ ("D" "௸")
+ ("F" "ஃ")
+ ("K" "\"")
+ ("L" ":")
+ (":" ";")
+ ("\"" "'")
+ ("Z" "௳")
+ ("X" "௴")
+ ("C" "௵")
+ ("V" "௶")
+ ("B" "௷")
+ ("M" "/"))
+ "Mapping for miscellaneous characters.")
+
+(defun tamil99-install ()
+ "Install tamil99 input method."
+ (quail-define-rules)
+ ;; உயிர்
+ ;; vowel
+ (mapc (pcase-lambda (`(,vowel-key ,vowel))
+ (quail-defrule vowel-key vowel))
+ tamil99-vowels)
+ (mapc (pcase-lambda (`(,consonant-key ,consonant))
+ ;; அகர உயிர்மெய்
+ ;; consonant with agaram (அ)
+ (quail-defrule consonant-key consonant)
+ ;; மெய்யொற்று பின் அகர உயிர்மெய்
+ ;; pulli on double consonant
+ (quail-defrule (concat consonant-key consonant-key)
+ (vector (concat consonant "்" consonant)))
+ (mapc (pcase-lambda (`(,vowel-key ,vowel-modifier))
+ ;; உயிர்மெய்
+ ;; vowel+consonant
+ (quail-defrule (concat consonant-key vowel-key)
+ (vector (concat consonant vowel-modifier)))
+ ;; மெய்யொற்று பின் உயிர்மெய்
+ ;; vowel+consonant after double consonant
+ (quail-defrule (concat consonant-key consonant-key vowel-key)
+ (vector (concat consonant "்" consonant vowel-modifier))))
+ tamil99-vowel-modifiers))
+ tamil99-consonants)
+ (seq-mapn (pcase-lambda (`(,mellinam-consonant-key ,mellinam-consonant)
+ `(,vallinam-consonant-key ,vallinam-consonant))
+ ;; மெல்லினம் பின் வல்லினம்
+ ;; vallinam after mellinam
+ (quail-defrule (concat mellinam-consonant-key vallinam-consonant-key)
+ (vector (concat mellinam-consonant "்" vallinam-consonant)))
+ (mapc (pcase-lambda (`(,vowel-key ,vowel-modifier))
+ ;; மெல்லின ஒற்றொட்டிய வல்லினம் பின் உயிர்மெய்
+ ;; vowel+consonant after mellinam-vallinam consonant
+ (quail-defrule (concat mellinam-consonant-key vallinam-consonant-key vowel-key)
+ (vector (concat mellinam-consonant "்" vallinam-consonant vowel-modifier))))
+ tamil99-vowel-modifiers))
+ tamil99-mellinam-consonants
+ tamil99-vallinam-consonants)
+ ;; பிற வரியுருக்கள்
+ ;; other characters
+ (mapc (pcase-lambda (`(,key ,translation))
+ (quail-defrule key translation))
+ tamil99-other))
+
+(tamil99-install)
+
+(provide 'tamil99)
+
+;;; tamil99.el ends here