Function: describe-coding-system

describe-coding-system is an autoloaded, interactive and byte-compiled function defined in mule-diag.el.gz.

Signature

(describe-coding-system CODING-SYSTEM)

Documentation

Display information about CODING-SYSTEM.

View in manual

Probably introduced at or before Emacs version 20.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/international/mule-diag.el.gz
;;;###autoload
(defun describe-coding-system (coding-system)
  "Display information about CODING-SYSTEM."
  (interactive "zDescribe coding system (default current choices): ")
  (let ((help-buffer-under-preparation t))
    (if (null coding-system)
	(describe-current-coding-system)
      (help-setup-xref (list #'describe-coding-system coding-system)
		       (called-interactively-p 'interactive))
      (with-output-to-temp-buffer (help-buffer)
	(print-coding-system-briefly coding-system 'doc-string)
	(let ((type (coding-system-type coding-system))
	      ;; Fixme: use this
	      ;; (extra-spec (coding-system-plist coding-system))
	      )
	  (princ "Type: ")
	  (princ type)
	  (cond ((eq type 'undecided)
		 (princ " (do automatic conversion)"))
		((eq type 'utf-8)
		 (princ " (UTF-8: Emacs internal multibyte form)"))
		((eq type 'utf-16)
		 ;; (princ " (UTF-16)")
		 )
		((eq type 'shift-jis)
		 (princ " (Shift-JIS, MS-KANJI)"))
		((eq type 'iso-2022)
		 (princ " (variant of ISO-2022)\n")
		 (princ "Initial designations:\n")
		 (print-designation (coding-system-get coding-system
						       :designation))

		 (when (coding-system-get coding-system :flags)
		   (princ "Other specifications: \n  ")
		   (apply #'print-list
			  (coding-system-get coding-system :flags))))
		((eq type 'charset)
		 (princ " (charset)"))
		((eq type 'ccl)
		 (princ " (do conversion by CCL program)"))
		((eq type 'raw-text)
		 (princ " (text with random binary characters)"))
		((eq type 'emacs-mule)
		 (princ " (Emacs 21 internal encoding)"))
		((eq type 'big5))
		(t (princ ": invalid coding-system.")))
	  (princ "\nEOL type: ")
	  (let ((eol-type (coding-system-eol-type coding-system)))
	    (cond ((vectorp eol-type)
		   (princ "Automatic selection from:\n\t")
		   (princ eol-type)
		   (princ "\n"))
		  ((or (null eol-type) (eq eol-type 0)) (princ "LF\n"))
		  ((eq eol-type 1) (princ "CRLF\n"))
		  ((eq eol-type 2) (princ "CR\n"))
		  (t (princ "invalid\n")))))
	(let ((postread (coding-system-get coding-system :post-read-conversion)))
	  (when postread
	    (princ "After decoding text normally,")
	    (princ " perform post-conversion using the function: ")
	    (princ "\n  ")
	    (princ postread)
	    (princ "\n")))
	(let ((prewrite (coding-system-get coding-system :pre-write-conversion)))
	  (when prewrite
	    (princ "Before encoding text normally,")
	    (princ " perform pre-conversion using the function: ")
	    (princ "\n  ")
	    (princ prewrite)
	    (princ "\n")))
	(with-current-buffer standard-output
	  (let ((charsets (coding-system-charset-list coding-system)))
	    (when (and (not (eq (coding-system-base coding-system) 'raw-text))
		       charsets)
	      (cond
	       ((eq charsets 'iso-2022)
		(insert "This coding system can encode all ISO 2022 charsets."))
	       ((eq charsets 'emacs-mule)
		(insert "This coding system can encode all emacs-mule charsets\
."""))
	       (t
		(insert "This coding system encodes the following charsets:\n ")
		(while charsets
		  (insert " " (symbol-name (car charsets)))
		  (search-backward (symbol-name (car charsets)))
		  (help-xref-button 0 'help-character-set (car charsets))
		  (goto-char (point-max))
		  (setq charsets (cdr charsets))))))))))))