4

I want to write an article in English mingled with Syriac script in emacs, when I hit list-input-methods the script is not shown, or at least I couldn't identify this language in the displayed list. However, I am using a machine running Linux Ubuntu and I could add that language keyboard easily and it is designated Syriac or syc. I could use the same script in LibreOffice Writer using specific fonts for this language. My question how to add a new input method for this language in my init.el file? I would be very grateful for your help and directions to achieve this goal.

In this EmacsWiki I could find input methods for ancient languages, but again I couldn't see one for Syriac. It is just hard to believe that Syriac language given its dominance in history could not get similar attention.

The Syriac language is from right-to-left language and it has the iso 15924 designation in UTF-18 and it has the unicod range
U+0700–U+074F Syriac

U+0860-U+086F Syriac

more info here

Update

my init.el setup for Hebrew language (again Right-to-Left) input method is shown below, this way I could still use Emacs keystrokes (shortcuts) regardless of whatever language you use which is the desired outcome. Otherwise, I would switch back and forth between languages in Linux Hebrew while writing and English then to use Emacs keystrokes which otherwise won't work when Hebrew is in place so I have to I switch keyboards quite often during writing making it impractical and very annoying for writing multilingual documents. The code below will allow me write Hebrew using Emacs keystrokes seamlessly and no need to bother with switching languages back and forth to use these keystrokes:

(set-fontset-font "fontset-default" 'hebrew "SBL BibLit-14" nil) 

(defun hebrew-input-font ()
  "Change the `set-input-method` to Hebrew and select another font assigned to \\C-\\c h."
  (interactive)
  (set-input-method "hebrew-biblical-tiro"))
(bind-key "<f2> h" 'hebrew-input-font)
13
  • Have you considered actually looking at these files on Emacswiki and adapting them for your needs? I find it highly unlikely that someone is going to do that work for you and besides, it's not really the purpose of this site to write packages.
    – wasamasa
    Sep 6, 2020 at 12:02
  • @wasamasa, I just need a starter, from where to start, even if it means going to another site to ask and get a useful answer. My question could be generalized to any script that is available on Linux system but not provided by emacs.
    – doctorate
    Sep 6, 2020 at 15:57
  • Yes and you yourself have provided that starter by linking to an Emacswiki page full of user-contributed input methods. I suspect the hard part is thinking up a reasonable mapping of ascii abbreviations to foreign script characters and that's something only somebody actually understanding that script can do. So get going.
    – wasamasa
    Sep 9, 2020 at 8:04
  • 1
    M-x find-library is your friend
    – wasamasa
    Sep 13, 2020 at 20:37
  • 1
    @wasamasa, thanks, however M-x find-library threw an error saying can't find whatever you search for, but M-x locate-library worked well and showed me a path to the desired library.
    – doctorate
    Sep 14, 2020 at 7:56

3 Answers 3

4
+500

It should be sufficient to put the following in a .el file and load it upon startup:

(quail-define-package
 "Syriac-trans" "Ar-trans" "S>" t
 "Input method for Syriac transcription."
 nil t nil nil nil nil nil nil nil nil t)

(quail-define-rules
 ("'" ?ܐ)
 ("b" ?ܒ)
 ("g" ?ܓ)
 ("d" ?ܕ)
 ("h" ?ܗ)
 ("w" ?ܘ)
 ("z" ?ܙ)
 ("x" ?ܚ)
 ("t." ?ܛ)
 ("y" ?ܝ)
 ("k" ?ܟ)
 ("l" ?ܠ)
 ("m" ?ܡ)
 ("n" ?ܢ)
 ("s" ?ܣ)
 ("`" ?ܥ)
 ("p" ?ܦ)
 ("s." ?ܨ)
 ("q" ?ܩ)
 ("r" ?ܪ)
 ("sh" ?ܫ)
 ("t" ?ܬ))

Then you can select the input method with M-x set-input-method RET Syriac-trans RET. This only contains the consonants, you'd need to add more rules for diacritics.

You may also want to change the actual keys you need to type for specific letters (e.g., ' for ܐ and ` for ܥ may not be practical). Note that you may specify sequences of two or even more keys to type a specific Syriac letter, as I've done with t. for ܛ, s. for ܨ and sh for ܫ.

3
  • Great! this is a good start. Please could you elaborate more on the meaning of nil t nil nil nil nil nil nil nil nil t) part and what each argument means? is there any documentation on this quail input method, I just want to know what other possibilities are there to be supported when a new input method is introduced.
    – doctorate
    Nov 24, 2020 at 9:45
  • Any Emacs function is documented in Emacs itself: if you do C-h f quail-define-package RET, you should get the documentation for quail-define-package, including information on all the arguments. Nov 25, 2020 at 16:14
  • Thanks. I got it.
    – doctorate
    Nov 25, 2020 at 16:31
0

There are several issues here:

  1. Detecting and setting the language: I'd search in lisp/language and probably need to add entries in lisp/international/ especially characters.el and fontset.el
  2. Keyboard layout: In case your OS doesn't provide one, you can define one or more in lisp/leim/quail
  3. The most challenging effort would be proper composing of initial/medial/final forms. You should follow Arabic model.
0

If your system keyboard inserts unicode characters for Syriac and you have fonts that cover the required codepoints you might not need a dedicated input method in emacs.

Try defining the relevant fonts for the range in emacs...

(let ((syriac-1 (font-spec :family "Syriac Serto"))
      (syriac-2 (font-spec :family "Estrangelo Edessa")))
  (set-fontset-font t '(#x0700 . #x074F) syriac-1)
  (set-fontset-font t '(#x0860 . #x086F) syriac-2))

text

And if you are mixing left-to-right and right-to-left text in the same document, the section of the manual on Bidirectional Editing is worth reading.

However, if you do want to create a new input method you could start with an existing one (e.g. Glagolitic) and change the mapping rules to fit with Syriac transliteration.

1
  • The fonts are only applied to the Syriac range of characters in emacs, so if you input Syriac in unicode it should have the correct font. Latin text remains in the default font.
    – zzkt
    Nov 22, 2020 at 12:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.