Xrefactoryの日本語文字化け対応
C++のリファクタリングツール Xrefactory の弱点の一つは、日本語が文字化けすること。
中の人は、 「xref-novc-find-file() を↓のように直せば文字化けしないよ」と言っているが、これがとんだ嘘っぱち。
(defun xref-novc-find-file (file) (let ((buff)) (setq buff (get-file-buffer file)) (if (and buff (verify-visited-file-modtime buff)) (switch-to-buffer buff) ;; be conformant with find-file (if xref-run-find-file-hooks (progn (find-file file) ;; full standard find-file (setq buffer-file-coding-system (set-auto-coding file (- (point-max) (point)))) ) (setq buff (create-file-buffer file)) (switch-to-buffer buff) (insert-file-contents file t nil nil t) (after-find-file nil t t nil t) )) ))
下記の修正で解決。ただし、副作用の有無は未確認。
(defun xref-server-read-answer-file-and-dispatch (dispatch-data tmp-files) - (let ((res) (cb) (i) (coding-system-for-read 'raw-text)) + (let ((res) (cb) (i) )