doomemacs/modules/input/chinese/config.el
Henrik Lissner ffbd7b63bf
Fix #3654: prevent org-export-to-html removing line-breaks
When either :input chinese or :input japanese is enabled, due to
overzealous advice.
2020-08-02 01:33:51 -04:00

49 lines
1.3 KiB
EmacsLisp

;;; input/chinese/config.el -*- lexical-binding: t; -*-
(use-package! pyim
:after-call after-find-file pre-command-hook
:init
(setq pyim-dcache-directory (concat doom-cache-dir "pyim/"))
:config
(setq pyim-page-tooltip t
default-input-method "pyim"))
(use-package! pangu-spacing
:hook (text-mode . pangu-spacing-mode)
:config
;; Always insert `real' space in org-mode.
(setq-hook! 'org-mode-hook pangu-spacing-real-insert-separtor t))
(use-package! fcitx
:after evil
:config
(when (setq fcitx-remote-command
(or (executable-find "fcitx5-remote")
(executable-find "fcitx-remote")))
(fcitx-evil-turn-on)))
(use-package! ace-pinyin
:after avy
:init (setq ace-pinyin-use-avy t)
:config (ace-pinyin-global-mode t))
;;
;;; Hacks
(defadvice! +chinese--org-html-paragraph-a (args)
"Join consecutive Chinese lines into a single long line without unwanted space
when exporting org-mode to html."
:filter-args #'org-html-paragraph
(cl-destructuring-bind (paragraph contents info) args
(let* ((fix-regexp "[[:multibyte:]]")
(fixed-contents
(replace-regexp-in-string
(concat "\\(" fix-regexp "\\) *\n *\\(" fix-regexp "\\)")
"\\1\\2"
contents)))
(list paragraph fixed-contents info))))