空白の自動挿入
insert spaces automatically between user-defined patterns
Require this script
(require 'electric-spacing)
and you may enable electric-spacing-mode with M-x
electric-spacing-mode
. Loading the mode in major-mode-hooks may also
be useful.
(add-hook 'org-mode-hook 'electric-spacing-mode)
You may define a pattern where whitespaces should be inserted, by
adding a regexp-pair to electric-spacing-regexp-pairs
. For example,
following setting inserts spaces between Japanese and English
characters like: foo ほげ bar ふが
(add-to-list 'electric-spacing-regexp-pairs
'("\\cA\\|\\cC\\|\\ck\\|\\cK\\|\\cH" . "[0-9A-Za-z]"))
(add-to-list 'electric-spacing-regexp-pairs
'("[0-9A-Za-z]" . "\\cA\\|\\cC\\|\\ck\\|\\cK\\|\\cH"))
You may define a buffer-local pattern by making
electric-spacing-regexp-pairs
buffer-local before registering the
pattern.
(make-local-variable 'electric-spacing-regexp-pairs)