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)
doctorate
  • 1,789
  • 16
  • 39
  • 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 06 '20 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 06 '20 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 09 '20 at 08:04
  • @wasamasa, please bear with me my questions, emacs ships with input-methods, say for example Greek, Hebrew but where can I find them in my emacs installation directories or path, does finding them will help me provide a template for the syriac script? – doctorate Sep 13 '20 at 17:15
  • 1
    `M-x find-library` is your friend – wasamasa Sep 13 '20 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 '20 at 07:56
  • @wasamasa, in the paths shown by `M-x locate library` there I could find the `.elc` files which I think are the compiled lisp files, but where to find the corresponding lisp `.el` files? – doctorate Sep 14 '20 at 08:02
  • Install them with your OS package manager. – wasamasa Sep 14 '20 at 08:17
  • @wasamasa could you please elaborate on your method of getting the elisp files given that I am using a Linux Ubuntu OS. – doctorate Sep 21 '20 at 12:31
  • @wasamasa, I downloaded the emacs tarball, but still I am clueless as where to find those elisp files pertinent to greek, hebrew, etc.. input-methods, any further hints will be much appreciated. – doctorate Sep 27 '20 at 17:46
  • try searching for `hebrew.el.gz` which is the ISO 8859-8 input method – zzkt Nov 22 '20 at 13:21
  • @zzkt thanks, I found it in `emacs-27.1/lisp/leim/quail/hebrew.el` and another file was found in `emacs-27.1/lisp/language/hebrew.el` and I don't know how are they both related, no idea. – doctorate Nov 22 '20 at 17:54
  • Ubuntu has a separate package for the *.el files (amongst other things), so to get a complete installation of Emacs you need these non-required packages. If you were using Emacs 26, then try `sudo apt-get install emacs26-el`. You should also install the `emacs26-common-non-dfsg` package to ensure you have the documentation. Substitute the correct version number if you're using some other version. `dpkg --get-selections | grep emacs` (listing installed packages) and `apt-cache search --names-only emacs` (listing available packages) may help. – phils Nov 23 '20 at 09:46

3 Answers3

4

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

Joost Kremers
  • 686
  • 3
  • 5
  • 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 '20 at 09: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. – Joost Kremers Nov 25 '20 at 16:14
  • Thanks. I got it. – doctorate Nov 25 '20 at 16:31
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.

zzkt
  • 456
  • 3
  • 10
  • 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 '20 at 12:39
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.
NickD
  • 27,023
  • 3
  • 23
  • 42
Yair F
  • 1