(load "term/internal" nil t)
(defvar msdos-color-values
'(("black" 0 0 0 0)
("blue" 1 0 0 52480) ("green" 2 8704 35584 8704) ("cyan" 3 0 52736 53504) ("red" 4 45568 8704 8704) ("magenta" 5 35584 0 35584) ("brown" 6 40960 20992 11520) ("lightgray" 7 48640 48640 48640) ("darkgray" 8 26112 26112 26112) ("lightblue" 9 0 0 65535) ("lightgreen" 10 0 65535 0) ("lightcyan" 11 0 65535 65535) ("lightred" 12 65535 0 0) ("lightmagenta" 13 65535 0 65535) ("yellow" 14 65535 65535 0) ("white" 15 65535 65535 65535))
"A list of MS-DOS console colors, their indices and 16-bit RGB values.")
(defvar default-frame-alist nil)
(modify-frame-parameters terminal-frame default-frame-alist)
(tty-color-clear)
(defun msdos-face-setup ()
(set-face-foreground 'bold "yellow" terminal-frame)
(set-face-foreground 'italic "red" terminal-frame)
(set-face-foreground 'bold-italic "lightred" terminal-frame)
(set-face-foreground 'underline "white" terminal-frame)
(make-face 'msdos-menu-active-face)
(make-face 'msdos-menu-passive-face)
(make-face 'msdos-menu-select-face)
(set-face-foreground 'msdos-menu-active-face "white" terminal-frame)
(set-face-foreground 'msdos-menu-passive-face "lightgray" terminal-frame)
(set-face-background 'msdos-menu-active-face "blue" terminal-frame)
(set-face-background 'msdos-menu-passive-face "blue" terminal-frame)
(set-face-background 'msdos-menu-select-face "red" terminal-frame))
(add-hook 'before-init-hook 'msdos-face-setup)
(defun msdos-handle-reverse-video (frame parameters)
"Handle the reverse-video frame parameter on MS-DOS frames."
(when (cdr (or (assq 'reverse parameters)
(assq 'reverse default-frame-alist)))
(let* ((params (frame-parameters frame))
(fg (cdr (assq 'foreground-color params)))
(bg (cdr (assq 'background-color params))))
(if (equal fg (cdr (assq 'mouse-color params)))
(modify-frame-parameters frame
(list (cons 'mouse-color bg))))
(if (equal fg (cdr (assq 'cursor-color params)))
(modify-frame-parameters frame
(list (cons 'cursor-color bg)))))))
(defun msdos-setup-initial-frame ()
(modify-frame-parameters terminal-frame default-frame-alist)
(msdos-remember-default-colors terminal-frame)
(modify-frame-parameters terminal-frame initial-frame-alist)
(msdos-handle-reverse-video terminal-frame
(frame-parameters terminal-frame))
(frame-set-background-mode terminal-frame)
(face-set-after-frame-default terminal-frame))
(add-hook 'term-setup-hook 'msdos-setup-initial-frame)
(defun make-msdos-frame (&optional parameters)
(let ((frame (make-terminal-frame parameters))
success)
(unwind-protect
(progn
(msdos-handle-reverse-video frame (frame-parameters frame))
(frame-set-background-mode frame)
(face-set-after-frame-default frame)
(setq success t))
(unless success (delete-frame frame)))
frame))
(setq frame-creation-function 'make-msdos-frame)
(defun x-list-fonts (pattern &optional face frame maximum width)
(if (or (null width) (and (numberp width) (= width 1)))
(list "ms-dos")
(list "no-such-font")))
(defun x-display-pixel-width (&optional frame) (frame-width frame))
(defun x-display-pixel-height (&optional frame) (frame-height frame))
(defun x-display-planes (&optional frame) 4) (defun x-display-color-cells (&optional frame) 16)
(defun x-server-max-request-size (&optional frame) 1000000) (defun x-server-vendor (&optional frame) t "GNU")
(defun x-server-version (&optional frame) '(1 0 0))
(defun x-display-screens (&optional frame) 1)
(defun x-display-mm-height (&optional frame) 245) (defun x-display-mm-width (&optional frame) 322) (defun x-display-backing-store (&optional frame) 'not-useful)
(defun x-display-visual-class (&optional frame) 'static-color)
(fset 'x-display-save-under 'ignore)
(fset 'x-get-resource 'ignore)
(defvar x-display-name "pc"
"The display name specifying the MS-DOS display and frame type.")
(setq split-window-keep-point t)
(defvar x-colors (mapcar 'car msdos-color-values)
"The list of colors available on a PC display under MS-DOS.")
(defvar x-last-selected-text nil)
(defcustom x-select-enable-clipboard t
"Non-nil means cutting and pasting uses the clipboard.
This is the default on this system, since MS-Windows does not
support other types of selections."
:type 'boolean
:group 'killing)
(defun x-select-text (text &optional push)
(if x-select-enable-clipboard
(w16-set-clipboard-data text))
(setq x-last-selected-text text))
(defun x-get-selection-value ()
(if x-select-enable-clipboard
(let (text)
(condition-case c
(setq text (w16-get-clipboard-data))
(error (message "w16-get-clipboard-data:%s" c)))
(if (string= text "") (setq text nil))
(cond
((not text) nil)
((eq text x-last-selected-text) nil)
((string= text x-last-selected-text)
(setq x-last-selected-text text)
nil)
(t
(setq x-last-selected-text text))))))
(setq interprogram-cut-function 'x-select-text)
(setq interprogram-paste-function 'x-get-selection-value)
(defun x-frob-font-slant (font which)
font)
(make-obsolete 'x-frob-font-slant 'make-face-... "21.1")
(defun x-frob-font-weight (font which)
font)
(make-obsolete 'x-frob-font-weight 'make-face-... "21.1")
(defun x-font-family-list ()
"Return a list of available font families on FRAME.\n\
If FRAME is omitted or nil, use the selected frame.\n\
Value is a list of conses (FAMILY . FIXED-P) where FAMILY\n\
is a font family, and FIXED-P is non-nil if fonts of that family\n\
are fixed-pitch."
'(("default" . t)))
(fset 'query-fontset 'ignore)
(fset 'iconify-or-deiconify-frame 'ignore)
(fset 'set-default-font 'ignore)
(fset 'set-mouse-color 'ignore) (fset 'set-cursor-color 'ignore) (fset 'set-border-color 'ignore)