Fix the MSDOS build.
[bpt/emacs.git] / lisp / term / pc-win.el
index d1efd0f..f24a54f 100644 (file)
@@ -1,10 +1,10 @@
 ;;; 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, 2010, 2011 Free Software Foundation, Inc.
+;; Copyright (C) 1994, 1996-1997, 1999, 2001-2014 Free Software
+;; Foundation, Inc.
 
 ;; Author: Morten Welinder <terra@diku.dk>
-;; Maintainer: FSF
+;; Maintainer: emacs-devel@gnu.org
 
 ;; This file is part of GNU Emacs.
 
@@ -40,8 +40,6 @@
     (error "%s: Loading pc-win.el but not compiled for MS-DOS"
           (invocation-name)))
 
-(load "term/internal" nil t)
-
 (declare-function msdos-remember-default-colors "msdos.c")
 (declare-function w16-set-clipboard-data "w16select.c")
 (declare-function w16-get-clipboard-data "w16select.c")
 ;; 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'
@@ -159,23 +157,50 @@ created."
 ;; returned value matters.  Also, by the way, recall that `ignore' is
 ;; a useful function for returning 'nil regardless of argument.
 
+;; 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)
+
 ;; From src/xfns.c
-(defun x-list-fonts (pattern &optional face frame maximum width)
+(defun x-list-fonts (_pattern &optional _face _frame _maximum width)
+  "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."
   (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) ;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)
+(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)
 (fset 'x-display-save-under 'ignore)
 (fset 'x-get-resource 'ignore)
 
@@ -192,51 +217,50 @@ 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 in addition to, but in preference to, the primary selection.
 
-On MS-Windows, this is non-nil by default, since Windows does not
-support other types of selections.  \(The primary selection that is
-set by Emacs is not accessible to other programs on Windows.\)"
+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, put TEXT in the primary X selection.  For backward
-compatibility with older X applications, set the value of X cut
-buffer 0 as well, and if the optional argument PUSH is non-nil,
-rotate the cut buffers.  If `x-select-enable-clipboard' is
-non-nil, copy the text to the X clipboard as well.
+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
+On MS-Windows, make TEXT the current selection.  If
 `x-select-enable-clipboard' is non-nil, copy the text to the
-clipboard as well.  The argument PUSH is ignored.
+clipboard as well.
 
-On Nextstep, put TEXT in the pasteboard; PUSH is ignored."
+On Nextstep, put TEXT in the pasteboard (`x-select-enable-clipboard'
+is not used)."
   (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.
 (defun x-get-selection-value ()
+  "Return the value of the current selection.
+Consult the selection.  Treat empty strings as if they were unset."
   (if x-select-enable-clipboard
       (let (text)
        ;; Don't die if x-get-selection signals an error.
-       (condition-case c
-           (setq text (w16-get-clipboard-data))
-         (error (message "w16-get-clipboard-data:%s" c)))
+       (with-demoted-errors "w16-get-clipboard-data:%s"
+          (setq text (w16-get-clipboard-data)))
        (if (string= text "") (setq text nil))
        (cond
         ((not text) nil)
@@ -249,13 +273,21 @@ On Nextstep, put TEXT in the pasteboard; PUSH is ignored."
          (setq x-last-selected-text text))))))
 
 ;; x-selection-owner-p is used in simple.el.
-(defun x-selection-owner-p (&optional type)
+(defun x-selection-owner-p (&optional _selection _terminal)
   "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'."
+and t is the same as `SECONDARY'.
+
+TERMINAL should be a terminal object or a frame specifying the X
+server to query.  If omitted or nil, that stands for the selected
+frame's display, or the first available X display.
+
+On Nextstep, TERMINAL is unused.
+
+\(fn &optional SELECTION TERMINAL)"
     (if x-select-enable-clipboard
       (let (text)
        ;; Don't die if w16-get-clipboard-data signals an error.
@@ -273,30 +305,60 @@ and t is the same as `SECONDARY'."
 
 ;; 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'.
+(defun x-own-selection-internal (_selection value &optional _frame)
+  "Assert an X selection of the type SELECTION with and value VALUE.
+SELECTION 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."
+anything that the functions on `selection-converter-alist' know about.
+
+FRAME should be a frame that should own the selection.  If omitted or
+nil, it defaults to the selected frame.
+
+On Nextstep, FRAME is unused.
+
+\(fn SELECTION VALUE &optional FRAME)"
   (ignore-errors
     (x-select-text value))
   value)
 
-(defun x-disown-selection-internal (selection &optional time)
+(defun x-disown-selection-internal (selection &optional _time-object _terminal)
   "If we own the selection SELECTION, disown it.
-Disowning it means there is no such selection."
+Disowning it means there is no such selection.
+
+Sets the last-change time for the selection to TIME-OBJECT (by default
+the time of the last event).
+
+TERMINAL should be a terminal object or a frame specifying the X
+server to query.  If omitted or nil, that stands for the selected
+frame's display, or the first available X display.
+
+On Nextstep, the TIME-OBJECT and TERMINAL arguments are unused.
+On MS-DOS, all this does is return non-nil if we own the selection.
+
+\(fn SELECTION &optional TIME-OBJECT TERMINAL)"
   (if (x-selection-owner-p selection)
       t))
 
-;; 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-get-selection-internal is used in select.el
+(defun x-get-selection-internal (_selection-symbol _target-type
+                                                 &optional _time-stamp _terminal)
+  "Return text selected from some X window.
+SELECTION-SYMBOL is typically `PRIMARY', `SECONDARY', or `CLIPBOARD'.
+\(Those are literal upper-case symbol names, since that's what X expects.)
+TARGET-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.
+
+TERMINAL should be a terminal object or a frame specifying the X
+server to query.  If omitted or nil, that stands for the selected
+frame's display, or the first available X display.
+
+On Nextstep, TIME-STAMP and TERMINAL are unused.
+
+\(fn SELECTION-SYMBOL TARGET-TYPE &optional TIME-STAMP TERMINAL)"
+  (x-get-selection-value))
 
 ;; From src/fontset.c:
 (fset 'query-fontset 'ignore)
@@ -362,7 +424,7 @@ Errors out because it is not supposed to be called, ever."
   (error "terminal-init-internal called for window-system `%s'"
         (window-system)))
 
-(defun msdos-initialize-window-system ()
+(defun msdos-initialize-window-system (&optional _display)
   "Initialization function for the `pc' \"window system\"."
   (or (eq (window-system) 'pc)
       (error
@@ -420,5 +482,4 @@ Errors out because it is not supposed to be called, ever."
 
 (provide 'pc-win)
 
-;; arch-tag: 5cbdb455-b495-427b-95d0-e417d77d00b4
 ;;; pc-win.el ends here