Add :input japanese module
This commit is contained in:
parent
fadbfb321f
commit
8d9a15e414
3 changed files with 102 additions and 0 deletions
40
modules/input/japanese/README.org
Normal file
40
modules/input/japanese/README.org
Normal file
|
@ -0,0 +1,40 @@
|
|||
#+TITLE: input/japanese
|
||||
#+DATE: May 13, 2019
|
||||
#+SINCE: 2.1
|
||||
#+STARTUP: inlineimages
|
||||
|
||||
* Table of Contents :TOC_3:noexport:
|
||||
- [[#description][Description]]
|
||||
- [[#module-flags][Module Flags]]
|
||||
- [[#plugins][Plugins]]
|
||||
- [[#hacks][Hacks]]
|
||||
- [[#prerequisites][Prerequisites]]
|
||||
- [[#features][Features]]
|
||||
- [[#configuration][Configuration]]
|
||||
- [[#troubleshooting][Troubleshooting]]
|
||||
|
||||
* Description
|
||||
This module adds support for Japanese script.
|
||||
|
||||
#+begin_quote
|
||||
Because I am unable to personally test this module, help to improve this module
|
||||
would be greatly appreciated! Especially where performance is concerned.
|
||||
#+end_quote
|
||||
|
||||
** Module Flags
|
||||
This module provides no flags.
|
||||
|
||||
** Plugins
|
||||
+ [[https://github.com/emacs-jp/migemo][migemo]]
|
||||
+ [[https://github.com/momomo5717/avy-migemo][avy-migemo]]
|
||||
+ [[https://github.com/hsaito/ddskk][ddskk]]
|
||||
+ [[https://github.com/coldnew/pangu-spacing][pangu-spacing]]
|
||||
|
||||
** Hacks
|
||||
+ ~org-html-paragraph~ has been modified to join consecutive Chinese lines into
|
||||
a single long line without wanted spaced (when exporting org-mode to html).
|
||||
|
||||
* TODO Prerequisites
|
||||
* TODO Features
|
||||
* TODO Configuration
|
||||
* TODO Troubleshooting
|
55
modules/input/japanese/config.el
Normal file
55
modules/input/japanese/config.el
Normal file
|
@ -0,0 +1,55 @@
|
|||
;;; input/japanese/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(def-package! migemo
|
||||
:config
|
||||
(setq migemo-command "cmigemo"
|
||||
migemo-options '("-q" "--emacs" "-i" "\a")
|
||||
migemo-user-dictionary nil
|
||||
migemo-regex-dictionary nil
|
||||
migemo-coding-system 'utf-8-unix
|
||||
search-default-regexp-mode nil
|
||||
migemo-dictionary "/usr/local/share/migemo/utf-8/migemo-dict")
|
||||
(migemo-init)
|
||||
(when (featurep! :completion helm)
|
||||
(after! helm (helm-migemo-mode +1))))
|
||||
|
||||
|
||||
(use-package pangu-spacing
|
||||
:init
|
||||
;; replacing `chinese-two-byte' by `japanese'
|
||||
(setq pangu-spacing-chinese-before-english-regexp
|
||||
"\\(?1:\\cj\\)\\(?2:[0-9A-Za-z]\\)"
|
||||
pangu-spacing-chinese-after-english-regexp
|
||||
"\\(?1:[0-9A-Za-z]\\)\\(?2:\\cj\\)")
|
||||
|
||||
;; Always insert `real' space in text-mode including org-mode.
|
||||
(setq pangu-spacing-real-insert-separtor t)
|
||||
;; (global-pangu-spacing-mode 1)
|
||||
(add-hook 'text-mode-hook !'pangu-spacing-mode))
|
||||
|
||||
|
||||
(def-package! avy-migemo
|
||||
:after avy
|
||||
:config (avy-migemo-mode 1))
|
||||
|
||||
|
||||
(def-package! ddskk
|
||||
:defer t
|
||||
:bind (("C-x j" . skk-mode)))
|
||||
|
||||
|
||||
;;
|
||||
;;; Hacks
|
||||
|
||||
(defun +japanese*org-html-paragraph (paragraph contents info)
|
||||
"Join consecutive Japanese lines into a single long line without unwanted space
|
||||
when exporting org-mode to html."
|
||||
(let* ((fix-regexp "[[:multibyte:]]")
|
||||
(origin-contents contents)
|
||||
(fixed-contents
|
||||
(replace-regexp-in-string
|
||||
(concat "\\(" fix-regexp "\\) *\n *\\(" fix-regexp "\\)")
|
||||
"\\1\\2"
|
||||
origin-contents)))
|
||||
(list paragraph fixed-contents info)))
|
||||
(advice-add #'org-html-paragraph :filter-args #'+japanese*org-html-paragraph)
|
7
modules/input/japanese/packages.el
Normal file
7
modules/input/japanese/packages.el
Normal file
|
@ -0,0 +1,7 @@
|
|||
;; -*- no-byte-compile: t; -*-
|
||||
;;; input/japanese/packages.el
|
||||
|
||||
(package! migemo)
|
||||
(package! avy-migemo)
|
||||
(package! ddskk)
|
||||
(package! pangu-spacing)
|
Loading…
Add table
Add a link
Reference in a new issue