Function: tty-find-type
tty-find-type is a byte-compiled function defined in faces.el.gz.
Signature
(tty-find-type PRED TYPE)
Documentation
Return the longest prefix of TYPE to which PRED returns non-nil.
TYPE should be a tty type name such as "xterm-16color".
The function tries only those prefixes that are followed by a dash or underscore in the original type name, like "xterm" in the above example.
Source Code
;; Defined in /usr/src/emacs/lisp/faces.el.gz
(defun tty-find-type (pred type)
"Return the longest prefix of TYPE to which PRED returns non-nil.
TYPE should be a tty type name such as \"xterm-16color\".
The function tries only those prefixes that are followed by a
dash or underscore in the original type name, like \"xterm\" in
the above example."
(let (hyphend)
(while (and type
(not (funcall pred type)))
;; Strip off last hyphen and what follows, then try again
(setq type
(if (setq hyphend (string-match-p "[-_.][^-_.]+$" type))
(substring type 0 hyphend)
nil))))
type)