2001-07-15 16:15:35 +00:00
|
|
|
;;; pc-win.el --- setup support for `PC windows' (whatever that is)
|
1994-10-17 08:04:13 +00:00
|
|
|
|
2014-01-01 07:43:34 +00:00
|
|
|
;; Copyright (C) 1994, 1996-1997, 1999, 2001-2014 Free Software
|
|
|
|
;; Foundation, Inc.
|
1994-10-17 08:04:13 +00:00
|
|
|
|
|
|
|
;; Author: Morten Welinder <terra@diku.dk>
|
2014-02-10 01:34:22 +00:00
|
|
|
;; Maintainer: emacs-devel@gnu.org
|
1994-10-17 08:04:13 +00:00
|
|
|
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
2008-05-06 04:34:22 +00:00
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
1994-10-17 08:04:13 +00:00
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 04:34:22 +00:00
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
;; (at your option) any later version.
|
1994-10-17 08:04:13 +00:00
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2008-05-06 04:34:22 +00:00
|
|
|
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
1996-01-14 09:58:28 +00:00
|
|
|
|
2001-07-15 16:15:35 +00:00
|
|
|
;;; Commentary:
|
|
|
|
|
2008-08-23 17:01:46 +00:00
|
|
|
;; This file is preloaded into Emacs by loadup.el. The functions in
|
|
|
|
;; this file are then called during startup from startup.el. This
|
|
|
|
;; means that just loading this file should not have any side effects
|
|
|
|
;; besides defining functions and variables, and in particular should
|
|
|
|
;; NOT initialize any window systems.
|
|
|
|
|
|
|
|
;; The main entry points to this file's features are msdos-handle-args,
|
|
|
|
;; msdos-create-frame-with-faces, msdos-initialize-window-system,
|
|
|
|
;; terminal-init-internal. The last one is not supposed to be called,
|
|
|
|
;; so it just errors out.
|
|
|
|
|
1996-01-14 09:58:28 +00:00
|
|
|
;;; Code:
|
|
|
|
|
2008-08-23 17:01:46 +00:00
|
|
|
(if (not (fboundp 'msdos-remember-default-colors))
|
|
|
|
(error "%s: Loading pc-win.el but not compiled for MS-DOS"
|
|
|
|
(invocation-name)))
|
|
|
|
|
2007-11-22 01:05:55 +00:00
|
|
|
(declare-function msdos-remember-default-colors "msdos.c")
|
|
|
|
(declare-function w16-set-clipboard-data "w16select.c")
|
|
|
|
(declare-function w16-get-clipboard-data "w16select.c")
|
2008-08-26 02:55:41 +00:00
|
|
|
(declare-function msdos-setup-keyboard "internal" (frame))
|
2007-11-22 01:05:55 +00:00
|
|
|
|
2008-08-23 17:01:46 +00:00
|
|
|
;;; This was copied from etc/rgb.txt, except that some values were changed
|
Changes for automatic remapping of X colors on terminal frames:
* term/pc-win.el (msdos-setup-initial-frame): New function, run by
term-setup-hook. Call msdos-remember-default-colors and
msdos-handle-reverse-video.
(msdos-face-setup): Parts of code moved to
msdos-setup-initial-frame.
(msdos-handle-reverse-video): New function, modeled after
x-handle-reverse-video.
(make-msdos-frame): Don't use initial-frame-alist and
default-frame-alist. Call msdos-handle-reverse-video.
(msdos-color-aliases): Remove.
(msdos-color-translate, msdos-approximate-color): Remove.
(msdos-color-values): Use 16-bit RGB values. RGB values updated
for better approximation of X colors.
(msdos-face-setup): Call tty-color-clear. Remove code that sets
up tty-color-alist (it is now on startup.el).
(x-display-color-p, x-color-defined-p, x-color-values,
x-defined-colors, face-color-supported-p, face-color-gray-p):
Remove.
* facemenu.el (facemenu-read-color, list-colors-display): Use
defined-colors for all frame types.
(facemenu-color-equal): Use color-values for all frame types.
* faces.el (read-face-attribute): For :foreground and :background
attributes and frames on character terminals, translate the color
to the closest supported one before looking it up in the list of
valid values.
(face-valid-attribute-values): Call defined-colors for all types
of frames.
(defined-colors, color-defined-p, color-values, display-color-p):
New finctions.
(x-defined-colors, x-color-defined-p, x-color-values,
x-display-color-p): Aliases for the above.
* startup.el (command-line): Register terminal colors for frame
types other than x and w32, but only if the terminal supports
colors. Call tty-color-define instead of face-register-tty-color.
* term/x-win.el (xw-defined-colors): Renamed from
x-defined-colors.
* term/w32-win.el (xw-defined-colors): Likewise.
* term/tty-colors.el: New file.
* loadup.el: Load term/tty-colors.
1999-12-06 17:55:00 +00:00
|
|
|
;;; a bit to make them consistent with DOS console colors, and the RGB
|
|
|
|
;;; values were scaled up to 16 bits, as `tty-define-color' requires.
|
|
|
|
;;;
|
|
|
|
;;; The mapping between the 16 standard EGA/VGA colors and X color names
|
|
|
|
;;; was done by running a Unix version of Emacs inside an X client and a
|
|
|
|
;;; DJGPP-compiled Emacs on the same PC. The names of X colors used to
|
|
|
|
;;; define the pixel values are shown as comments to each color below.
|
1999-07-30 08:51:19 +00:00
|
|
|
;;;
|
|
|
|
;;; If you want to change the RGB values, keep in mind that various pieces
|
|
|
|
;;; of Emacs think that a color whose RGB values add up to less than 0.6 of
|
Changes for automatic remapping of X colors on terminal frames:
* term/pc-win.el (msdos-setup-initial-frame): New function, run by
term-setup-hook. Call msdos-remember-default-colors and
msdos-handle-reverse-video.
(msdos-face-setup): Parts of code moved to
msdos-setup-initial-frame.
(msdos-handle-reverse-video): New function, modeled after
x-handle-reverse-video.
(make-msdos-frame): Don't use initial-frame-alist and
default-frame-alist. Call msdos-handle-reverse-video.
(msdos-color-aliases): Remove.
(msdos-color-translate, msdos-approximate-color): Remove.
(msdos-color-values): Use 16-bit RGB values. RGB values updated
for better approximation of X colors.
(msdos-face-setup): Call tty-color-clear. Remove code that sets
up tty-color-alist (it is now on startup.el).
(x-display-color-p, x-color-defined-p, x-color-values,
x-defined-colors, face-color-supported-p, face-color-gray-p):
Remove.
* facemenu.el (facemenu-read-color, list-colors-display): Use
defined-colors for all frame types.
(facemenu-color-equal): Use color-values for all frame types.
* faces.el (read-face-attribute): For :foreground and :background
attributes and frames on character terminals, translate the color
to the closest supported one before looking it up in the list of
valid values.
(face-valid-attribute-values): Call defined-colors for all types
of frames.
(defined-colors, color-defined-p, color-values, display-color-p):
New finctions.
(x-defined-colors, x-color-defined-p, x-color-values,
x-display-color-p): Aliases for the above.
* startup.el (command-line): Register terminal colors for frame
types other than x and w32, but only if the terminal supports
colors. Call tty-color-define instead of face-register-tty-color.
* term/x-win.el (xw-defined-colors): Renamed from
x-defined-colors.
* term/w32-win.el (xw-defined-colors): Likewise.
* term/tty-colors.el: New file.
* loadup.el: Load term/tty-colors.
1999-12-06 17:55:00 +00:00
|
|
|
;;; the values for WHITE (i.e. less than 117963) are ``dark'', otherwise the
|
1999-07-30 08:51:19 +00:00
|
|
|
;;; color is ``light''; see `frame-set-background-mode' in lisp/faces.el for
|
|
|
|
;;; an example.
|
|
|
|
(defvar msdos-color-values
|
2002-01-25 13:13:02 +00:00
|
|
|
'(("black" 0 0 0 0)
|
Changes for automatic remapping of X colors on terminal frames:
* term/pc-win.el (msdos-setup-initial-frame): New function, run by
term-setup-hook. Call msdos-remember-default-colors and
msdos-handle-reverse-video.
(msdos-face-setup): Parts of code moved to
msdos-setup-initial-frame.
(msdos-handle-reverse-video): New function, modeled after
x-handle-reverse-video.
(make-msdos-frame): Don't use initial-frame-alist and
default-frame-alist. Call msdos-handle-reverse-video.
(msdos-color-aliases): Remove.
(msdos-color-translate, msdos-approximate-color): Remove.
(msdos-color-values): Use 16-bit RGB values. RGB values updated
for better approximation of X colors.
(msdos-face-setup): Call tty-color-clear. Remove code that sets
up tty-color-alist (it is now on startup.el).
(x-display-color-p, x-color-defined-p, x-color-values,
x-defined-colors, face-color-supported-p, face-color-gray-p):
Remove.
* facemenu.el (facemenu-read-color, list-colors-display): Use
defined-colors for all frame types.
(facemenu-color-equal): Use color-values for all frame types.
* faces.el (read-face-attribute): For :foreground and :background
attributes and frames on character terminals, translate the color
to the closest supported one before looking it up in the list of
valid values.
(face-valid-attribute-values): Call defined-colors for all types
of frames.
(defined-colors, color-defined-p, color-values, display-color-p):
New finctions.
(x-defined-colors, x-color-defined-p, x-color-values,
x-display-color-p): Aliases for the above.
* startup.el (command-line): Register terminal colors for frame
types other than x and w32, but only if the terminal supports
colors. Call tty-color-define instead of face-register-tty-color.
* term/x-win.el (xw-defined-colors): Renamed from
x-defined-colors.
* term/w32-win.el (xw-defined-colors): Likewise.
* term/tty-colors.el: New file.
* loadup.el: Load term/tty-colors.
1999-12-06 17:55:00 +00:00
|
|
|
("blue" 1 0 0 52480) ; MediumBlue
|
2002-01-25 13:13:02 +00:00
|
|
|
("green" 2 8704 35584 8704) ; ForestGreen
|
|
|
|
("cyan" 3 0 52736 53504) ; DarkTurquoise
|
|
|
|
("red" 4 45568 8704 8704) ; FireBrick
|
|
|
|
("magenta" 5 35584 0 35584) ; DarkMagenta
|
|
|
|
("brown" 6 40960 20992 11520) ; Sienna
|
|
|
|
("lightgray" 7 48640 48640 48640) ; Gray
|
|
|
|
("darkgray" 8 26112 26112 26112) ; Gray40
|
|
|
|
("lightblue" 9 0 0 65535) ; Blue
|
|
|
|
("lightgreen" 10 0 65535 0) ; Green
|
|
|
|
("lightcyan" 11 0 65535 65535) ; Cyan
|
|
|
|
("lightred" 12 65535 0 0) ; Red
|
|
|
|
("lightmagenta" 13 65535 0 65535) ; Magenta
|
|
|
|
("yellow" 14 65535 65535 0) ; Yellow
|
|
|
|
("white" 15 65535 65535 65535))
|
Changes for automatic remapping of X colors on terminal frames:
* term/pc-win.el (msdos-setup-initial-frame): New function, run by
term-setup-hook. Call msdos-remember-default-colors and
msdos-handle-reverse-video.
(msdos-face-setup): Parts of code moved to
msdos-setup-initial-frame.
(msdos-handle-reverse-video): New function, modeled after
x-handle-reverse-video.
(make-msdos-frame): Don't use initial-frame-alist and
default-frame-alist. Call msdos-handle-reverse-video.
(msdos-color-aliases): Remove.
(msdos-color-translate, msdos-approximate-color): Remove.
(msdos-color-values): Use 16-bit RGB values. RGB values updated
for better approximation of X colors.
(msdos-face-setup): Call tty-color-clear. Remove code that sets
up tty-color-alist (it is now on startup.el).
(x-display-color-p, x-color-defined-p, x-color-values,
x-defined-colors, face-color-supported-p, face-color-gray-p):
Remove.
* facemenu.el (facemenu-read-color, list-colors-display): Use
defined-colors for all frame types.
(facemenu-color-equal): Use color-values for all frame types.
* faces.el (read-face-attribute): For :foreground and :background
attributes and frames on character terminals, translate the color
to the closest supported one before looking it up in the list of
valid values.
(face-valid-attribute-values): Call defined-colors for all types
of frames.
(defined-colors, color-defined-p, color-values, display-color-p):
New finctions.
(x-defined-colors, x-color-defined-p, x-color-values,
x-display-color-p): Aliases for the above.
* startup.el (command-line): Register terminal colors for frame
types other than x and w32, but only if the terminal supports
colors. Call tty-color-define instead of face-register-tty-color.
* term/x-win.el (xw-defined-colors): Renamed from
x-defined-colors.
* term/w32-win.el (xw-defined-colors): Likewise.
* term/tty-colors.el: New file.
* loadup.el: Load term/tty-colors.
1999-12-06 17:55:00 +00:00
|
|
|
"A list of MS-DOS console colors, their indices and 16-bit RGB values.")
|
1999-02-01 13:25:12 +00:00
|
|
|
|
1994-10-17 08:04:13 +00:00
|
|
|
;; ---------------------------------------------------------------------------
|
|
|
|
;; We want to delay setting frame parameters until the faces are setup
|
|
|
|
(defvar default-frame-alist nil)
|
2008-08-23 17:01:46 +00:00
|
|
|
;(modify-frame-parameters terminal-frame default-frame-alist)
|
1994-10-17 08:04:13 +00:00
|
|
|
|
|
|
|
(defun msdos-face-setup ()
|
2008-09-05 11:27:29 +00:00
|
|
|
"Initial setup of faces for the MS-DOS display."
|
|
|
|
(set-face-foreground 'bold "yellow")
|
|
|
|
(set-face-foreground 'italic "red")
|
|
|
|
(set-face-foreground 'bold-italic "lightred")
|
|
|
|
(set-face-foreground 'underline "white")
|
1994-10-17 08:04:13 +00:00
|
|
|
|
|
|
|
(make-face 'msdos-menu-active-face)
|
|
|
|
(make-face 'msdos-menu-passive-face)
|
|
|
|
(make-face 'msdos-menu-select-face)
|
2008-09-05 11:27:29 +00:00
|
|
|
(set-face-foreground 'msdos-menu-active-face "white")
|
|
|
|
(set-face-foreground 'msdos-menu-passive-face "lightgray")
|
|
|
|
(set-face-background 'msdos-menu-active-face "blue")
|
|
|
|
(set-face-background 'msdos-menu-passive-face "blue")
|
|
|
|
(set-face-background 'msdos-menu-select-face "red"))
|
1994-10-17 08:04:13 +00:00
|
|
|
|
Changes for automatic remapping of X colors on terminal frames:
* term/pc-win.el (msdos-setup-initial-frame): New function, run by
term-setup-hook. Call msdos-remember-default-colors and
msdos-handle-reverse-video.
(msdos-face-setup): Parts of code moved to
msdos-setup-initial-frame.
(msdos-handle-reverse-video): New function, modeled after
x-handle-reverse-video.
(make-msdos-frame): Don't use initial-frame-alist and
default-frame-alist. Call msdos-handle-reverse-video.
(msdos-color-aliases): Remove.
(msdos-color-translate, msdos-approximate-color): Remove.
(msdos-color-values): Use 16-bit RGB values. RGB values updated
for better approximation of X colors.
(msdos-face-setup): Call tty-color-clear. Remove code that sets
up tty-color-alist (it is now on startup.el).
(x-display-color-p, x-color-defined-p, x-color-values,
x-defined-colors, face-color-supported-p, face-color-gray-p):
Remove.
* facemenu.el (facemenu-read-color, list-colors-display): Use
defined-colors for all frame types.
(facemenu-color-equal): Use color-values for all frame types.
* faces.el (read-face-attribute): For :foreground and :background
attributes and frames on character terminals, translate the color
to the closest supported one before looking it up in the list of
valid values.
(face-valid-attribute-values): Call defined-colors for all types
of frames.
(defined-colors, color-defined-p, color-values, display-color-p):
New finctions.
(x-defined-colors, x-color-defined-p, x-color-values,
x-display-color-p): Aliases for the above.
* startup.el (command-line): Register terminal colors for frame
types other than x and w32, but only if the terminal supports
colors. Call tty-color-define instead of face-register-tty-color.
* term/x-win.el (xw-defined-colors): Renamed from
x-defined-colors.
* term/w32-win.el (xw-defined-colors): Likewise.
* term/tty-colors.el: New file.
* loadup.el: Load term/tty-colors.
1999-12-06 17:55:00 +00:00
|
|
|
(defun msdos-handle-reverse-video (frame parameters)
|
|
|
|
"Handle the reverse-video frame parameter on MS-DOS frames."
|
2001-03-02 13:34:48 +00:00
|
|
|
(when (cdr (or (assq 'reverse parameters)
|
|
|
|
(assq 'reverse default-frame-alist)))
|
Changes for automatic remapping of X colors on terminal frames:
* term/pc-win.el (msdos-setup-initial-frame): New function, run by
term-setup-hook. Call msdos-remember-default-colors and
msdos-handle-reverse-video.
(msdos-face-setup): Parts of code moved to
msdos-setup-initial-frame.
(msdos-handle-reverse-video): New function, modeled after
x-handle-reverse-video.
(make-msdos-frame): Don't use initial-frame-alist and
default-frame-alist. Call msdos-handle-reverse-video.
(msdos-color-aliases): Remove.
(msdos-color-translate, msdos-approximate-color): Remove.
(msdos-color-values): Use 16-bit RGB values. RGB values updated
for better approximation of X colors.
(msdos-face-setup): Call tty-color-clear. Remove code that sets
up tty-color-alist (it is now on startup.el).
(x-display-color-p, x-color-defined-p, x-color-values,
x-defined-colors, face-color-supported-p, face-color-gray-p):
Remove.
* facemenu.el (facemenu-read-color, list-colors-display): Use
defined-colors for all frame types.
(facemenu-color-equal): Use color-values for all frame types.
* faces.el (read-face-attribute): For :foreground and :background
attributes and frames on character terminals, translate the color
to the closest supported one before looking it up in the list of
valid values.
(face-valid-attribute-values): Call defined-colors for all types
of frames.
(defined-colors, color-defined-p, color-values, display-color-p):
New finctions.
(x-defined-colors, x-color-defined-p, x-color-values,
x-display-color-p): Aliases for the above.
* startup.el (command-line): Register terminal colors for frame
types other than x and w32, but only if the terminal supports
colors. Call tty-color-define instead of face-register-tty-color.
* term/x-win.el (xw-defined-colors): Renamed from
x-defined-colors.
* term/w32-win.el (xw-defined-colors): Likewise.
* term/tty-colors.el: New file.
* loadup.el: Load term/tty-colors.
1999-12-06 17:55:00 +00:00
|
|
|
(let* ((params (frame-parameters frame))
|
2000-10-16 19:17:35 +00:00
|
|
|
(fg (cdr (assq 'foreground-color params)))
|
|
|
|
(bg (cdr (assq 'background-color params))))
|
|
|
|
(if (equal fg (cdr (assq 'mouse-color params)))
|
Changes for automatic remapping of X colors on terminal frames:
* term/pc-win.el (msdos-setup-initial-frame): New function, run by
term-setup-hook. Call msdos-remember-default-colors and
msdos-handle-reverse-video.
(msdos-face-setup): Parts of code moved to
msdos-setup-initial-frame.
(msdos-handle-reverse-video): New function, modeled after
x-handle-reverse-video.
(make-msdos-frame): Don't use initial-frame-alist and
default-frame-alist. Call msdos-handle-reverse-video.
(msdos-color-aliases): Remove.
(msdos-color-translate, msdos-approximate-color): Remove.
(msdos-color-values): Use 16-bit RGB values. RGB values updated
for better approximation of X colors.
(msdos-face-setup): Call tty-color-clear. Remove code that sets
up tty-color-alist (it is now on startup.el).
(x-display-color-p, x-color-defined-p, x-color-values,
x-defined-colors, face-color-supported-p, face-color-gray-p):
Remove.
* facemenu.el (facemenu-read-color, list-colors-display): Use
defined-colors for all frame types.
(facemenu-color-equal): Use color-values for all frame types.
* faces.el (read-face-attribute): For :foreground and :background
attributes and frames on character terminals, translate the color
to the closest supported one before looking it up in the list of
valid values.
(face-valid-attribute-values): Call defined-colors for all types
of frames.
(defined-colors, color-defined-p, color-values, display-color-p):
New finctions.
(x-defined-colors, x-color-defined-p, x-color-values,
x-display-color-p): Aliases for the above.
* startup.el (command-line): Register terminal colors for frame
types other than x and w32, but only if the terminal supports
colors. Call tty-color-define instead of face-register-tty-color.
* term/x-win.el (xw-defined-colors): Renamed from
x-defined-colors.
* term/w32-win.el (xw-defined-colors): Likewise.
* term/tty-colors.el: New file.
* loadup.el: Load term/tty-colors.
1999-12-06 17:55:00 +00:00
|
|
|
(modify-frame-parameters frame
|
2000-10-16 19:17:35 +00:00
|
|
|
(list (cons 'mouse-color bg))))
|
|
|
|
(if (equal fg (cdr (assq 'cursor-color params)))
|
Changes for automatic remapping of X colors on terminal frames:
* term/pc-win.el (msdos-setup-initial-frame): New function, run by
term-setup-hook. Call msdos-remember-default-colors and
msdos-handle-reverse-video.
(msdos-face-setup): Parts of code moved to
msdos-setup-initial-frame.
(msdos-handle-reverse-video): New function, modeled after
x-handle-reverse-video.
(make-msdos-frame): Don't use initial-frame-alist and
default-frame-alist. Call msdos-handle-reverse-video.
(msdos-color-aliases): Remove.
(msdos-color-translate, msdos-approximate-color): Remove.
(msdos-color-values): Use 16-bit RGB values. RGB values updated
for better approximation of X colors.
(msdos-face-setup): Call tty-color-clear. Remove code that sets
up tty-color-alist (it is now on startup.el).
(x-display-color-p, x-color-defined-p, x-color-values,
x-defined-colors, face-color-supported-p, face-color-gray-p):
Remove.
* facemenu.el (facemenu-read-color, list-colors-display): Use
defined-colors for all frame types.
(facemenu-color-equal): Use color-values for all frame types.
* faces.el (read-face-attribute): For :foreground and :background
attributes and frames on character terminals, translate the color
to the closest supported one before looking it up in the list of
valid values.
(face-valid-attribute-values): Call defined-colors for all types
of frames.
(defined-colors, color-defined-p, color-values, display-color-p):
New finctions.
(x-defined-colors, x-color-defined-p, x-color-values,
x-display-color-p): Aliases for the above.
* startup.el (command-line): Register terminal colors for frame
types other than x and w32, but only if the terminal supports
colors. Call tty-color-define instead of face-register-tty-color.
* term/x-win.el (xw-defined-colors): Renamed from
x-defined-colors.
* term/w32-win.el (xw-defined-colors): Likewise.
* term/tty-colors.el: New file.
* loadup.el: Load term/tty-colors.
1999-12-06 17:55:00 +00:00
|
|
|
(modify-frame-parameters frame
|
2000-10-16 19:17:35 +00:00
|
|
|
(list (cons 'cursor-color bg)))))))
|
Changes for automatic remapping of X colors on terminal frames:
* term/pc-win.el (msdos-setup-initial-frame): New function, run by
term-setup-hook. Call msdos-remember-default-colors and
msdos-handle-reverse-video.
(msdos-face-setup): Parts of code moved to
msdos-setup-initial-frame.
(msdos-handle-reverse-video): New function, modeled after
x-handle-reverse-video.
(make-msdos-frame): Don't use initial-frame-alist and
default-frame-alist. Call msdos-handle-reverse-video.
(msdos-color-aliases): Remove.
(msdos-color-translate, msdos-approximate-color): Remove.
(msdos-color-values): Use 16-bit RGB values. RGB values updated
for better approximation of X colors.
(msdos-face-setup): Call tty-color-clear. Remove code that sets
up tty-color-alist (it is now on startup.el).
(x-display-color-p, x-color-defined-p, x-color-values,
x-defined-colors, face-color-supported-p, face-color-gray-p):
Remove.
* facemenu.el (facemenu-read-color, list-colors-display): Use
defined-colors for all frame types.
(facemenu-color-equal): Use color-values for all frame types.
* faces.el (read-face-attribute): For :foreground and :background
attributes and frames on character terminals, translate the color
to the closest supported one before looking it up in the list of
valid values.
(face-valid-attribute-values): Call defined-colors for all types
of frames.
(defined-colors, color-defined-p, color-values, display-color-p):
New finctions.
(x-defined-colors, x-color-defined-p, x-color-values,
x-display-color-p): Aliases for the above.
* startup.el (command-line): Register terminal colors for frame
types other than x and w32, but only if the terminal supports
colors. Call tty-color-define instead of face-register-tty-color.
* term/x-win.el (xw-defined-colors): Renamed from
x-defined-colors.
* term/w32-win.el (xw-defined-colors): Likewise.
* term/tty-colors.el: New file.
* loadup.el: Load term/tty-colors.
1999-12-06 17:55:00 +00:00
|
|
|
|
|
|
|
;; This must run after all the default colors are inserted into
|
|
|
|
;; tty-color-alist, since msdos-handle-reverse-video needs to know the
|
2008-08-23 17:01:46 +00:00
|
|
|
;; actual frame colors.
|
Changes for automatic remapping of X colors on terminal frames:
* term/pc-win.el (msdos-setup-initial-frame): New function, run by
term-setup-hook. Call msdos-remember-default-colors and
msdos-handle-reverse-video.
(msdos-face-setup): Parts of code moved to
msdos-setup-initial-frame.
(msdos-handle-reverse-video): New function, modeled after
x-handle-reverse-video.
(make-msdos-frame): Don't use initial-frame-alist and
default-frame-alist. Call msdos-handle-reverse-video.
(msdos-color-aliases): Remove.
(msdos-color-translate, msdos-approximate-color): Remove.
(msdos-color-values): Use 16-bit RGB values. RGB values updated
for better approximation of X colors.
(msdos-face-setup): Call tty-color-clear. Remove code that sets
up tty-color-alist (it is now on startup.el).
(x-display-color-p, x-color-defined-p, x-color-values,
x-defined-colors, face-color-supported-p, face-color-gray-p):
Remove.
* facemenu.el (facemenu-read-color, list-colors-display): Use
defined-colors for all frame types.
(facemenu-color-equal): Use color-values for all frame types.
* faces.el (read-face-attribute): For :foreground and :background
attributes and frames on character terminals, translate the color
to the closest supported one before looking it up in the list of
valid values.
(face-valid-attribute-values): Call defined-colors for all types
of frames.
(defined-colors, color-defined-p, color-values, display-color-p):
New finctions.
(x-defined-colors, x-color-defined-p, x-color-values,
x-display-color-p): Aliases for the above.
* startup.el (command-line): Register terminal colors for frame
types other than x and w32, but only if the terminal supports
colors. Call tty-color-define instead of face-register-tty-color.
* term/x-win.el (xw-defined-colors): Renamed from
x-defined-colors.
* term/w32-win.el (xw-defined-colors): Likewise.
* term/tty-colors.el: New file.
* loadup.el: Load term/tty-colors.
1999-12-06 17:55:00 +00:00
|
|
|
(defun msdos-setup-initial-frame ()
|
|
|
|
(modify-frame-parameters terminal-frame default-frame-alist)
|
|
|
|
;; This remembers the screen colors after applying default-frame-alist,
|
|
|
|
;; so that all subsequent frames could begin with those colors.
|
|
|
|
(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))
|
|
|
|
|
2008-08-23 17:01:46 +00:00
|
|
|
;; We create frames as if we were a terminal, but without invoking the
|
|
|
|
;; terminal-initialization function. Also, our handling of reverse
|
|
|
|
;; video is slightly different.
|
|
|
|
(defun msdos-create-frame-with-faces (&optional parameters)
|
2011-11-16 12:34:47 +00:00
|
|
|
"Create a frame on MS-DOS display.
|
2008-08-23 17:01:46 +00:00
|
|
|
Optional frame parameters PARAMETERS specify the frame parameters.
|
|
|
|
Parameters not specified by PARAMETERS are taken from
|
|
|
|
`default-frame-alist'. If either PARAMETERS or `default-frame-alist'
|
|
|
|
contains a `reverse' parameter, handle that. Value is the new frame
|
|
|
|
created."
|
Changes for automatic remapping of X colors on terminal frames:
* term/pc-win.el (msdos-setup-initial-frame): New function, run by
term-setup-hook. Call msdos-remember-default-colors and
msdos-handle-reverse-video.
(msdos-face-setup): Parts of code moved to
msdos-setup-initial-frame.
(msdos-handle-reverse-video): New function, modeled after
x-handle-reverse-video.
(make-msdos-frame): Don't use initial-frame-alist and
default-frame-alist. Call msdos-handle-reverse-video.
(msdos-color-aliases): Remove.
(msdos-color-translate, msdos-approximate-color): Remove.
(msdos-color-values): Use 16-bit RGB values. RGB values updated
for better approximation of X colors.
(msdos-face-setup): Call tty-color-clear. Remove code that sets
up tty-color-alist (it is now on startup.el).
(x-display-color-p, x-color-defined-p, x-color-values,
x-defined-colors, face-color-supported-p, face-color-gray-p):
Remove.
* facemenu.el (facemenu-read-color, list-colors-display): Use
defined-colors for all frame types.
(facemenu-color-equal): Use color-values for all frame types.
* faces.el (read-face-attribute): For :foreground and :background
attributes and frames on character terminals, translate the color
to the closest supported one before looking it up in the list of
valid values.
(face-valid-attribute-values): Call defined-colors for all types
of frames.
(defined-colors, color-defined-p, color-values, display-color-p):
New finctions.
(x-defined-colors, x-color-defined-p, x-color-values,
x-display-color-p): Aliases for the above.
* startup.el (command-line): Register terminal colors for frame
types other than x and w32, but only if the terminal supports
colors. Call tty-color-define instead of face-register-tty-color.
* term/x-win.el (xw-defined-colors): Renamed from
x-defined-colors.
* term/w32-win.el (xw-defined-colors): Likewise.
* term/tty-colors.el: New file.
* loadup.el: Load term/tty-colors.
1999-12-06 17:55:00 +00:00
|
|
|
(let ((frame (make-terminal-frame parameters))
|
|
|
|
success)
|
1999-08-10 10:21:18 +00:00
|
|
|
(unwind-protect
|
2008-08-23 17:01:46 +00:00
|
|
|
(with-selected-frame frame
|
Changes for automatic remapping of X colors on terminal frames:
* term/pc-win.el (msdos-setup-initial-frame): New function, run by
term-setup-hook. Call msdos-remember-default-colors and
msdos-handle-reverse-video.
(msdos-face-setup): Parts of code moved to
msdos-setup-initial-frame.
(msdos-handle-reverse-video): New function, modeled after
x-handle-reverse-video.
(make-msdos-frame): Don't use initial-frame-alist and
default-frame-alist. Call msdos-handle-reverse-video.
(msdos-color-aliases): Remove.
(msdos-color-translate, msdos-approximate-color): Remove.
(msdos-color-values): Use 16-bit RGB values. RGB values updated
for better approximation of X colors.
(msdos-face-setup): Call tty-color-clear. Remove code that sets
up tty-color-alist (it is now on startup.el).
(x-display-color-p, x-color-defined-p, x-color-values,
x-defined-colors, face-color-supported-p, face-color-gray-p):
Remove.
* facemenu.el (facemenu-read-color, list-colors-display): Use
defined-colors for all frame types.
(facemenu-color-equal): Use color-values for all frame types.
* faces.el (read-face-attribute): For :foreground and :background
attributes and frames on character terminals, translate the color
to the closest supported one before looking it up in the list of
valid values.
(face-valid-attribute-values): Call defined-colors for all types
of frames.
(defined-colors, color-defined-p, color-values, display-color-p):
New finctions.
(x-defined-colors, x-color-defined-p, x-color-values,
x-display-color-p): Aliases for the above.
* startup.el (command-line): Register terminal colors for frame
types other than x and w32, but only if the terminal supports
colors. Call tty-color-define instead of face-register-tty-color.
* term/x-win.el (xw-defined-colors): Renamed from
x-defined-colors.
* term/w32-win.el (xw-defined-colors): Likewise.
* term/tty-colors.el: New file.
* loadup.el: Load term/tty-colors.
1999-12-06 17:55:00 +00:00
|
|
|
(msdos-handle-reverse-video frame (frame-parameters frame))
|
2008-08-23 17:01:46 +00:00
|
|
|
(unless (terminal-parameter frame 'terminal-initted)
|
|
|
|
(set-terminal-parameter frame 'terminal-initted t))
|
1999-08-10 10:21:18 +00:00
|
|
|
(frame-set-background-mode frame)
|
|
|
|
(face-set-after-frame-default frame)
|
|
|
|
(setq success t))
|
|
|
|
(unless success (delete-frame frame)))
|
1997-07-13 20:52:08 +00:00
|
|
|
frame))
|
1996-06-10 21:19:59 +00:00
|
|
|
|
1994-10-17 08:04:13 +00:00
|
|
|
;; ---------------------------------------------------------------------------
|
1996-01-05 22:21:28 +00:00
|
|
|
;; More or less useful imitations of certain X-functions. A lot of the
|
1994-10-17 08:04:13 +00:00
|
|
|
;; values returned are questionable, but usually only the form of the
|
|
|
|
;; returned value matters. Also, by the way, recall that `ignore' is
|
|
|
|
;; a useful function for returning 'nil regardless of argument.
|
|
|
|
|
2012-03-06 19:48:46 +00:00
|
|
|
;; Note: Any re-definition in this file of a function that is defined
|
|
|
|
;; in C on other platforms, should either have no doc-string, or one
|
|
|
|
;; that is identical to the C version, but with the arglist signature
|
|
|
|
;; at the end. Otherwise help-split-fundoc gets confused on other
|
|
|
|
;; platforms. (Bug#10783)
|
|
|
|
|
1994-10-17 08:04:13 +00:00
|
|
|
;; From src/xfns.c
|
2013-08-08 23:59:14 +00:00
|
|
|
(defun x-list-fonts (_pattern &optional _face _frame _maximum width)
|
Fix the MSDOS build.
src/unexcoff.c [MSDOS]: Include libc/atexit.h.
(copy_text_and_data): Zero out the atexit chain pointer before
dumping Emacs.
src/termhooks.h (encode_terminal_code): Update prototype.
src/term.c (encode_terminal_code) [DOS_NT]: Make it externally
visible for all DOS_NT ports, not just WINDOWSNT.
(syms_of_term) [!MSDOS]: Don't define 'tty-menu-*' symbols on MSDOS.
src/sysdep.c (emacs_sigaction_init, init_signals): Don't use SIGCHLD
unless it is defined.
(emacs_pipe) [MSDOS]: Redirect to 'pipe'.
src/process.c (close_on_exec, accept4, process_socket): Move into
the "ifdef subprocesses" part.
(catch_child_signal): Condition by "ifdef subprocesses".
(syms_of_process) <Qinternal_default_process_sentinel>
<Qinternal_default_process_filter>: Condition by "ifdef subprocesses".
src/msdos.h: Add prototypes for new functions.
(EINPROGRESS): Define.
(O_CLOEXEC): Define to zero.
src/msdos.c (check_window_system): Remove unnecessary an
incompatible duplicate function.
(sys_opendir, readlinkat, faccessat, fstatat, unsetenv): New
functions in support of new functionality.
src/menu.c (single_menu_item): Add visual indication of submenu
also for menus on MSDOS frames.
(Fx_popup_menu) [!MSDOS]: Do not call tty_menu_show on MSDOS.
src/lisp.h (CHECK_PROCESS) [!subprocesses]: Do not define
when async subprocesses aren't supported.
src/font.h (FONT_WIDTH) [MSDOS]: MSDOS-specific definition.
src/emacs.c (close_output_streams): Zero out errno before calling
close_stream.
src/dired.c [MSDOS]: Include msdos.h.
src/conf_post.h (opendir) [MSDOS]: Redirect to sys_opendir.
(DATA_START) [MSDOS]: Define.
(SYSTEM_PURESIZE_EXTRA) [MSDOS]: Enlarge by 25K.
src/callproc.c (block_child_signal, unblock_child_signal) [MSDOS]:
Ifdef away for MSDOS.
(record_kill_process) [MSDOS]: Ifdef away the entire body for MSDOS.
(call_process_cleanup) [MSDOS]: Ifdef away portions not relevant
for MSDOS.
(call_process) [MSDOS]: Fix call sequence of dostounix_filename.
Use temporary file template that is compatible with mkostemp.
Move vfork-related portions under #ifndef MSDOS.
(syms_of_callproc): Unify templates of MSDOS and WINDOWSNT.
lisp/term/pc-win.el (x-list-fonts, x-get-selection-value): Provide
doc strings, as required by snarf-documentation.
msdos/sedlisp.inp:
msdos/sedlibmk.inp:
msdos/sedleim.inp:
msdos/sed3v2.inp:
msdos/sed2v2.inp:
msdos/sed1v2.inp: Update Sed scripts for Emacs 24.4.
msdos/inttypes.h: Add PRIdMAX.
msdos/INSTALL: Update for Emacs 24.4.
msdos/sedadmin.inp: New file.
2014-04-16 13:27:28 +00:00
|
|
|
"Return a list of the names of available fonts matching PATTERN.
|
|
|
|
If optional arguments FACE and FRAME are specified, return only fonts
|
|
|
|
the same size as FACE on FRAME.
|
|
|
|
|
|
|
|
PATTERN should be a string containing a font name in the XLFD,
|
|
|
|
Fontconfig, or GTK format. A font name given in the XLFD format may
|
|
|
|
contain wildcard characters:
|
|
|
|
the * character matches any substring, and
|
|
|
|
the ? character matches any single character.
|
|
|
|
PATTERN is case-insensitive.
|
|
|
|
|
|
|
|
The return value is a list of strings, suitable as arguments to
|
|
|
|
\`set-face-font'.
|
|
|
|
|
|
|
|
Fonts Emacs can't use may or may not be excluded
|
|
|
|
even if they match PATTERN and FACE.
|
|
|
|
The optional fourth argument MAXIMUM sets a limit on how many
|
|
|
|
fonts to match. The first MAXIMUM fonts are reported.
|
|
|
|
The optional fifth argument WIDTH, if specified, is a number of columns
|
|
|
|
occupied by a character of a font. In that case, return only fonts
|
|
|
|
the WIDTH times as wide as FACE on FRAME."
|
1999-08-15 11:42:08 +00:00
|
|
|
(if (or (null width) (and (numberp width) (= width 1)))
|
|
|
|
(list "ms-dos")
|
1997-08-07 17:33:49 +00:00
|
|
|
(list "no-such-font")))
|
1996-02-08 17:49:24 +00:00
|
|
|
(defun x-display-pixel-width (&optional frame) (frame-width frame))
|
|
|
|
(defun x-display-pixel-height (&optional frame) (frame-height frame))
|
2013-08-08 23:59:14 +00:00
|
|
|
(defun x-display-planes (&optional _frame) 4) ;bg switched to 16 colors as well
|
|
|
|
(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) ; Guess the size of my
|
|
|
|
(defun x-display-mm-width (&optional _frame) 322) ; monitor, EZ...
|
|
|
|
(defun x-display-backing-store (&optional _frame) 'not-useful)
|
|
|
|
(defun x-display-visual-class (&optional _frame) 'static-color)
|
1994-10-17 08:04:13 +00:00
|
|
|
(fset 'x-display-save-under 'ignore)
|
|
|
|
(fset 'x-get-resource 'ignore)
|
1998-10-14 15:11:12 +00:00
|
|
|
|
1994-10-17 08:04:13 +00:00
|
|
|
;; From lisp/term/x-win.el
|
Changes for automatic remapping of X colors on terminal frames:
* term/pc-win.el (msdos-setup-initial-frame): New function, run by
term-setup-hook. Call msdos-remember-default-colors and
msdos-handle-reverse-video.
(msdos-face-setup): Parts of code moved to
msdos-setup-initial-frame.
(msdos-handle-reverse-video): New function, modeled after
x-handle-reverse-video.
(make-msdos-frame): Don't use initial-frame-alist and
default-frame-alist. Call msdos-handle-reverse-video.
(msdos-color-aliases): Remove.
(msdos-color-translate, msdos-approximate-color): Remove.
(msdos-color-values): Use 16-bit RGB values. RGB values updated
for better approximation of X colors.
(msdos-face-setup): Call tty-color-clear. Remove code that sets
up tty-color-alist (it is now on startup.el).
(x-display-color-p, x-color-defined-p, x-color-values,
x-defined-colors, face-color-supported-p, face-color-gray-p):
Remove.
* facemenu.el (facemenu-read-color, list-colors-display): Use
defined-colors for all frame types.
(facemenu-color-equal): Use color-values for all frame types.
* faces.el (read-face-attribute): For :foreground and :background
attributes and frames on character terminals, translate the color
to the closest supported one before looking it up in the list of
valid values.
(face-valid-attribute-values): Call defined-colors for all types
of frames.
(defined-colors, color-defined-p, color-values, display-color-p):
New finctions.
(x-defined-colors, x-color-defined-p, x-color-values,
x-display-color-p): Aliases for the above.
* startup.el (command-line): Register terminal colors for frame
types other than x and w32, but only if the terminal supports
colors. Call tty-color-define instead of face-register-tty-color.
* term/x-win.el (xw-defined-colors): Renamed from
x-defined-colors.
* term/w32-win.el (xw-defined-colors): Likewise.
* term/tty-colors.el: New file.
* loadup.el: Load term/tty-colors.
1999-12-06 17:55:00 +00:00
|
|
|
(defvar x-display-name "pc"
|
2009-07-25 09:31:05 +00:00
|
|
|
"The name of the window display on which Emacs was started.
|
|
|
|
On X, the display name of individual X frames is recorded in the
|
|
|
|
`display' frame parameter.")
|
1999-08-15 11:42:08 +00:00
|
|
|
(defvar x-colors (mapcar 'car msdos-color-values)
|
2009-07-25 09:31:05 +00:00
|
|
|
"List of basic colors available on color displays.
|
|
|
|
For X, the list comes from the `rgb.txt' file,v 10.41 94/02/20.
|
|
|
|
For Nextstep, this is a list of non-PANTONE colors returned by
|
|
|
|
the operating system.")
|
1999-07-30 08:51:19 +00:00
|
|
|
|
1998-04-22 13:45:00 +00:00
|
|
|
;; From lisp/term/w32-win.el
|
1997-04-15 15:00:38 +00:00
|
|
|
;
|
2010-09-02 10:17:02 +00:00
|
|
|
;;;; Selections
|
1996-01-02 23:04:42 +00:00
|
|
|
;
|
Consolidate management/ownership of selections.
* lisp/select.el (gui-get-selection-alist): New method.
(gui-get-selection): Use it. Rename from x-get-selection.
(x-get-selection): Define as obsolete alias.
(x-get-clipboard): Mark obsolete.
(gui-get-primary-selection): New function.
(x-get-selection-value): Mark obsolete.
(gui-own-selection-alist, gui-disown-selection-alist)
(gui-selection-owner-p-alist): New methods.
(gui-set-selection): Use them. Rename from x-set-selection.
(x-set-selection): Define as obsolete alias.
(gui--valid-simple-selection-p): Rename from
x-valid-simple-selection-p.
* lisp/w32-common-fns.el (gui-own-selection, gui-disown-selection)
(gui-selection-owner-p, gui-get-selection): Define for w32.
(w32-get-selection-value): Rename from x-get-selection-value.
Use the new gui-last-selected-text.
* lisp/term/x-win.el (x-get-selection-value): Remove.
(x-clipboard-yank): Declare obsolete.
(gui-own-selection, gui-disown-selection, gui-get-selection)
(gui-selection-owner-p): Define for x.
* lisp/term/w32-win.el (w32-win-suspend-error): Rename from
x-win-suspend-error.
* lisp/term/pc-win.el (w16-get-selection-value): Rename from
x-get-selection-value.
(w16-selection-owner-p): Rename from x-selection-owner-p.
(gui-own-selection, gui-disown-selection, gui-get-selection)
(gui-selection-owner-p): Define for pc.
(w16--select-text): New function.
* lisp/term/ns-win.el (gui-own-selection, gui-disown-selection)
(gui-get-selection, gui-selection-owner-p): Define for ns.
* lisp/term.el (term-mouse-paste):
* lisp/mouse.el (mouse-yank-primary): Use gui-get-primary-selection.
* src/nsselect.m (ns-own-selection-internal, ns-disown-selection-internal):
Rename from the "x-" prefix.
2014-10-02 03:19:32 +00:00
|
|
|
(defun w16-get-selection-value ()
|
Fix the MSDOS build.
src/unexcoff.c [MSDOS]: Include libc/atexit.h.
(copy_text_and_data): Zero out the atexit chain pointer before
dumping Emacs.
src/termhooks.h (encode_terminal_code): Update prototype.
src/term.c (encode_terminal_code) [DOS_NT]: Make it externally
visible for all DOS_NT ports, not just WINDOWSNT.
(syms_of_term) [!MSDOS]: Don't define 'tty-menu-*' symbols on MSDOS.
src/sysdep.c (emacs_sigaction_init, init_signals): Don't use SIGCHLD
unless it is defined.
(emacs_pipe) [MSDOS]: Redirect to 'pipe'.
src/process.c (close_on_exec, accept4, process_socket): Move into
the "ifdef subprocesses" part.
(catch_child_signal): Condition by "ifdef subprocesses".
(syms_of_process) <Qinternal_default_process_sentinel>
<Qinternal_default_process_filter>: Condition by "ifdef subprocesses".
src/msdos.h: Add prototypes for new functions.
(EINPROGRESS): Define.
(O_CLOEXEC): Define to zero.
src/msdos.c (check_window_system): Remove unnecessary an
incompatible duplicate function.
(sys_opendir, readlinkat, faccessat, fstatat, unsetenv): New
functions in support of new functionality.
src/menu.c (single_menu_item): Add visual indication of submenu
also for menus on MSDOS frames.
(Fx_popup_menu) [!MSDOS]: Do not call tty_menu_show on MSDOS.
src/lisp.h (CHECK_PROCESS) [!subprocesses]: Do not define
when async subprocesses aren't supported.
src/font.h (FONT_WIDTH) [MSDOS]: MSDOS-specific definition.
src/emacs.c (close_output_streams): Zero out errno before calling
close_stream.
src/dired.c [MSDOS]: Include msdos.h.
src/conf_post.h (opendir) [MSDOS]: Redirect to sys_opendir.
(DATA_START) [MSDOS]: Define.
(SYSTEM_PURESIZE_EXTRA) [MSDOS]: Enlarge by 25K.
src/callproc.c (block_child_signal, unblock_child_signal) [MSDOS]:
Ifdef away for MSDOS.
(record_kill_process) [MSDOS]: Ifdef away the entire body for MSDOS.
(call_process_cleanup) [MSDOS]: Ifdef away portions not relevant
for MSDOS.
(call_process) [MSDOS]: Fix call sequence of dostounix_filename.
Use temporary file template that is compatible with mkostemp.
Move vfork-related portions under #ifndef MSDOS.
(syms_of_callproc): Unify templates of MSDOS and WINDOWSNT.
lisp/term/pc-win.el (x-list-fonts, x-get-selection-value): Provide
doc strings, as required by snarf-documentation.
msdos/sedlisp.inp:
msdos/sedlibmk.inp:
msdos/sedleim.inp:
msdos/sed3v2.inp:
msdos/sed2v2.inp:
msdos/sed1v2.inp: Update Sed scripts for Emacs 24.4.
msdos/inttypes.h: Add PRIdMAX.
msdos/INSTALL: Update for Emacs 24.4.
msdos/sedadmin.inp: New file.
2014-04-16 13:27:28 +00:00
|
|
|
"Return the value of the current selection.
|
|
|
|
Consult the selection. Treat empty strings as if they were unset."
|
2014-10-01 22:13:11 +00:00
|
|
|
(if gui-select-enable-clipboard
|
2014-10-03 01:39:49 +00:00
|
|
|
;; Don't die if x-get-selection signals an error.
|
|
|
|
(with-demoted-errors "w16-get-clipboard-data:%s"
|
|
|
|
(w16-get-clipboard-data))))
|
1997-04-15 15:00:38 +00:00
|
|
|
|
Consolidate management/ownership of selections.
* lisp/select.el (gui-get-selection-alist): New method.
(gui-get-selection): Use it. Rename from x-get-selection.
(x-get-selection): Define as obsolete alias.
(x-get-clipboard): Mark obsolete.
(gui-get-primary-selection): New function.
(x-get-selection-value): Mark obsolete.
(gui-own-selection-alist, gui-disown-selection-alist)
(gui-selection-owner-p-alist): New methods.
(gui-set-selection): Use them. Rename from x-set-selection.
(x-set-selection): Define as obsolete alias.
(gui--valid-simple-selection-p): Rename from
x-valid-simple-selection-p.
* lisp/w32-common-fns.el (gui-own-selection, gui-disown-selection)
(gui-selection-owner-p, gui-get-selection): Define for w32.
(w32-get-selection-value): Rename from x-get-selection-value.
Use the new gui-last-selected-text.
* lisp/term/x-win.el (x-get-selection-value): Remove.
(x-clipboard-yank): Declare obsolete.
(gui-own-selection, gui-disown-selection, gui-get-selection)
(gui-selection-owner-p): Define for x.
* lisp/term/w32-win.el (w32-win-suspend-error): Rename from
x-win-suspend-error.
* lisp/term/pc-win.el (w16-get-selection-value): Rename from
x-get-selection-value.
(w16-selection-owner-p): Rename from x-selection-owner-p.
(gui-own-selection, gui-disown-selection, gui-get-selection)
(gui-selection-owner-p): Define for pc.
(w16--select-text): New function.
* lisp/term/ns-win.el (gui-own-selection, gui-disown-selection)
(gui-get-selection, gui-selection-owner-p): Define for ns.
* lisp/term.el (term-mouse-paste):
* lisp/mouse.el (mouse-yank-primary): Use gui-get-primary-selection.
* src/nsselect.m (ns-own-selection-internal, ns-disown-selection-internal):
Rename from the "x-" prefix.
2014-10-02 03:19:32 +00:00
|
|
|
;; gui-selection-owner-p is used in simple.el.
|
2014-10-10 03:28:24 +00:00
|
|
|
(gui-method-define gui-selection-exists-p pc #'x-selection-exists-p)
|
Consolidate management/ownership of selections.
* lisp/select.el (gui-get-selection-alist): New method.
(gui-get-selection): Use it. Rename from x-get-selection.
(x-get-selection): Define as obsolete alias.
(x-get-clipboard): Mark obsolete.
(gui-get-primary-selection): New function.
(x-get-selection-value): Mark obsolete.
(gui-own-selection-alist, gui-disown-selection-alist)
(gui-selection-owner-p-alist): New methods.
(gui-set-selection): Use them. Rename from x-set-selection.
(x-set-selection): Define as obsolete alias.
(gui--valid-simple-selection-p): Rename from
x-valid-simple-selection-p.
* lisp/w32-common-fns.el (gui-own-selection, gui-disown-selection)
(gui-selection-owner-p, gui-get-selection): Define for w32.
(w32-get-selection-value): Rename from x-get-selection-value.
Use the new gui-last-selected-text.
* lisp/term/x-win.el (x-get-selection-value): Remove.
(x-clipboard-yank): Declare obsolete.
(gui-own-selection, gui-disown-selection, gui-get-selection)
(gui-selection-owner-p): Define for x.
* lisp/term/w32-win.el (w32-win-suspend-error): Rename from
x-win-suspend-error.
* lisp/term/pc-win.el (w16-get-selection-value): Rename from
x-get-selection-value.
(w16-selection-owner-p): Rename from x-selection-owner-p.
(gui-own-selection, gui-disown-selection, gui-get-selection)
(gui-selection-owner-p): Define for pc.
(w16--select-text): New function.
* lisp/term/ns-win.el (gui-own-selection, gui-disown-selection)
(gui-get-selection, gui-selection-owner-p): Define for ns.
* lisp/term.el (term-mouse-paste):
* lisp/mouse.el (mouse-yank-primary): Use gui-get-primary-selection.
* src/nsselect.m (ns-own-selection-internal, ns-disown-selection-internal):
Rename from the "x-" prefix.
2014-10-02 03:19:32 +00:00
|
|
|
(gui-method-define gui-selection-owner-p pc #'w16-selection-owner-p)
|
|
|
|
(defun w16-selection-owner-p (_selection)
|
|
|
|
;; FIXME: Other systems don't obey gui-select-enable-clipboard here.
|
|
|
|
(if gui-select-enable-clipboard
|
|
|
|
(let ((text
|
|
|
|
;; Don't die if w16-get-clipboard-data signals an error.
|
|
|
|
(ignore-errors
|
|
|
|
(w16-get-clipboard-data))))
|
|
|
|
;; We consider ourselves the owner of the selection
|
|
|
|
;; if it does not exist, or exists and compares
|
|
|
|
;; equal with the last text we've put into the
|
|
|
|
;; Windows clipboard.
|
|
|
|
(cond
|
|
|
|
((not text) t)
|
|
|
|
((or (eq text gui-last-selected-text)
|
|
|
|
(string= text gui-last-selected-text))
|
|
|
|
text)
|
|
|
|
(t nil)))))
|
|
|
|
|
|
|
|
;; gui-own-selection and gui-disown-selection are used in gui-set-selection.
|
|
|
|
(gui-method-define gui-own-selection pc
|
|
|
|
(lambda (_selection value)
|
|
|
|
;; FIXME: Other systems don't obey
|
|
|
|
;; gui-select-enable-clipboard here.
|
|
|
|
(ignore-errors
|
|
|
|
(w16--select-text value))
|
|
|
|
value))
|
|
|
|
|
|
|
|
(gui-method-define gui-disown-selection pc
|
|
|
|
(lambda (selection &optional _time-object _terminal)
|
|
|
|
(if (w16-selection-owner-p selection)
|
|
|
|
t)))
|
|
|
|
|
|
|
|
;; gui-get-selection is used in select.el
|
|
|
|
(gui-method-define gui-get-selection pc
|
|
|
|
(lambda (selection-symbol target-type)
|
|
|
|
(w16-get-selection-value)))
|
2010-11-26 18:38:40 +00:00
|
|
|
|
1997-08-07 17:33:49 +00:00
|
|
|
;; From src/fontset.c:
|
|
|
|
(fset 'query-fontset 'ignore)
|
|
|
|
|
1996-12-08 08:24:03 +00:00
|
|
|
;; From lisp/term/x-win.el: make iconify-or-deiconify-frame a no-op.
|
|
|
|
(fset 'iconify-or-deiconify-frame 'ignore)
|
|
|
|
|
1994-10-17 08:04:13 +00:00
|
|
|
;; From lisp/frame.el
|
|
|
|
(fset 'set-default-font 'ignore)
|
|
|
|
(fset 'set-mouse-color 'ignore) ; We cannot, I think.
|
|
|
|
(fset 'set-cursor-color 'ignore) ; Hardware determined by char under.
|
|
|
|
(fset 'set-border-color 'ignore) ; Not useful.
|
1997-10-13 16:05:32 +00:00
|
|
|
|
2009-04-08 13:51:48 +00:00
|
|
|
(defvar msdos-last-help-message nil
|
|
|
|
"The last help message received via `show-help-function'.
|
|
|
|
This is used by `msdos-show-help'.")
|
|
|
|
|
2008-08-28 20:05:54 +00:00
|
|
|
(defvar msdos-previous-message nil
|
|
|
|
"The content of the echo area before help echo was displayed.")
|
|
|
|
|
|
|
|
(defun msdos-show-help (help)
|
2008-11-14 13:05:18 +00:00
|
|
|
"Function installed as `show-help-function' on MS-DOS frames."
|
2008-08-28 20:05:54 +00:00
|
|
|
(when (and (not (window-minibuffer-p)) ;Don't overwrite minibuffer contents.
|
|
|
|
(not cursor-in-echo-area)) ;Don't overwrite a prompt.
|
|
|
|
(cond
|
|
|
|
((stringp help)
|
2009-04-08 13:51:48 +00:00
|
|
|
(setq help (replace-regexp-in-string "\n" ", " help))
|
|
|
|
(unless (or msdos-previous-message
|
|
|
|
(string-equal help (current-message))
|
|
|
|
(and (stringp msdos-last-help-message)
|
|
|
|
(string-equal msdos-last-help-message
|
|
|
|
(current-message))))
|
2008-08-28 20:05:54 +00:00
|
|
|
(setq msdos-previous-message (current-message)))
|
2009-04-08 13:51:48 +00:00
|
|
|
(setq msdos-last-help-message help)
|
2008-09-06 12:52:42 +00:00
|
|
|
(let ((message-truncate-lines nil)
|
2008-08-28 20:05:54 +00:00
|
|
|
(message-log-max nil))
|
2009-04-08 13:51:48 +00:00
|
|
|
(message "%s" help)))
|
2008-08-28 20:05:54 +00:00
|
|
|
((stringp msdos-previous-message)
|
|
|
|
(let ((message-log-max nil))
|
|
|
|
(message "%s" msdos-previous-message)
|
|
|
|
(setq msdos-previous-message nil)))
|
|
|
|
(t
|
|
|
|
(message nil)))))
|
|
|
|
|
|
|
|
|
2008-08-23 17:01:46 +00:00
|
|
|
;; Initialization.
|
1994-10-17 08:04:13 +00:00
|
|
|
;; ---------------------------------------------------------------------------
|
2008-08-23 17:01:46 +00:00
|
|
|
;; This function is run, by faces.el:tty-create-frame-with-faces, only
|
|
|
|
;; for the initial frame (on each terminal, but we have only one).
|
|
|
|
;; This works by setting the `terminal-initted' terminal parameter to
|
|
|
|
;; this function, the first time `tty-create-frame-with-faces' is
|
|
|
|
;; called on that terminal. `tty-create-frame-with-faces' is called
|
|
|
|
;; directly from startup.el and also by `make-frame' through
|
|
|
|
;; `frame-creation-function-alist'. `make-frame' will call this
|
|
|
|
;; function if `msdos-create-frame-with-faces' (see below) is not
|
|
|
|
;; found in `frame-creation-function-alist', which means something is
|
|
|
|
;; _very_ wrong, because "internal" terminal emulator should not be
|
|
|
|
;; turned on if our window-system is not `pc'. Therefore, the only
|
|
|
|
;; Right Thing for us to do here is scream bloody murder.
|
|
|
|
(defun terminal-init-internal ()
|
|
|
|
"Terminal initialization function for the MS-DOS \"internal\" terminal.
|
|
|
|
Errors out because it is not supposed to be called, ever."
|
|
|
|
(error "terminal-init-internal called for window-system `%s'"
|
|
|
|
(window-system)))
|
|
|
|
|
2013-08-08 23:59:14 +00:00
|
|
|
(defun msdos-initialize-window-system (&optional _display)
|
2008-08-23 17:01:46 +00:00
|
|
|
"Initialization function for the `pc' \"window system\"."
|
|
|
|
(or (eq (window-system) 'pc)
|
|
|
|
(error
|
|
|
|
"`msdos-initialize-window-system' called, but window-system is `%s'"
|
|
|
|
(window-system)))
|
|
|
|
;; First, the keyboard.
|
|
|
|
(msdos-setup-keyboard terminal-frame) ; see internal.el
|
|
|
|
;; Next, register the default colors.
|
|
|
|
(let* ((colors msdos-color-values)
|
|
|
|
(color (car colors)))
|
|
|
|
(tty-color-clear)
|
|
|
|
(while colors
|
|
|
|
(tty-color-define (car color) (cadr color) (cddr color))
|
|
|
|
(setq colors (cdr colors) color (car colors))))
|
|
|
|
;; Modifying color mappings means realized faces don't
|
|
|
|
;; use the right colors, so clear them.
|
|
|
|
(clear-face-cache)
|
|
|
|
;; Now set up some additional faces.
|
|
|
|
(msdos-face-setup)
|
|
|
|
;; Set up the initial frame.
|
|
|
|
(msdos-setup-initial-frame)
|
2008-08-28 20:05:54 +00:00
|
|
|
;; Help echo is displayed in the echo area.
|
|
|
|
(setq show-help-function 'msdos-show-help)
|
2008-08-23 17:01:46 +00:00
|
|
|
;; We want to delay the codepage-related setup until after user's
|
|
|
|
;; .emacs is processed, because people might define their
|
|
|
|
;; `dos-codepage-setup-hook' there.
|
|
|
|
(add-hook 'after-init-hook 'dos-codepage-setup)
|
|
|
|
;; In multibyte mode, we want unibyte buffers to be displayed
|
|
|
|
;; using the terminal coding system, so that they display
|
|
|
|
;; correctly on the DOS terminal; in unibyte mode we want to see
|
|
|
|
;; all 8-bit characters verbatim. In both cases, we want the
|
|
|
|
;; entire range of 8-bit characters to arrive at our display code
|
|
|
|
;; verbatim.
|
|
|
|
(standard-display-8bit 127 255)
|
|
|
|
;; We are fast enough to make this optimization unnecessary.
|
|
|
|
(setq split-window-keep-point t)
|
|
|
|
;; Arrange for the kill and yank functions to set and check the
|
|
|
|
;; clipboard.
|
|
|
|
(menu-bar-enable-clipboard)
|
|
|
|
(run-hooks 'terminal-init-msdos-hook))
|
|
|
|
|
|
|
|
;; frame-creation-function-alist is examined by frame.el:make-frame.
|
2014-10-01 22:13:11 +00:00
|
|
|
(gui-method-define frame-creation-function
|
|
|
|
pc #'msdos-create-frame-with-faces)
|
2008-08-23 17:01:46 +00:00
|
|
|
;; window-system-initialization-alist is examined by startup.el:command-line.
|
2014-10-01 22:13:11 +00:00
|
|
|
(gui-method-define window-system-initialization
|
|
|
|
pc #'msdos-initialize-window-system)
|
2008-08-23 17:01:46 +00:00
|
|
|
;; We don't need anything beyond tty-handle-args for handling
|
|
|
|
;; command-line argument; see startup.el.
|
2014-10-01 22:13:11 +00:00
|
|
|
(gui-method-define handle-args-function pc #'tty-handle-args)
|
|
|
|
|
|
|
|
|
|
|
|
(declare-function w16-set-clipboard-data "w16select.c"
|
|
|
|
(string &optional ignored))
|
Consolidate management/ownership of selections.
* lisp/select.el (gui-get-selection-alist): New method.
(gui-get-selection): Use it. Rename from x-get-selection.
(x-get-selection): Define as obsolete alias.
(x-get-clipboard): Mark obsolete.
(gui-get-primary-selection): New function.
(x-get-selection-value): Mark obsolete.
(gui-own-selection-alist, gui-disown-selection-alist)
(gui-selection-owner-p-alist): New methods.
(gui-set-selection): Use them. Rename from x-set-selection.
(x-set-selection): Define as obsolete alias.
(gui--valid-simple-selection-p): Rename from
x-valid-simple-selection-p.
* lisp/w32-common-fns.el (gui-own-selection, gui-disown-selection)
(gui-selection-owner-p, gui-get-selection): Define for w32.
(w32-get-selection-value): Rename from x-get-selection-value.
Use the new gui-last-selected-text.
* lisp/term/x-win.el (x-get-selection-value): Remove.
(x-clipboard-yank): Declare obsolete.
(gui-own-selection, gui-disown-selection, gui-get-selection)
(gui-selection-owner-p): Define for x.
* lisp/term/w32-win.el (w32-win-suspend-error): Rename from
x-win-suspend-error.
* lisp/term/pc-win.el (w16-get-selection-value): Rename from
x-get-selection-value.
(w16-selection-owner-p): Rename from x-selection-owner-p.
(gui-own-selection, gui-disown-selection, gui-get-selection)
(gui-selection-owner-p): Define for pc.
(w16--select-text): New function.
* lisp/term/ns-win.el (gui-own-selection, gui-disown-selection)
(gui-get-selection, gui-selection-owner-p): Define for ns.
* lisp/term.el (term-mouse-paste):
* lisp/mouse.el (mouse-yank-primary): Use gui-get-primary-selection.
* src/nsselect.m (ns-own-selection-internal, ns-disown-selection-internal):
Rename from the "x-" prefix.
2014-10-02 03:19:32 +00:00
|
|
|
(gui-method-define gui-select-text pc #'w16--select-text)
|
2014-10-03 01:39:49 +00:00
|
|
|
(gui-method-define gui-selection-value pc #'w16-get-selection-value)
|
Consolidate management/ownership of selections.
* lisp/select.el (gui-get-selection-alist): New method.
(gui-get-selection): Use it. Rename from x-get-selection.
(x-get-selection): Define as obsolete alias.
(x-get-clipboard): Mark obsolete.
(gui-get-primary-selection): New function.
(x-get-selection-value): Mark obsolete.
(gui-own-selection-alist, gui-disown-selection-alist)
(gui-selection-owner-p-alist): New methods.
(gui-set-selection): Use them. Rename from x-set-selection.
(x-set-selection): Define as obsolete alias.
(gui--valid-simple-selection-p): Rename from
x-valid-simple-selection-p.
* lisp/w32-common-fns.el (gui-own-selection, gui-disown-selection)
(gui-selection-owner-p, gui-get-selection): Define for w32.
(w32-get-selection-value): Rename from x-get-selection-value.
Use the new gui-last-selected-text.
* lisp/term/x-win.el (x-get-selection-value): Remove.
(x-clipboard-yank): Declare obsolete.
(gui-own-selection, gui-disown-selection, gui-get-selection)
(gui-selection-owner-p): Define for x.
* lisp/term/w32-win.el (w32-win-suspend-error): Rename from
x-win-suspend-error.
* lisp/term/pc-win.el (w16-get-selection-value): Rename from
x-get-selection-value.
(w16-selection-owner-p): Rename from x-selection-owner-p.
(gui-own-selection, gui-disown-selection, gui-get-selection)
(gui-selection-owner-p): Define for pc.
(w16--select-text): New function.
* lisp/term/ns-win.el (gui-own-selection, gui-disown-selection)
(gui-get-selection, gui-selection-owner-p): Define for ns.
* lisp/term.el (term-mouse-paste):
* lisp/mouse.el (mouse-yank-primary): Use gui-get-primary-selection.
* src/nsselect.m (ns-own-selection-internal, ns-disown-selection-internal):
Rename from the "x-" prefix.
2014-10-02 03:19:32 +00:00
|
|
|
(defun w16--select-text (text)
|
|
|
|
(when gui-select-enable-clipboard
|
|
|
|
(w16-set-clipboard-data text)))
|
2008-08-23 17:01:46 +00:00
|
|
|
|
|
|
|
;; ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
(provide 'pc-win)
|
1997-04-20 07:33:52 +00:00
|
|
|
|
|
|
|
;;; pc-win.el ends here
|