org-export-as-html したときに強調要素前後の半角空白が気になって仕方がない

org-export-as-html するときに、

a *bcd* /efg/ =hij=

a <b>bcd</b> <i>efg</i> <code>hij</code>

のように出力されるが、前後の半角スペースもそのまま出力されてしまうのでなんかかっこ悪い。
気になる。困った。

org-export-html-final-hook という変数に、
エクスポートの最終段階で hook する関数を登録できるので、
以下のような関数を登録する。

(setq org-export-html-final-hook
      (lambda ()
        (let ((tag-name-list (list "i" "code" "b" "del")))
          (goto-char (point-min))
          (while (re-search-forward
                  (concat " <\\(" (implode tag-name-list "\\|") "\\)>")
                  nil t)
            (goto-char (match-beginning 0))
            (delete-char 1))
          (goto-char (point-min))
          (while (re-search-forward
                  (concat "</\\(" (implode tag-name-list "\\|") "\\)> ")
                  nil t)
            (goto-char (match-end 0))
            (delete-char -1)))))

バッファのあたまから見ていって、生成されたタグの前後の半角スペースを消していくだけの単純な関数…。