changeset 96699:05aeed7284d3

Fix header format and permissions notice. Add numerous declarations for compiler. (ns-pop-up-frames): Move definition before use. Doc fix.
author Glenn Morris <rgm@gnu.org>
date Wed, 16 Jul 2008 02:27:49 +0000
parents 5ad540dfca23
children d901048b24a0
files lisp/term/ns-win.el
diffstat 1 files changed, 98 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/term/ns-win.el	Wed Jul 16 02:26:16 2008 +0000
+++ b/lisp/term/ns-win.el	Wed Jul 16 02:27:49 2008 +0000
@@ -1,27 +1,24 @@
-;;; ns-win.el --- lisp side of interface with
-;;;               NeXT/Open/GNUstep/MacOS X window system
-;;; Copyright (C) 1993, 1994, 2005, 2006, 2008 Free Software Foundation, Inc.
+;;; ns-win.el --- lisp side of interface with NeXT/Open/GNUstep/MacOS X window system
+
+;; Copyright (C) 1993, 1994, 2005, 2006, 2008 Free Software Foundation, Inc.
 
-;;; Author: Carl Edman, Christian Limpach, Scott Bender, Christophe de Dinechin,
-;;;         Adrian Robert
-;;; Keywords: terminals
+;; Author: Carl Edman, Christian Limpach, Scott Bender, Christophe de Dinechin, Adrian Robert
+;; Keywords: terminals
+
+;; This file is part of GNU Emacs.
 
-;;; This file is part of GNU Emacs.
-;;;
-;;; GNU Emacs is free software; you can redistribute it and/or modify
-;;; it under the terms of the GNU General Public License as published by
-;;; the Free Software Foundation; either version 3, or (at your option)
-;;; any later version.
-;;;
-;;; 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
-;;; along with GNU Emacs; see the file COPYING.  If not, write to
-;;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;;; Boston, MA 02110-1301, USA.
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; 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
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
@@ -54,6 +51,15 @@
 ; Not needed?
 ;(require 'ispell)
 
+;; nsterm.m
+(defvar ns-version-string)
+(defvar ns-expand-space)
+(defvar ns-cursor-blink-rate)
+(defvar ns-alternate-modifier)
+
+(declare-function ns-server-vendor "nsfns.m" (&optional display))
+(declare-function ns-server-version "nsfns.m" (&optional display))
+
 (defun ns-submit-bug-report ()
    "Submit via mail a bug report on Emacs 23.0.0 for GNUstep / OS X."
    (interactive)
@@ -63,7 +69,7 @@
      (reporter-submit-bug-report
       "Adrian Robert <Adrian.B.Robert@gmail.com>"
       ;;"Christophe de Dinechin <descubes@earthlink.net>"
-      ;;"Scott Bender <emacs@harmony-ds.com>" 
+      ;;"Scott Bender <emacs@harmony-ds.com>"
       ;;"Christian Limpach <chris@nice.ch>"
       ;;"Carl Edman <cedman@princeton.edu>"
       (concat "Emacs for GNUstep / OS X " ns-version-string)
@@ -119,6 +125,9 @@
                                   initial-frame-alist)
         ns-invocation-args (cdr ns-invocation-args)))
 
