Function: revert-buffer-with-coding-system

revert-buffer-with-coding-system is an interactive and byte-compiled function defined in mule.el.gz.

Signature

(revert-buffer-with-coding-system CODING-SYSTEM &optional FORCE)

Documentation

Visit the current buffer's file again using coding system CODING-SYSTEM.

For a list of possible values of CODING-SYSTEM, use M-x list-coding-systems (list-coding-systems).

If CODING-SYSTEM leaves the text conversion unspecified, or if it leaves the end-of-line conversion unspecified, FORCE controls what to do. If FORCE is nil, get the unspecified aspect (or aspects) from the buffer's previous buffer-file-coding-system value (if it is specified there). Otherwise, determine it from the file contents as usual for visiting a file.

View in manual

Probably introduced at or before Emacs version 22.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/international/mule.el.gz
(defun revert-buffer-with-coding-system (coding-system &optional force)
  "Visit the current buffer's file again using coding system CODING-SYSTEM.
For a list of possible values of CODING-SYSTEM, use \\[list-coding-systems].

If CODING-SYSTEM leaves the text conversion unspecified, or if it leaves
the end-of-line conversion unspecified, FORCE controls what to do.
If FORCE is nil, get the unspecified aspect (or aspects) from the buffer's
previous `buffer-file-coding-system' value (if it is specified there).
Otherwise, determine it from the file contents as usual for visiting a file."
  (interactive "zCoding system for visited file (default nil): \nP")
  (check-coding-system coding-system)
  (if (and coding-system buffer-file-coding-system (null force))
      (setq coding-system
	    (merge-coding-systems coding-system buffer-file-coding-system)))
  (let ((coding-system-for-read coding-system))
    (revert-buffer)))