Function: list-character-sets-1

list-character-sets-1 is a byte-compiled function defined in mule-diag.el.gz.

Signature

(list-character-sets-1 SORT-KEY)

Documentation

Insert a list of character sets sorted by SORT-KEY.

SORT-KEY should be name or iso-spec (default name).

Source Code

;; Defined in /usr/src/emacs/lisp/international/mule-diag.el.gz
(defun list-character-sets-1 (sort-key)
  "Insert a list of character sets sorted by SORT-KEY.
SORT-KEY should be `name' or `iso-spec' (default `name')."
  (or sort-key
      (setq sort-key 'name))
  (let (;; (tail charset-list)
	charset-info-list supplementary-list sort-func)
    (dolist (charset charset-list)
      ;; Generate a list that contains all information to display.
      (let ((elt (list charset
		       (charset-dimension charset)
		       (charset-chars charset)
		       (charset-iso-final-char charset))))
	(if (plist-get (charset-plist charset) :supplementary-p)
	    (push elt supplementary-list)
	  (push elt charset-info-list))))

    ;; Determine a predicate for `sort' by SORT-KEY.
    (setq sort-func
	  (cond ((eq sort-key 'name)
		 (lambda (x y) (string< (car x) (car y))))

		((eq sort-key 'iso-spec)
		 ;; Sort by DIMENSION CHARS FINAL-CHAR
                 (lambda (x y)
                   (or (< (nth 1 x) (nth 1 y))
                       (and (= (nth 1 x) (nth 1 y))
                            (or (< (nth 2 x) (nth 2 y))
                                (and (= (nth 2 x) (nth 2 y))
                                     (< (nth 3 x) (nth 3 y))))))))
		(t
		 (error "Invalid charset sort key: %s" sort-key))))

    (setq charset-info-list (sort charset-info-list sort-func))
    (setq supplementary-list (sort supplementary-list sort-func))

    ;; Insert information of character sets.
    (dolist (elt (append charset-info-list (list t) supplementary-list))
      (if (eq elt t)
	  (progn
	    (insert "\n-------------- ")
	    (insert-text-button "Supplementary Character Sets"
				'type 'help-info
				'help-args '("(emacs)Charsets"))
	    (insert " --------------
Character sets for defining other charsets, or for backward compatibility
"))
	(insert-text-button (symbol-name (car elt)) ; NAME
			    :type 'list-charset-chars
			    'help-args (list (car elt)))
	(goto-char (point-max))
	(insert "\t")
	(indent-to 48)
	(insert (format "%d %3d "
			(nth 1 elt) (nth 2 elt)) ; DIMENSION and CHARS
		(if (< (nth 3 elt) 0)
		    "none"
		  (nth 3 elt))))	; FINAL-CHAR
      (insert "\n"))))