+;; nsterm.m.
+(defvar ns-input-file)
+
 (defun ns-handle-nxopen (switch)
   (setq unread-command-events (append unread-command-events '(ns-open-file))
         ns-input-file (append ns-input-file (list (car ns-invocation-args)))
@@ -317,6 +326,8 @@
 (defun left-one () (interactive) (scroll-left 1))
 (defun right-one () (interactive) (scroll-right 1))
 
+(defvar menu-bar-ns-file-menu)		; below
+
 ;; Toggle some additional NS-like features that may interfere with users'
 ;; expectations coming from emacs on other platforms.
 (define-minor-mode ns-extended-platform-support-mode
@@ -768,6 +779,10 @@
 
 (precompute-menubar-bindings)
 
+;; nsterm.m
+(defvar ns-input-spi-name)
+(defvar ns-input-spi-arg)
+
 (defun ns-spi-service-call ()
   "Respond to a service request to Emacs.app."
   (interactive)
@@ -830,6 +845,8 @@
   (interactive)
   (if (ns-in-echo-area) (ns-echo-working-text) (ns-put-working-text)))
 
+(defvar ns-working-text)		; nsterm.m
+
 (defun ns-put-working-text ()
   "Insert contents of ns-working-text as UTF8 string and mark with
 ns-working-overlay.  Any previously existing working text is cleared first.
@@ -872,6 +889,8 @@
     (setq ns-working-overlay nil)))
 
 
+(declare-function ns-convert-utf8-nfd-to-nfc "nsfns.m" (str))
+
 ;;;; OS X file system Unicode UTF-8 NFD (decomposed form) support
 ;; Lisp code based on utf-8m.el, by Seiji Zenitani, Eiji Honjoh, and
 ;; Carsten Bormann.
@@ -905,12 +924,14 @@
 
 ;;;; Inter-app communications support.
 
+(defvar ns-input-text)			; nsterm.m
+
 (defun ns-insert-text ()
   "Insert contents of ns-input-text at point."
   (interactive)
   (insert ns-input-text)
   (setq ns-input-text nil))
- 
+
 (defun ns-insert-file ()
   "Insert contents of file ns-input-file like insert-file but with less
 prompting.  If file is a directory perform a find-file on it."
@@ -926,6 +947,8 @@
   "Overlay used to highlight areas in files requested by NS apps.")
 (make-variable-buffer-local 'ns-select-overlay)
 
+(defvar ns-input-line) 			; nsterm.m
+
 (defun ns-open-file-select-line ()
   "Brings up a buffer containing file ns-input-file,\n\
 and highlights lines indicated by ns-input-line."
@@ -970,6 +993,7 @@
 
 
 ;;;; Preferences handling.
+(declare-function ns-get-resource "nsfns.m" (owner name))
 
 (defun get-lisp-resource (arg1 arg2)
   (let ((res (ns-get-resource arg1 arg2)))
@@ -979,6 +1003,19 @@
      ((string-equal (upcase res) "NO")  nil)
      (t (read res)))))
 
+;; nsterm.m
+(defvar ns-command-modifier)
+(defvar ns-control-modifier)
+(defvar ns-function-modifier)
+(defvar ns-antialias-text)
+(defvar ns-use-qd-smoothing)
+(defvar ns-use-system-highlight-color)
+
+(declare-function ns-set-resource "nsfns.m" (owner name value))
+(declare-function ns-font-name "nsfns.m" (name))
+(declare-function ns-read-file-name "nsfns.m"
+		  (prompt &optional dir isLoad init))
+
 (defun ns-save-preferences ()
   "Set all the defaults."
   (interactive)
@@ -1089,6 +1126,8 @@
                           (if stipple stipple nil))))
       (setq fl (cdr fl)))))
 
+(declare-function menu-bar-options-save-orig "ns-win" () t)
+
 ;; call ns-save-preferences when menu-bar-options-save is called
 (fset 'menu-bar-options-save-orig (symbol-function 'menu-bar-options-save))
 (defun ns-save-options ()
@@ -1117,6 +1156,13 @@
     (message ns-output-file)
     (if ns-output-file (write-file ns-output-file))))
 
+(defvar ns-pop-up-frames 'fresh
+  "*Non-nil means open files upon request from the Workspace in a new frame.
+If t, always do so.  Any other non-nil value means open a new frame
+unless the current buffer is a scratch buffer.")
+
+(declare-function ns-hide-emacs "nsfns.m" (on))
+
 (defun ns-find-file ()
   "Do a find-file with the ns-input-file as argument."
   (interactive)
@@ -1151,11 +1197,6 @@
 ;; Don't show the frame name; that's redundant with NS.
 (setq-default mode-line-frame-identification '("  "))
 
-(defvar ns-pop-up-frames 'fresh
-  "* Should file opened upon request from the Workspace be opened in a new frame ?
-If t, always.  If nil, never.  Otherwise a new frame is opened
-unless the current buffer is a scratch buffer.")
-
 ;; You say tomAYto, I say tomAHto..
 (defvaralias 'ns-option-modifier 'ns-alternate-modifier)
 
@@ -1163,10 +1204,14 @@
   (interactive)
   (ns-hide-emacs t))
 
+(declare-function ns-hide-others "nsfns.m" ())
+
 (defun ns-do-hide-others ()
   (interactive)
   (ns-hide-others))
 
+(declare-function ns-emacs-info-panel "nsfns.m" ())
+
 (defun ns-do-emacs-info-panel ()
   (interactive)
   (ns-emacs-info-panel))
@@ -1216,6 +1261,8 @@
 				   0 1)) ))
   (if (not tool-bar-mode) (tool-bar-mode t)))
 
