0

I added these to my init.el:

(use-package org
   :ensure nil
   :hook (org-mode . (lambda ()
                    (org-indent-mode)
                    (variable-pitch-mode -1)
                    (display-line-numbers-mode -1)
                    (set-input-method "custom-input-method")))
   ..
   ..

The (set-input-method "custom-input-method") loads some custom keys I defined to insert phonetic symbols:

(quail-define-package
"custom-input-method" "" "" t
"Custom input method

Documentation goes here."
nil t nil nil nil nil nil nil nil nil t)

(quail-define-rules
;; Phonetic symbols
("\\uh" ?ə) ; UNSTRESSED SCHWA VOWEL
("\\uH" ?ʌ) ; STRESSED SCHWA VOWEL
("\\ii" ?ɪ) ; NEAR-CLOSE NEAR-FRONT UNROUNDED VOWEL
("\\uu" ?ʊ) ; NEAR-CLOSE NEAR-BACK ROUNDED VOWEL
..
..

I use these symbols quite often in my documents so I would like the input method to be enabled by default in Org mode which it works using the code above.

When I enable the custom input method with (set-input-method "custom-input-method") does it have any negative side effect on the default input method? or the custom input method will just add the additional characters on top of the default input method? So can I enable it by default without having to worry?

2 Answers 2

0

What you are looking for is snippet expansion, and you can accomplish this with the yasnippet: Yet another snippet extension for Emacs library.

  1. M-x package-install RET yasnippet
  2. C-x C-f somefile.org
  3. M-x yas-minor-mode
  4. M-x yas-new-snippet RET
  5. Fill the template as below
# -*- mode: snippet -*-
# name: STRESSED SCHWA VOWEL
# key: \\uH
# --
ʌ
  1. Do a M-x yas-load-snippet-buffer-and-close RET or C-c C-c when you have filled the template
  2. There will be some prompts. Press ENTER or say yes as appropriate.
  3. A snippet will be stored in ~/.emacs.d/snippets/org-mode/ directory
  4. Now you can enter the following characters
\\uH

and press TAB. The above sequence will be replaced with ʌ.

  1. (Optionally) If you want the sequence like
\\uh<TAB>\\uH<TAB>

to be expanded to

əʌ

you can add the following to your .emacs file

(defun yas-try-key-from-double-backslash (_start-point)
  (re-search-backward "\\\\\\\\"))

(push #'yas-try-key-from-double-backslash yas-key-syntaxes)

Look at yasnippet's menu entry for further help.

0

Have you tried the ipa input method.

  1. M-x set-input-method RET ipa RET
  2. Type the following characters
    /e/vIU
    

and you will see the characters you want appear in the buffer

  1. Do C-\ to return back to your original input method.
  2. You can do C-\ to return back to the ipa input method

All input methods provide help, which you can summon with M-x describe-input-method.

Unfortunately, the ipa input method provides very minimal help which seems pretty useless (at least for a non-IPA users like me)

Input method: ipa (‘IPA’ in mode line) for IPA

  International Phonetic Alphabet for English, French, German and Italian

Upside-down characters are obtained by a preceding slash (/).

Please file a bug report against Emacs with M-x report-emacs-bug or send a mail to [email protected] saying that you want more descriptive help for IPA input method.


See ipa.el#41 for the input table.

There are couple of more ipa-... input methods. Check them out too, if the ipa method doesn't provide what you want.


Under the absence of the help from IPA, you can use the following steps to identify the sequence of keys you can use to get a given IPA character.

  1. M-x eww RET https://en.wiktionary.org/wiki/Appendix:English_pronunciation RET
  2. In the resulting *eww* buffer do, M-x set-input-method RET
  3. Locate the charcter of interest, say ə
  4. With cursor on that letter, do C-u C-x =, and look for clues in the resulting *Help* buffer as seen below.

Screenshot of C-u C-x =


If you use IPA input method very frequently, consider customizing the variable default-input-method to "IPA".


set-input-method is an interactive byte-compiled Lisp function in ‘mule-cmds.el’.

It is bound to C-x RET C-\.

It can also be invoked from the menu: Options → Multilingual Environment → Select Input Method...


toggle-input-method is an interactive byte-compiled Lisp function in ‘mule-cmds.el’.

It is bound to C-\.

It can also be invoked from the menu: Options → Multilingual Environment → Toggle Input Method


describe-input-method (found in global-map), which is an interactive byte-compiled Lisp function in ‘mule-cmds.el’.

It is bound to C-h I, C-h C-\, <f1> I, <f1> C-\, <help> I and <help> C-\.

It can also be invoked from the menu: Help → Describe → Describe Input Method... and Options → Multilingual Environment → Describe Input Method...

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.