Function: update-glyphless-char-display

update-glyphless-char-display is a byte-compiled function defined in characters.el.gz.

Signature

(update-glyphless-char-display &optional VARIABLE VALUE)

Documentation

Make the setting of glyphless-char-display-control take effect.

This function updates the char-table glyphless-char-display, and is intended to be used in the :set attribute of the option glyphless-char-display.

Source Code

;; Defined in /usr/src/emacs/lisp/international/characters.el.gz
(defun update-glyphless-char-display (&optional variable value)
  "Make the setting of `glyphless-char-display-control' take effect.
This function updates the char-table `glyphless-char-display',
and is intended to be used in the `:set' attribute of the
option `glyphless-char-display'."
  (when variable
    (set-default variable value))
  (dolist (elt value)
    (let ((target (car elt))
	  (method (cdr elt)))
      (unless (memq method '( zero-width thin-space empty-box
                              acronym hex-code bidi-control))
	(error "Invalid glyphless character display method: %s" method))
      (cond ((eq target 'c0-control)
	     (glyphless-set-char-table-range glyphless-char-display
					     #x00 #x1F method)
	     ;; Users will not expect their newlines and TABs be
	     ;; displayed as anything but themselves, so exempt those
	     ;; two characters from c0-control.
	     (set-char-table-range glyphless-char-display #x9 nil)
	     (set-char-table-range glyphless-char-display #xa nil))
	    ((eq target 'c1-control)
	     (glyphless-set-char-table-range glyphless-char-display
					     #x80 #x9F method))
	    ((eq target 'variation-selectors)
	     (glyphless-set-char-table-range glyphless-char-display
					     #xFE00 #xFE0F method)
             (glyphless-set-char-table-range glyphless-char-display
					     #xE0100 #xE01EF method))
	    ((or (eq target 'format-control)
                 (eq target 'bidi-control))
	     (when unicode-category-table
	       (map-char-table
                (lambda (char category)
                  (when (eq category 'Cf)
                    (let ((this-method method)
                          from to)
                      (if (consp char)
                          (setq from (car char) to (cdr char))
                        (setq from char to char))
                      (while (<= from to)
                        (when (/= from #xAD)
                          (when (eq method 'acronym)
                            (setq this-method
                                  (or (aref char-acronym-table from)
                                      "UNK")))
                          (when (or (eq target 'format-control)
                                    (memq from bidi-control-characters))
                            (set-char-table-range glyphless-char-display
                                                  from this-method)))
                        (setq from (1+ from))))))
		unicode-category-table)))
	    ((eq target 'no-font)
	     (set-char-table-extra-slot glyphless-char-display 0 method))
	    (t
	     (error "Invalid glyphless character group: %s" target))))))