+(defvar ns-cursor-blink-mode) 		; nsterm.m
+
 ; Redefine from frame.el
 (define-minor-mode blink-cursor-mode
   "Toggle blinking cursor mode.
@@ -1274,6 +1321,10 @@
 (defalias 'generate-fontset-menu 'ns-popup-font-panel)
 (defalias 'mouse-set-font 'ns-popup-font-panel)
 
+;; nsterm.m
+(defvar ns-input-font)
+(defvar ns-input-fontsize)
+
 (defun ns-respond-to-change-font ()
   "Respond to changeFont: event, expecting ns-input-font and\n\
 ns-input-fontsize of new font."
@@ -1316,10 +1367,14 @@
 
 ;;;; Pasteboard support.
 
+(declare-function ns-get-cut-buffer-internal "nsselect.m" (buffer))
+
 (defun ns-get-pasteboard ()
   "Returns the value of the pasteboard."
   (ns-get-cut-buffer-internal 'PRIMARY))
 
+(declare-function ns-store-cut-buffer-internal "nsselect.m" (buffer string))
+
 (defun ns-set-pasteboard (string)
   "Store STRING into the NS server's pasteboard."
   ;; Check the data type of STRING.
@@ -1442,6 +1497,8 @@
 
 ;;;; Color support.
 
+(declare-function ns-list-colors "nsfns.m" (&optional frame))
+
 (defvar x-colors (ns-list-colors)
   "The list of colors defined in non-PANTONE color files.")
 (defvar colors x-colors
@@ -1465,6 +1522,8 @@
 (defalias 'x-defined-colors 'ns-defined-colors)
 (defalias 'xw-defined-colors 'ns-defined-colors)
 
+(declare-function ns-set-alpha "nsfns.m" (color alpha))
+
 ;; Convenience and work-around for fact that set color fns now require named.
 (defun ns-set-background-alpha (alpha)
   "Sets alpha (opacity) of background.
@@ -1511,6 +1570,8 @@
      (t
       nil))))
 
+(defvar ns-input-color)			; nsterm.m
+
 (defun ns-set-foreground-at-mouse ()
   "Set the foreground color at the mouse location to ns-input-color."
   (interactive)
@@ -1519,7 +1580,7 @@
          (face (ns-face-at-pos pos)))
     (cond
      ((eq face 'cursor)
-      (modify-frame-parameters frame (list (cons 'cursor-color 
+      (modify-frame-parameters frame (list (cons 'cursor-color
                                                  ns-input-color))))
      ((not face)
       (modify-frame-parameters frame (list (cons 'foreground-color
@@ -1559,6 +1620,8 @@
       icon-title-format t)
 
 ;; Set up browser connectivity
+(defvar browse-url-generic-program)
+
 (setq browse-url-browser-function 'browse-url-generic)
 (cond ((eq system-type 'darwin)
        (setq browse-url-generic-program "open"))
@@ -1570,6 +1633,11 @@
 (defvar ns-initialized nil
   "Non-nil if NS windowing has been initialized.")
 
+(declare-function ns-open-connection "nsfns.m"
+		  (display &optional resource_string must_succeed))
+
+(declare-function ns-list-services "nsfns.m" ())
+
 ;;; Do the actual NS Windows setup here; the above code just defines
 ;;; functions and variables that we use now.
 (defun ns-initialize-window-system ()