Skip to content

Instantly share code, notes, and snippets.

@m-ueno
Created November 11, 2014 08:45
Show Gist options
  • Save m-ueno/074229e5f62da819a9e4 to your computer and use it in GitHub Desktop.
Save m-ueno/074229e5f62da819a9e4 to your computer and use it in GitHub Desktop.
;; 保存の度に「、」「。」を「,」「.」に置換する
;; fork of: http://xr0038tech.hatenadiary.jp/entry/2014/05/06/182956
(defun local-replace-all-punctuations ()
"Replace all \"。\" with \".\""
(interactive)
(when (derived-mode-p 'yatex-mode)
(save-excursion
(beginning-of-buffer)
(while (re-search-forward "。" nil t)
(replace-match ".")
(beginning-of-buffer)
(while (re-search-forward "、" nil t)
(replace-match ","))))))
(add-hook 'before-save-hook 'local-replace-all-punctuations)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment