unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
blob 36a7872477921a7013cef77ac3b89267b210f826 13248 bytes (raw)
name: lisp/leim/quail/iroquoian.el 	 # note: path name is non-authoritative(*)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
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

debug log:

solving 36a78724779 ...
found 36a78724779 in https://yhetil.org/emacs-bugs/87froas6s7.fsf@fernseed.me/

applying [1/1] https://yhetil.org/emacs-bugs/87froas6s7.fsf@fernseed.me/
diff --git a/lisp/leim/quail/iroquoian.el b/lisp/leim/quail/iroquoian.el
new file mode 100644
index 00000000000..36a78724779

Checking patch lisp/leim/quail/iroquoian.el...
Applied patch lisp/leim/quail/iroquoian.el cleanly.

index at:
100644 36a7872477921a7013cef77ac3b89267b210f826	lisp/leim/quail/iroquoian.el

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

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).