;;; pc-win.el --- setup support for `PC windows' (whatever that is)
-;; Copyright (C) 1994, 1996, 1997, 1999, 2001, 2002, 2003, 2004,
-;; 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+;; Copyright (C) 1994, 1996-1997, 1999, 2001-2012
+;; Free Software Foundation, Inc.
;; Author: Morten Welinder <terra@diku.dk>
;; Maintainer: FSF
;; terminal-initialization function. Also, our handling of reverse
;; video is slightly different.
(defun msdos-create-frame-with-faces (&optional parameters)
- "Create an frame on MS-DOS display.
+ "Create a frame on MS-DOS display.
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'
;; From lisp/term/x-win.el
(defvar x-display-name "pc"
- "The display name specifying the MS-DOS display and frame type.")
+ "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.")
(defvar x-colors (mapcar 'car msdos-color-values)
- "The list of colors available on a PC display under MS-DOS.")
+ "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.")
;; From lisp/term/w32-win.el
;
-;;;; Selections and cut buffers
+;;;; Selections
;
;;; We keep track of the last text selected here, so we can check the
;;; current selection against it, and avoid passing back our own text
-;;; from x-cut-buffer-or-selection-value.
+;;; from x-selection-value.
(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."
+This is in addition to, but in preference to, the primary selection.
+
+Note that MS-Windows does not support selection types other than the
+clipboard. (The primary selection that is set by Emacs is not
+accessible to other programs on MS-Windows.)
+
+This variable is not used by the Nextstep port."
:type 'boolean
:group 'killing)
-(defun x-select-text (text &optional push)
+(defun x-select-text (text)
+ "Select TEXT, a string, according to the window system.
+
+On X, if `x-select-enable-clipboard' is non-nil, copy TEXT to the
+clipboard. If `x-select-enable-primary' is non-nil, put TEXT in
+the primary selection.
+
+On Windows, make TEXT the current selection. If
+`x-select-enable-clipboard' is non-nil, copy the text to the
+clipboard as well.
+
+On Nextstep, put TEXT in the pasteboard."
(if x-select-enable-clipboard
(w16-set-clipboard-data text))
(setq x-last-selected-text text))
;;; Return the value of the current selection.
-;;; Consult the selection, then the cut buffer. Treat empty strings
-;;; as if they were unset.
+;;; Consult the selection. Treat empty strings as if they were unset.
(defun x-get-selection-value ()
(if x-select-enable-clipboard
(let (text)
(t
(setq x-last-selected-text text))))))
-;; From lisp/faces.el: we only have one font, so always return
-;; it, no matter which variety they've asked for.
-(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")
+;; x-selection-owner-p is used in simple.el.
+(defun x-selection-owner-p (&optional type)
+ "Whether the current Emacs process owns the given X Selection.
+The arg should be the name of the selection in question, typically one of
+the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'.
+\(Those are literal upper-case symbol names, since that's what X expects.)
+For convenience, the symbol nil is the same as `PRIMARY',
+and t is the same as `SECONDARY'."
+ (if x-select-enable-clipboard
+ (let (text)
+ ;; Don't die if w16-get-clipboard-data signals an error.
+ (ignore-errors
+ (setq text (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 x-last-selected-text)
+ (string= text x-last-selected-text))
+ text)
+ (t nil)))))
+
+;; x-own-selection-internal and x-disown-selection-internal are used
+;; in select.el:x-set-selection.
+(defun x-own-selection-internal (type value)
+ "Assert an X selection of the given TYPE with the given VALUE.
+TYPE is a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD'.
+\(Those are literal upper-case symbol names, since that's what X expects.)
+VALUE is typically a string, or a cons of two markers, but may be
+anything that the functions on `selection-converter-alist' know about."
+ (ignore-errors
+ (x-select-text value))
+ value)
+
+(defun x-disown-selection-internal (selection &optional time)
+ "If we own the selection SELECTION, disown it.
+Disowning it means there is no such selection."
+ (if (x-selection-owner-p selection)
+ t))
+
+;; x-get-selection-internal is used in select.el
+(defun x-get-selection-internal (selection type &optional time_stamp)
+ "Return text selected from some X window.
+SELECTION is a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD'.
+\(Those are literal upper-case symbol names, since that's what X expects.)
+TYPE is the type of data desired, typically `STRING'.
+TIME_STAMP is the time to use in the XConvertSelection call for foreign
+selections. If omitted, defaults to the time for the last event."
+ (x-get-selection-value))
;; From src/fontset.c:
(fset 'query-fontset 'ignore)
(fset 'set-cursor-color 'ignore) ; Hardware determined by char under.
(fset 'set-border-color 'ignore) ; Not useful.
+(defvar msdos-last-help-message nil
+ "The last help message received via `show-help-function'.
+This is used by `msdos-show-help'.")
+
(defvar msdos-previous-message nil
"The content of the echo area before help echo was displayed.")
(defun msdos-show-help (help)
"Function installed as `show-help-function' on MS-DOS frames."
(when (and (not (window-minibuffer-p)) ;Don't overwrite minibuffer contents.
- ;; Don't know how to reproduce it in Elisp:
- ;; Don't overwrite a keystroke echo.
- ;; (NILP (echo_message_buffer) || ok_to_overwrite_keystroke_echo)
(not cursor-in-echo-area)) ;Don't overwrite a prompt.
(cond
((stringp help)
- (unless msdos-previous-message
+ (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))))
(setq msdos-previous-message (current-message)))
+ (setq msdos-last-help-message help)
(let ((message-truncate-lines nil)
(message-log-max nil))
- (message "%s" (replace-regexp-in-string "\n" ", " help))))
+ (message "%s" help)))
((stringp msdos-previous-message)
(let ((message-log-max nil))
(message "%s" msdos-previous-message)
(provide 'pc-win)
-;; arch-tag: 5cbdb455-b495-427b-95d0-e417d77d00b4
;;; pc-win.el ends here