Emacs23 だと hiki-mode.el の hiki-index-edit-page と hiki-index-edit-page-current-line で文字化けが起こる件
Emacs が 23 になってから hiki-mode.el を使うと、Hiki Index mode で hiki-index-edit-page もしくは hiki-index-edit-page-current-line を呼んでページを編集しようとしたときに文字化けが起き、うまくページが開けなくなった。これは hiki-http-url-unhexify-string が新しい Emacs の内部コードに対応してないためで、とりあえず hiki-index-edit-page で文字化けを修正することで編集は可能なため、原因は分かっていたが放置していた。
改めて直してみようと思ったら綺麗な解を見つけられなかったので、人の力をお借りすることになり、以下のページにある anraku さんのパッチをそのまま使わせてもらうことにした。ありがとうございます。
もっと厳密な方法で書きたいところだけど、タイムアップといった感じ。
(eval-after-load "hiki-mode" '(defun hiki-http-url-unhexify-string (str coding) "Unescape characters in a string." (save-match-data (let ((result (string-as-unibyte str)) (pos -1)) (while (setq pos (string-match "+" result (1+ pos))) (setq result (replace-match " " nil nil result))) (setq pos -1) (while (setq pos (string-match "%\\([0-9a-fA-F][0-9a-fA-F]\\)" result (1+ pos))) (setq result (replace-match (format "%c" (eval (read (concat "?\\x" (match-string 1 result))))) t t result))) (decode-coding-string (eval (cons 'unibyte-string (string-to-list result))) coding)))))