Function: po-find-file-coding-system-guts
po-find-file-coding-system-guts is a byte-compiled function defined in
po.el.gz.
Signature
(po-find-file-coding-system-guts OPERATION FILENAME)
Documentation
Return a (DECODING . ENCODING) pair for OPERATION on PO file FILENAME.
Do so according to FILENAME's declared charset. FILENAME may be a cons (NAME . BUFFER). In that case, detect charset in BUFFER.
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/po.el.gz
(defun po-find-file-coding-system-guts (operation filename)
"Return a (DECODING . ENCODING) pair for OPERATION on PO file FILENAME.
Do so according to FILENAME's declared charset.
FILENAME may be a cons (NAME . BUFFER). In that case, detect charset
in BUFFER."
(and
(eq operation 'insert-file-contents)
(or (if (consp filename) (buffer-live-p (cdr filename)))
(file-exists-p filename))
(with-temp-buffer
(let* ((coding-system-for-read 'no-conversion)
(charset (or (po-find-charset filename) "ascii"))
assoc)
(list (cond
((setq assoc
(assoc-string charset
po-content-type-charset-alist
t))
(cdr assoc))
((or (setq assoc (assoc-string charset coding-system-alist t))
(setq assoc
(assoc-string (subst-char-in-string ?_ ?-
charset)
coding-system-alist t)))
(intern (car assoc)))
;; In principle we should also check the `mime-charset'
;; property of everything in the base coding system
;; list, but there should always be a coding system
;; corresponding to the MIME name.
((featurep 'code-pages)
;; Give up.
'raw-text)
(t
;; Try again with code-pages loaded. Maybe it's best
;; to require it initially?
(require 'code-pages nil t)
(if (or
(setq assoc (assoc-string charset coding-system-alist t))
(setq assoc (assoc-string (subst-char-in-string
?_ ?- charset)
coding-system-alist t)))
(intern (car assoc))
'raw-text))))))))