doomemacs/modules/input/japanese/config.el
Henrik Lissner 76cacb5bfe
💥 Rename def-package! -> use-package!
Calling this pivotal macro "def-package!" has frequently been a source
of confusion. It is a thin wrapper around use-package, and it should be
obvious that it is so. For this reason, and to match the naming
convention used with other convenience macros/wrappers, it is now
use-package!.

Also changes def-package-hook! -> use-package-hook!

The old macros are now marked obsolete and will be removed when straight
integration is merged.
2019-07-23 12:50:45 +02:00

55 lines
1.7 KiB
EmacsLisp

;;; input/japanese/config.el -*- lexical-binding: t; -*-
(use-package! migemo
:after-call after-find-file pre-command-hook
:init
(setq search-default-regexp-mode nil
migemo-options '("-q" "--emacs" "-i" "\a")
migemo-user-dictionary nil
migemo-regex-dictionary nil
migemo-coding-system 'utf-8-unix
migemo-directory (concat doom-etc-dir "migemo/")
migemo-dictionary "/usr/local/share/migemo/utf-8/migemo-dict")
:config
(when (executable-find migemo-command)
(migemo-init)
(use-package! avy-migemo
:after avy
:config (avy-migemo-mode 1))
(when (featurep! :completion helm)
(after! helm (helm-migemo-mode +1)))))
(use-package pangu-spacing
:hook (text-mode . pangu-spacing-mode)
: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.
pangu-spacing-real-insert-separtor t))
(use-package! ddskk
:general ("C-x j" #'skk-mode))
;;
;;; Hacks
(def-advice! +japanese-org-html-paragraph-a (paragraph contents info)
"Join consecutive Japanese lines into a single long line without unwanted space
when exporting org-mode to html."
:filter-args #'org-html-paragraph
(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)))