Chances are that every time utf-coding should be activated by invoking 'M-x revert-coding-system` , even though a long list of utf-prefer configuration:
(prefer-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(setq locale-coding-system 'utf-8)
(setq-default buffer-file-coding-system 'utf-8)
Try to automate the process by
;;Set buffer coding system
(add-hook 'org-mode-hook (lambda () (revert-buffer-with-coding-system "utf-8")))
However, it does not work as expected.
What's the problem with my function to to handle the revert-buffer-with-coding-system'
revert-buffer-with-coding-system
in the major mode hook looks wrong. The selection of the major mode (set-auto-mode
innormal-mode
inafter-find-file
) is part ofrevert-buffer
. 2. Why do you want to callrevert-buffer-with-coding-system
in the first place? Does the auto-selection of the coding system go wrong such that characters are shown in wrong encoding?