* bug#74170: [PATCH] Add input methods for Northern Iroquoian languages
@ 2024-11-02 2:34 Kierin Bell
0 siblings, 0 replies; only message in thread
From: Kierin Bell @ 2024-11-02 2:34 UTC (permalink / raw)
To: 74170
[-- Attachment #1: Type: text/plain, Size: 1669 bytes --]
Tags: patch
Hello,
Attached is a patch implementing input methods for five languages in the
Northern Iroquoian language family.
None of these languages have have officially designated standardized
orthographies (and all of them are endangered), but I have designed the
input methods around what I believe to be the most widely used community
orthographies (used in language programs, dictionaries, etc).
The orthographies for several of the languages require, for example, the
ability to enter a given vowel X, X with a diacritic Y, X with both
diacritics Y and Z, etc. Oneida even requires the ability to underline
consecutive characters --- I implement this with COMBINING LOW LINE,
even though in practice users may opt to use something else, like
markup, for this.
Because of this complexity, I decided to use state transition tables
(with `quail-map-from-table') and a custom UPDATE-TRANSLATION-FUNCTION.
The result works nicely, but I don't understand all of the intricacies
and conventions of Quail and am open to any suggestions for improvement.
I should already have FSF copyright assignment on file.
Regards,
Kierin
In GNU Emacs 30.0.91 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.41, cairo version 1.18.0)
System Description: Guix System
Configured using:
'configure
CONFIG_SHELL=/gnu/store/3jhfhxdf6v5ms10x5zmnl166dh3yhbr1-bash-minimal-5.1.16/bin/bash
SHELL=/gnu/store/3jhfhxdf6v5ms10x5zmnl166dh3yhbr1-bash-minimal-5.1.16/bin/bash
--prefix=/gnu/store/9x5277gcjzwlis5yd0iq7ypq8f78jhpa-emacs-next-pgtk-30.0.91-1.9a1c76b
--enable-fast-install --with-pgtk --with-cairo --with-modules
--with-native-compilation=aot --disable-build-details'
[-- Attachment #2: 0001-Add-input-methods-for-Northern-Iroquoian-languages.patch --]
[-- Type: text/patch, Size: 15912 bytes --]
From 4fe10ab7d4f448703785848596adf62fa8d508a5 Mon Sep 17 00:00:00 2001
From: Kierin Bell <fernseed@fernseed.me>
Date: Fri, 1 Nov 2024 21:56:36 -0400
Subject: [PATCH] Add input methods for Northern Iroquoian languages
---
etc/NEWS | 11 +
lisp/leim/quail/iroquoian.el | 491 +++++++++++++++++++++++++++++++++++
2 files changed, 502 insertions(+)
create mode 100644 lisp/leim/quail/iroquoian.el
diff --git a/etc/NEWS b/etc/NEWS
index 4aba4b17055..16759255345 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -815,6 +815,17 @@ DirectWrite rendering parameters.
To show color Emoji in Emacs, customize the default fontset to use a
color Emoji font installed on your system for the 'emoji' script.
+---
+** New input methods for Northern Iroquoian languages.
+Input methods are now implemented for all Five Nations Iroquois
+languages in the Northern Iroquoian language family: 'mohawk-postfix'
+(Mohawk [Kanien’kéha / Onkwehonwe’néha]), 'oneida-postfix' (Oneida
+[Onʌyota:ká: / Ukwehuwehnéha]), 'cayuga-postfix' (Cayuga
+[Gayogo̱ho:nǫhnéha:ˀ]), 'onondaga-postfix (Onondaga [[Onųdaʔgegáʔ]), and
+`seneca-postfix' [Onödowá’ga:’]). Additionally, there is a
+general-purpose 'iroquoian-postfix' input method to facilitate writing
+in the orthographies of the five languages simultaneously.
+
\f
----------------------------------------------------------------------
This file is part of GNU Emacs.
diff --git a/lisp/leim/quail/iroquoian.el b/lisp/leim/quail/iroquoian.el
new file mode 100644
index 00000000000..36a78724779
--- /dev/null
+++ b/lisp/leim/quail/iroquoian.el
@@ -0,0 +1,491 @@
+;;; iroquoian.el --- Quail package for inputting Iroquoian languages -*- lexical-binding: t; coding: utf-8; -*-
+
+;; Copyright (C) 2024 Free Software Foundation, Inc.
+
+;; Author: Kierin Bell <fernseed@fernseed.me>
+;; Keywords: i18n
+
+;; This file is part of GNU Emacs.
+
+;; This program 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.
+
+;; This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; This file implements input methods for Northern Iroquoian languages.
+
+;; Input methods are implemented for all Five Nations Iroquois
+;; languages:
+
+;; - Mohawk (Kanien’kéha / Onkwehonwe’néha)
+;; - Oneida (Onʌyota:ká: / Ukwehuwehnéha)
+;; - Cayuga (Gayogo̱ho:nǫhnéha:ˀ)
+;; - Onondaga (Onųdaʔgegáʔ)
+;; - Seneca (Onödowá’ga:’)
+
+;; Input methods are not yet implemented for the remaining Northern
+;; Iroquoian languages, including:
+
+;; - Tuscarora (Skarù:ręʔ)
+;; - Wendat (Huron) / Wyandot
+
+;;; Code:
+
+(require 'quail)
+(require 'seq)
+
+(defun quail-iroquoian-combining-char-p (char)
+ "Return whether CHAR is a combining character."
+ (and (characterp char)
+ ;; XXX: Combining characters here all have 'Mn' general category.
+ (memq (get-char-code-property char 'general-category) '(Mn))))
+
+(defun quail-iroquoian-update-translation (control-flag)
+ (cond
+ ((integerp control-flag)
+ ;; XXX: Set `quail-current-str' according to `quail-overlay', which
+ ;; seems to work more reliably in this use-case than analogous code
+ ;; in `quail-update-translation' (borrowed from the function
+ ;; `quail-lao-update-translation' in 'lao.el').
+ (setq quail-current-str
+ (buffer-substring (overlay-start quail-overlay)
+ (overlay-end quail-overlay)))
+ (unless input-method-exit-on-first-char
+ (quail-add-unread-command-events
+ (string-to-vector (substring quail-current-key control-flag)))))
+ ((quail-iroquoian-combining-char-p quail-current-str)
+ (setq quail-current-str
+ (compose-string
+ ;;
+ ;; XXX: Kludge to delete extraneous initial letters from some
+ ;; translations, e.g., with keys "a/'" in `onondaga-post',
+ ;; the following would be inserted (with the extraneous
+ ;; initial "a"): aǽ
+ ;;
+ ;; Doesn't work:
+ ;; (substring STR (max 0 (- (string-width STR) 1)))
+ ;;
+ (apply #'string
+ (seq-reduce
+ (lambda (acc elt)
+ (if (quail-iroquoian-combining-char-p elt)
+ (append acc (list elt))
+ (list elt)))
+ (quail-lookup-map-and-concat quail-current-key)
+ '())))))
+ ((null control-flag)
+ ;; Borrowed from `quail-update-translation'.
+ (unless quail-current-str
+ (setq quail-current-str
+ (if (quail-kbd-translate)
+ (quail-keyseq-translate quail-current-key)
+ quail-current-key))
+ (when (and input-method-exit-on-first-char (quail-simple))
+ (setq control-flag t)))))
+ control-flag)
+
+\f
+;;; Mohawk
+
+(defconst iroquoian-mohawk-punctuation-alist
+ '((":" ?:)))
+
+(defconst iroquoian-mohawk-vowel-alist
+ '(("a" ?a)
+ ("A" ?A)
+ ("e" ?e)
+ ("E" ?E)
+ ("i" ?i)
+ ("I" ?I)
+ ("o" ?o)
+ ("O" ?O)))
+
+(defconst iroquoian-mohawk-consonant-alist
+ '((";;" ?\N{RIGHT SINGLE QUOTATION MARK})
+ ("h" ?h)
+ ("H" ?H)
+ ("k" ?k)
+ ("K" ?K)
+ ("n" ?n)
+ ("N" ?N)
+ ("r" ?r)
+ ("R" ?R)
+ ("s" ?s)
+ ("S" ?S)
+ ("t" ?t)
+ ("T" ?T)
+ ("w" ?w)
+ ("W" ?W)
+ ("Y" ?Y)
+ ("y" ?y)))
+
+(defconst iroquoian-mohawk-accent-alist
+ '(("'" ?\N{COMBINING ACUTE ACCENT})
+ ("`" ?\N{COMBINING GRAVE ACCENT})))
+
+(quail-define-package
+ "mohawk-postfix" "Mohawk" "MOH<" nil
+ "Mohawk input method with postfix modifiers"
+ nil t t nil nil nil nil nil
+ #'quail-iroquoian-update-translation
+ nil t)
+
+(quail-install-map
+ (quail-map-from-table
+ '((base-state (iroquoian-mohawk-vowel-alist . v-state)
+ iroquoian-mohawk-consonant-alist
+ iroquoian-mohawk-punctuation-alist)
+ (v-state iroquoian-mohawk-accent-alist))))
+
+\f
+;;; Oneida
+
+(defconst iroquoian-oneida-punctuation-alist
+ '(("::" ?\N{MIDDLE DOT})
+ ;; Alternative vowel lengthener:
+ (":" ?:)))
+
+(defconst iroquoian-oneida-vowel-alist
+ '(("a" ?a)
+ ("A" ?A)
+ ("e" ?e)
+ ("E" ?E)
+ ("i" ?i)
+ ("I" ?I)
+ ("o" ?o)
+ ("O" ?O)
+ ("u" ?u)
+ ("U" ?U)
+ ("e/" ?ʌ)
+ ("E/" ?Ʌ)))
+
+(defconst iroquoian-oneida-consonant-alist
+ '(;; Alternative: ?\N{RIGHT SINGLE QUOTATION MARK}
+ (";;" ?\N{MODIFIER LETTER GLOTTAL STOP})
+ ("h" ?h)
+ ("H" ?H)
+ ("k" ?k)
+ ("K" ?K)
+ ("l" ?l)
+ ("L" ?L)
+ ("n" ?n)
+ ("N" ?N)
+ ("s" ?s)
+ ("S" ?S)
+ ("t" ?t)
+ ("T" ?T)
+ ("w" ?w)
+ ("W" ?W)
+ ("y" ?y)
+ ("Y" ?Y)))
+
+(defconst iroquoian-oneida-accent-alist
+ '(("'" ?\N{COMBINING ACUTE ACCENT})))
+
+(defconst iroquoian-oneida-pre-pausal-alist
+ '(("_" ?\N{COMBINING LOW LINE})))
+
+(quail-define-package
+ "oneida-postfix" "Oneida" "ONE<" nil
+ "Oneida input method with postfix modifiers"
+ nil t t nil nil nil nil nil
+ #'quail-iroquoian-update-translation
+ nil t)
+
+(quail-install-map
+ (quail-map-from-table
+ '((base-state (iroquoian-oneida-vowel-alist . v-state)
+ (iroquoian-oneida-consonant-alist . p-state)
+ (iroquoian-oneida-punctuation-alist . p-state))
+ (v-state (iroquoian-oneida-accent-alist . p-state)
+ iroquoian-oneida-pre-pausal-alist)
+ (p-state iroquoian-oneida-pre-pausal-alist))))
+
+\f
+;;; Onondaga
+
+(defconst iroquoian-onondaga-punctuation-alist
+ '(("::" ?\N{MIDDLE DOT})
+ ;; Alternative vowel lengthener:
+ (":" ?:)))
+
+(defconst iroquoian-onondaga-vowel-alist
+ '(("a" ?a)
+ ("A" ?A)
+ ("a/" ?æ)
+ ("i" ?i)
+ ("I" ?I)
+ ("o" ?o)
+ ("O" ?O)))
+
+(defconst iroquoian-onondaga-ogonek-vowel-alist
+ '(("e" ?e)
+ ("E" ?E)
+ ("u" ?u)
+ ("U" ?U)))
+
+(defconst iroquoian-onondaga-consonant-alist
+ '(;; Alternative glottal stop: ?\N{RIGHT SINGLE QUOTATION MARK}
+ ;; Alternative glottal stop: ?\N{MODIFIER LETTER GLOTTAL STOP}
+ (";;" ?\N{LATIN LETTER GLOTTAL STOP})
+ ("c" ?c)
+ ("C" ?C)
+ ("d" ?d)
+ ("D" ?D)
+ ("g" ?g)
+ ("G" ?G)
+ ("h" ?h)
+ ("H" ?H)
+ ("j" ?j)
+ ("J" ?J)
+ ("k" ?k)
+ ("K" ?K)
+ ("n" ?n)
+ ("N" ?N)
+ ("s" ?s)
+ ("S" ?S)
+ ("t" ?t)
+ ("T" ?T)
+ ("w" ?w)
+ ("W" ?W)
+ ("y" ?y)
+ ("Y" ?Y)))
+
+(defconst iroquoian-onondaga-accent-alist
+ '(("'" ?\N{COMBINING ACUTE ACCENT})))
+
+(defconst iroquoian-onondaga-ogonek-alist
+ '(("," ?\N{COMBINING OGONEK})))
+
+(quail-define-package
+ "onondaga-postfix" "Onondaga" "ONO<" nil
+ "Onondaga input method with postfix modifiers"
+ nil t t nil nil nil nil nil
+ #'quail-iroquoian-update-translation
+ nil t)
+
+(quail-install-map
+ (quail-map-from-table
+ '((base-state (iroquoian-onondaga-ogonek-vowel-alist . o-state)
+ (iroquoian-onondaga-vowel-alist . v-state)
+ iroquoian-onondaga-consonant-alist
+ iroquoian-onondaga-punctuation-alist)
+ (o-state (iroquoian-onondaga-ogonek-alist . v-state)
+ iroquoian-onondaga-accent-alist)
+ (v-state iroquoian-onondaga-accent-alist))))
+
+\f
+;;; Cayuga
+
+(defconst iroquoian-cayuga-punctuation-alist
+ '((":" ?:)))
+
+(defconst iroquoian-cayuga-vowel-alist
+ '(("a" ?a)
+ ("A" ?A)
+ ("i" ?i)
+ ("I" ?I)
+ ("u" ?u)
+ ("U" ?U)))
+
+(defconst iroquoian-cayuga-ogonek-vowel-alist
+ '(("e" ?e)
+ ("E" ?E)
+ ("o" ?o)
+ ("O" ?O)))
+
+(defconst iroquoian-cayuga-consonant-alist
+ '((";;" ?\N{MODIFIER LETTER GLOTTAL STOP})
+ ("d" ?d)
+ ("D" ?D)
+ ("f" ?f) ; Example word?
+ ("F" ?F)
+ ("g" ?g)
+ ("G" ?G)
+ ("h" ?h)
+ ("H" ?H)
+ ("j" ?j)
+ ("J" ?J)
+ ("k" ?k)
+ ("K" ?K)
+ ("n" ?n)
+ ("N" ?N)
+ ("r" ?r)
+ ("R" ?R)
+ ("s" ?s)
+ ("S" ?S)
+ ("t" ?t)
+ ("T" ?T)
+ ("w" ?w)
+ ("W" ?W)
+ ("y" ?y)
+ ("Y" ?Y)))
+
+(defconst iroquoian-cayuga-accent-alist
+ '(("'" ?\N{COMBINING ACUTE ACCENT})
+ ("-" ?\N{COMBINING MACRON BELOW})))
+
+(defconst iroquoian-cayuga-ogonek-alist
+ '(("," ?\N{COMBINING OGONEK})))
+
+(quail-define-package
+ "cayuga-postfix" "Cayuga" "CAY<" nil
+ "Cayuga input method with postfix modifiers (Henry orthography)"
+ nil t t nil nil nil nil nil
+ #'quail-iroquoian-update-translation
+ nil t)
+
+(quail-install-map
+ (quail-map-from-table
+ '((base-state (iroquoian-cayuga-ogonek-vowel-alist . o-state)
+ (iroquoian-cayuga-vowel-alist . v-state)
+ iroquoian-cayuga-consonant-alist
+ iroquoian-cayuga-punctuation-alist)
+ (o-state (iroquoian-cayuga-ogonek-alist . v-state))
+ (v-state iroquoian-cayuga-accent-alist))))
+
+\f
+;;; Seneca
+
+(defconst iroquoian-seneca-punctuation-alist
+ '((":" ?:)))
+
+(defconst iroquoian-seneca-vowel-alist
+ '(("i" ?i)
+ ("I" ?I)
+ ("u" ?u)
+ ("U" ?U)))
+
+(defconst iroquoian-seneca-diaeresis-vowel-alist
+ '(("a" ?a)
+ ("A" ?A)
+ ("e" ?e)
+ ("E" ?E)
+ ("o" ?o)
+ ("O" ?O)))
+
+(defconst iroquoian-seneca-consonant-alist
+ `((";;" ?\N{RIGHT SINGLE QUOTATION MARK})
+ ("d" ?d)
+ ("D" ?D)
+ ("g" ?g)
+ ("G" ?G)
+ ("h" ?h)
+ ("H" ?H)
+ ("j" ?j)
+ ("J" ?J)
+ ("k" ?k)
+ ("K" ?K)
+ ("n" ?n)
+ ("N" ?N)
+ ("s" ?s)
+ ("S" ?S)
+ ("s/" ?š)
+ ("S/" ?Š)
+ ("t" ?t)
+ ("T" ?T)
+ ("w" ?w)
+ ("W" ?W)
+ ("y" ?y)
+ ("Y" ?Y)
+ ("z" ?z)
+ ("Z" ?Z)))
+
+(defconst iroquoian-seneca-accent-alist
+ '(("'" ?\N{COMBINING ACUTE ACCENT})))
+
+(defconst iroquoian-seneca-diaeresis-alist
+ '(("\"" ?\N{COMBINING DIAERESIS})))
+
+(quail-define-package
+ "seneca-postfix" "Seneca" "SEE<" nil
+ "Seneca input method with postfix modifiers (Henry orthography)"
+ nil t t nil nil nil nil nil
+ #'quail-iroquoian-update-translation
+ nil t)
+
+(quail-install-map
+ (quail-map-from-table
+ '((base-state (iroquoian-seneca-diaeresis-vowel-alist . d-state)
+ (iroquoian-seneca-vowel-alist . v-state)
+ iroquoian-seneca-consonant-alist
+ iroquoian-seneca-punctuation-alist)
+ (d-state (iroquoian-seneca-diaeresis-alist . v-state)
+ iroquoian-seneca-accent-alist)
+ (v-state iroquoian-seneca-accent-alist))))
+
+\f
+;;; Composite Iroquoian
+
+(defconst iroquoian-composite-punctuation-alist
+ (seq-uniq (append iroquoian-mohawk-punctuation-alist
+ iroquoian-oneida-punctuation-alist
+ iroquoian-onondaga-punctuation-alist
+ iroquoian-cayuga-punctuation-alist
+ iroquoian-seneca-punctuation-alist)))
+
+(defconst iroquoian-composite-vowel-alist
+ (seq-uniq (append iroquoian-mohawk-vowel-alist
+ iroquoian-oneida-vowel-alist
+ iroquoian-onondaga-vowel-alist
+ iroquoian-cayuga-vowel-alist
+ iroquoian-seneca-vowel-alist
+ iroquoian-onondaga-ogonek-vowel-alist
+ iroquoian-cayuga-ogonek-vowel-alist
+ iroquoian-seneca-diaeresis-vowel-alist)))
+
+(defconst iroquoian-composite-consonant-alist
+ (seq-uniq (append
+ '((";;" ?\N{RIGHT SINGLE QUOTATION MARK})
+ (";'" ?\N{MODIFIER LETTER GLOTTAL STOP})
+ (";:" ?\N{LATIN LETTER GLOTTAL STOP}))
+ iroquoian-mohawk-consonant-alist
+ iroquoian-oneida-consonant-alist
+ iroquoian-onondaga-consonant-alist
+ iroquoian-cayuga-consonant-alist
+ iroquoian-seneca-consonant-alist)
+ (lambda (c1 c2)
+ (equal (car c1) (car c2)))))
+
+(defconst iroquoian-composite-accent-alist
+ '(("'" ?\N{COMBINING ACUTE ACCENT})
+ ("`" ?\N{COMBINING GRAVE ACCENT})
+ ("-" ?\N{COMBINING MACRON BELOW})))
+
+(defconst iroquoian-composite-modifier-alist
+ '(("," ?\N{COMBINING OGONEK})
+ ("\"" ?\N{COMBINING DIAERESIS})))
+
+(defconst iroquoian-composite-pre-pausal-alist
+ '(("_" ?\N{COMBINING LOW LINE})))
+
+(quail-define-package
+ "iroquoian-postfix" "Iroquoian" "IRO<" nil
+ "Composite input method for Northern Iroquoian languages"
+ nil t t nil nil nil nil nil
+ #'quail-iroquoian-update-translation
+ nil t)
+
+(quail-install-map
+ (quail-map-from-table
+ '((base-state (iroquoian-composite-vowel-alist . v-state)
+ (iroquoian-composite-consonant-alist . p-state)
+ (iroquoian-composite-punctuation-alist . p-state))
+ (v-state (iroquoian-composite-modifier-alist . v-state-2)
+ (iroquoian-composite-accent-alist . p-state)
+ iroquoian-composite-pre-pausal-alist)
+ (v-state-2 (iroquoian-composite-accent-alist . p-state)
+ iroquoian-composite-pre-pausal-alist)
+ (p-state iroquoian-composite-pre-pausal-alist))))
+
+;;; iroquoian.el ends here
--
2.46.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2024-11-02 2:34 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-02 2:34 bug#74170: [PATCH] Add input methods for Northern Iroquoian languages Kierin Bell
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).