Function: find-coding-systems-for-charsets

find-coding-systems-for-charsets is a byte-compiled function defined in mule-cmds.el.gz.

Signature

(find-coding-systems-for-charsets CHARSETS)

Documentation

Return a list of proper coding systems to encode characters of CHARSETS.

CHARSETS is a list of character sets.

This only finds coding systems of type charset, whose
:charset-list property includes all of CHARSETS (plus ascii for
ASCII-compatible coding systems). It was used in older versions of Emacs, but is unlikely to be what you really want now.

Source Code

;; Defined in /usr/src/emacs/lisp/international/mule-cmds.el.gz
(defun find-coding-systems-for-charsets (charsets)
  "Return a list of proper coding systems to encode characters of CHARSETS.
CHARSETS is a list of character sets.

This only finds coding systems of type `charset', whose
`:charset-list' property includes all of CHARSETS (plus `ascii' for
ASCII-compatible coding systems).  It was used in older versions of
Emacs, but is unlikely to be what you really want now."
  ;; Deal with aliases.
  (setq charsets (mapcar (lambda (c)
			   (get-charset-property c :name))
			 charsets))
  (cond ((or (null charsets)
	     (and (= (length charsets) 1)
		  (eq 'ascii (car charsets))))
	 '(undecided))
	((or (memq 'eight-bit-control charsets)
	     (memq 'eight-bit-graphic charsets))
	 '(raw-text utf-8-emacs))
	(t
	 (let (codings)
	   (dolist (cs (coding-system-list t))
	     (let ((cs-charsets (and (eq (coding-system-type cs) 'charset)
				     (coding-system-charset-list cs)))
		   (charsets charsets))
	       (if (coding-system-get cs :ascii-compatible-p)
		   (cl-pushnew 'ascii cs-charsets))
	       (if (catch 'ok
		     (when cs-charsets
		       (while charsets
			 (unless (memq (pop charsets) cs-charsets)
			   (throw 'ok nil)))
		       t))
		   (push cs codings))))
	   (nreverse codings)))))