aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/ChangeLog13
-rw-r--r--lisp/startup.el70
-rw-r--r--lisp/term/common-win.el23
-rw-r--r--lisp/term/ns-win.el87
4 files changed, 71 insertions, 122 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 5e5de12ede6..1293e4c8f9e 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,18 @@
12010-10-26 Glenn Morris <rgm@gnu.org> 12010-10-26 Glenn Morris <rgm@gnu.org>
2 2
3 * term/ns-win.el (ns-version-string): Remove unused declaration.
4 (ns-invocation-args): Change to x-invocation-args.
5 (ns-handle-switch, ns-handle-numeric-switch, ns-handle-iconic)
6 (ns-handle-name-switch, ns-ignore-2-arg): Remove.
7 (ns-handle-nxopen, ns-handle-nxopentemp, ns-ignore-1-arg):
8 Use x-invocation-args instead of ns-invocation-args.
9 (ns-initialize-window-system, handle-args-function-alist):
10 Use x-handle-args instead of ns-handle-args.
11 * term/common-win.el (x-handle-args): Also handle nextstep arguments.
12 * startup.el (command-line-ns-option-alist): Replace
13 ns-handle-name-switch, ns-handle-switch, ns-handle-numeric-switch,
14 ns-handle-iconic with the x- equivalents.
15
3 * term/common-win.el (x-select-enable-clipboard): 16 * term/common-win.el (x-select-enable-clipboard):
4 * term/pc-win.el (x-select-enable-clipboard): Doc fix. 17 * term/pc-win.el (x-select-enable-clipboard): Doc fix.
5 18
diff --git a/lisp/startup.el b/lisp/startup.el
index a6ba865ce10..7626dcfac16 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -200,47 +200,47 @@ and VALUE is the value which is given to that frame parameter
200 ;;("-bw" . x-handle-numeric-switch) 200 ;;("-bw" . x-handle-numeric-switch)
201 ;;("-d" . x-handle-display) 201 ;;("-d" . x-handle-display)
202 ;;("-display" . x-handle-display) 202 ;;("-display" . x-handle-display)
203 ("-name" 1 ns-handle-name-switch) 203 ("-name" 1 x-handle-name-switch)
204 ("-title" 1 ns-handle-switch title) 204 ("-title" 1 x-handle-switch title)
205 ("-T" 1 ns-handle-switch title) 205 ("-T" 1 x-handle-switch title)
206 ("-r" 0 ns-handle-switch reverse t) 206 ("-r" 0 x-handle-switch reverse t)
207 ("-rv" 0 ns-handle-switch reverse t) 207 ("-rv" 0 x-handle-switch reverse t)
208 ("-reverse" 0 ns-handle-switch reverse t) 208 ("-reverse" 0 x-handle-switch reverse t)
209 ("-fn" 1 ns-handle-switch font) 209 ("-fn" 1 x-handle-switch font)
210 ("-font" 1 ns-handle-switch font) 210 ("-font" 1 x-handle-switch font)
211 ("-ib" 1 ns-handle-numeric-switch internal-border-width) 211 ("-ib" 1 x-handle-numeric-switch internal-border-width)
212 ;;("-g" . x-handle-geometry) 212 ;;("-g" . x-handle-geometry)
213 ;;("-geometry" . x-handle-geometry) 213 ;;("-geometry" . x-handle-geometry)
214 ("-fg" 1 ns-handle-switch foreground-color) 214 ("-fg" 1 x-handle-switch foreground-color)
215 ("-foreground" 1 ns-handle-switch foreground-color) 215 ("-foreground" 1 x-handle-switch foreground-color)
216 ("-bg" 1 ns-handle-switch background-color) 216 ("-bg" 1 x-handle-switch background-color)
217 ("-background" 1 ns-handle-switch background-color) 217 ("-background" 1 x-handle-switch background-color)
218; ("-ms" 1 ns-handle-switch mouse-color) 218; ("-ms" 1 x-handle-switch mouse-color)
219 ("-itype" 0 ns-handle-switch icon-type t) 219 ("-itype" 0 x-handle-switch icon-type t)
220 ("-i" 0 ns-handle-switch icon-type t) 220 ("-i" 0 x-handle-switch icon-type t)
221 ("-iconic" 0 ns-handle-iconic icon-type t) 221 ("-iconic" 0 x-handle-iconic icon-type t)
222 ;;("-xrm" . x-handle-xrm-switch) 222 ;;("-xrm" . x-handle-xrm-switch)
223 ("-cr" 1 ns-handle-switch cursor-color) 223 ("-cr" 1 x-handle-switch cursor-color)
224 ("-vb" 0 ns-handle-switch vertical-scroll-bars t) 224 ("-vb" 0 x-handle-switch vertical-scroll-bars t)
225 ("-hb" 0 ns-handle-switch horizontal-scroll-bars t) 225 ("-hb" 0 x-handle-switch horizontal-scroll-bars t)
226 ("-bd" 1 ns-handle-switch) 226 ("-bd" 1 x-handle-switch)
227 ;; ("--border-width" 1 ns-handle-numeric-switch border-width) 227 ;; ("--border-width" 1 x-handle-numeric-switch border-width)
228 ;; ("--display" 1 ns-handle-display) 228 ;; ("--display" 1 ns-handle-display)
229 ("--name" 1 ns-handle-name-switch) 229 ("--name" 1 x-handle-name-switch)
230 ("--title" 1 ns-handle-switch title) 230 ("--title" 1 x-handle-switch title)
231 ("--reverse-video" 0 ns-handle-switch reverse t) 231 ("--reverse-video" 0 x-handle-switch reverse t)
232 ("--font" 1 ns-handle-switch font) 232 ("--font" 1 x-handle-switch font)
233 ("--internal-border" 1 ns-handle-numeric-switch internal-border-width) 233 ("--internal-border" 1 x-handle-numeric-switch internal-border-width)
234 ;; ("--geometry" 1 ns-handle-geometry) 234 ;; ("--geometry" 1 ns-handle-geometry)
235 ("--foreground-color" 1 ns-handle-switch foreground-color) 235 ("--foreground-color" 1 x-handle-switch foreground-color)
236 ("--background-color" 1 ns-handle-switch background-color) 236 ("--background-color" 1 x-handle-switch background-color)
237 ("--mouse-color" 1 ns-handle-switch mouse-color) 237 ("--mouse-color" 1 x-handle-switch mouse-color)
238 ("--icon-type" 0 ns-handle-switch icon-type t) 238 ("--icon-type" 0 x-handle-switch icon-type t)
239 ("--iconic" 0 ns-handle-iconic) 239 ("--iconic" 0 x-handle-iconic)
240 ;; ("--xrm" 1 ns-handle-xrm-switch) 240 ;; ("--xrm" 1 ns-handle-xrm-switch)
241 ("--cursor-color" 1 ns-handle-switch cursor-color) 241 ("--cursor-color" 1 x-handle-switch cursor-color)
242 ("--vertical-scroll-bars" 0 ns-handle-switch vertical-scroll-bars t) 242 ("--vertical-scroll-bars" 0 x-handle-switch vertical-scroll-bars t)
243 ("--border-color" 1 ns-handle-switch border-width)) 243 ("--border-color" 1 x-handle-switch border-width))
244 "Alist of NS options. 244 "Alist of NS options.
245Each element has the form 245Each element has the form
246 (NAME NUMARGS HANDLER FRAME-PARAM VALUE) 246 (NAME NUMARGS HANDLER FRAME-PARAM VALUE)
diff --git a/lisp/term/common-win.el b/lisp/term/common-win.el
index ff69ff9404b..98baf826712 100644
--- a/lisp/term/common-win.el
+++ b/lisp/term/common-win.el
@@ -316,12 +316,14 @@ On X, the display name of individual X frames is recorded in the
316 (setenv "DISPLAY" x-display-name)) 316 (setenv "DISPLAY" x-display-name))
317 317
318(defun x-handle-args (args) 318(defun x-handle-args (args)
319 "Process the X-related command line options in ARGS. 319 "Process the X (or Nextstep) related command line options in ARGS.
320This is done before the user's startup file is loaded. They are copied to 320This is done before the user's startup file is loaded.
321`x-invocation-args', from which the X-related things are extracted, first 321Copies the options in ARGS to `x-invocation-args'. It then extracts
322the switch (e.g., \"-fg\") in the following code, and possible values 322the X (or Nextstep) options according to the handlers defined in
323\(e.g., \"black\") in the option handler code (e.g., x-handle-switch). 323`command-line-x-option-alist' (or `command-line-ns-option-alist').
324This function returns ARGS minus the arguments that have been processed." 324For example, `x-handle-switch' handles a switch like \"-fg\" and its
325value \"black\". This function returns ARGS minus the arguments that
326have been processed."
325 ;; We use ARGS to accumulate the args that we don't handle here, to return. 327 ;; We use ARGS to accumulate the args that we don't handle here, to return.
326 (setq x-invocation-args args ; FIXME let-bind? 328 (setq x-invocation-args args ; FIXME let-bind?
327 args nil) 329 args nil)
@@ -329,6 +331,9 @@ This function returns ARGS minus the arguments that have been processed."
329 (not (equal (car x-invocation-args) "--"))) 331 (not (equal (car x-invocation-args) "--")))
330 (let* ((this-switch (pop x-invocation-args)) 332 (let* ((this-switch (pop x-invocation-args))
331 (orig-this-switch this-switch) 333 (orig-this-switch this-switch)
334 (option-alist (if (featurep 'ns)
335 command-line-ns-option-alist
336 command-line-x-option-alist))
332 completion argval aelt handler) 337 completion argval aelt handler)
333 ;; Check for long options with attached arguments 338 ;; Check for long options with attached arguments
334 ;; and separate out the attached option argument into argval. 339 ;; and separate out the attached option argument into argval.
@@ -338,17 +343,17 @@ This function returns ARGS minus the arguments that have been processed."
338 ;; Complete names of long options. 343 ;; Complete names of long options.
339 (if (string-match "^--" this-switch) 344 (if (string-match "^--" this-switch)
340 (progn 345 (progn
341 (setq completion (try-completion this-switch command-line-x-option-alist)) 346 (setq completion (try-completion this-switch option-alist))
342 (if (eq completion t) 347 (if (eq completion t)
343 ;; Exact match for long option. 348 ;; Exact match for long option.
344 nil 349 nil
345 (if (stringp completion) 350 (if (stringp completion)
346 (let ((elt (assoc completion command-line-x-option-alist))) 351 (let ((elt (assoc completion option-alist)))
347 ;; Check for abbreviated long option. 352 ;; Check for abbreviated long option.
348 (or elt 353 (or elt
349 (error "Option `%s' is ambiguous" this-switch)) 354 (error "Option `%s' is ambiguous" this-switch))
350 (setq this-switch completion)))))) 355 (setq this-switch completion))))))
351 (setq aelt (assoc this-switch command-line-x-option-alist)) 356 (setq aelt (assoc this-switch option-alist))
352 (if aelt (setq handler (nth 2 aelt))) 357 (if aelt (setq handler (nth 2 aelt)))
353 (if handler 358 (if handler
354 (if argval 359 (if argval
diff --git a/lisp/term/ns-win.el b/lisp/term/ns-win.el
index b09dd7a01f7..6541ee4b68c 100644
--- a/lisp/term/ns-win.el
+++ b/lisp/term/ns-win.el
@@ -58,99 +58,30 @@
58 :group 'environment) 58 :group 'environment)
59 59
60;; nsterm.m 60;; nsterm.m
61(defvar ns-version-string)
62(defvar ns-alternate-modifier) 61(defvar ns-alternate-modifier)
63(defvar ns-right-alternate-modifier) 62(defvar ns-right-alternate-modifier)
64 63
65;;;; Command line argument handling. 64;;;; Command line argument handling.
66 65
67(defvar ns-invocation-args nil) 66(defvar x-invocation-args)
68(defvar ns-command-line-resources nil) 67(defvar ns-command-line-resources nil) ; FIXME unused?
69
70;; Handler for switches of the form "-switch value" or "-switch".
71(defun ns-handle-switch (switch &optional numeric)
72 (let ((aelt (assoc switch command-line-ns-option-alist)))
73 (if aelt
74 (setq default-frame-alist
75 (cons (cons (nth 3 aelt)
76 (if numeric
77 (string-to-number (pop ns-invocation-args))
78 (or (nth 4 aelt) (pop ns-invocation-args))))
79 default-frame-alist)))))
80
81;; Handler for switches of the form "-switch n"
82(defun ns-handle-numeric-switch (switch)
83 (ns-handle-switch switch t))
84
85(defalias 'ns-handle-iconic 'x-handle-iconic)
86
87;; Handle the -name option, set the name of the initial frame.
88(defun ns-handle-name-switch (switch)
89 (or (consp ns-invocation-args)
90 (error "%s: missing argument to `%s' option" (invocation-name) switch))
91 (setq initial-frame-alist (cons (cons 'name (pop ns-invocation-args))
92 initial-frame-alist)))
93 68
94;; nsterm.m. 69;; nsterm.m.
95(defvar ns-input-file) 70(defvar ns-input-file)
96 71
97(defun ns-handle-nxopen (switch) 72(defun ns-handle-nxopen (switch)
98 (setq unread-command-events (append unread-command-events '(ns-open-file)) 73 (setq unread-command-events (append unread-command-events '(ns-open-file))
99 ns-input-file (append ns-input-file (list (pop ns-invocation-args))))) 74 ns-input-file (append ns-input-file (list (pop x-invocation-args)))))
100 75
101(defun ns-handle-nxopentemp (switch) 76(defun ns-handle-nxopentemp (switch)
102 (setq unread-command-events (append unread-command-events 77 (setq unread-command-events (append unread-command-events
103 '(ns-open-temp-file)) 78 '(ns-open-temp-file))
104 ns-input-file (append ns-input-file (list (pop ns-invocation-args))))) 79 ns-input-file (append ns-input-file (list (pop x-invocation-args)))))
105 80
106(defun ns-ignore-1-arg (switch) 81(defun ns-ignore-1-arg (switch)
107 (setq ns-invocation-args (cdr ns-invocation-args))) 82 (setq x-invocation-args (cdr x-invocation-args)))
108(defun ns-ignore-2-arg (switch) 83(defun ns-ignore-2-arg (switch) ; FIXME unused?
109 (setq ns-invocation-args (cddr ns-invocation-args))) 84 (setq x-invocation-args (cddr x-invocation-args)))
110
111(defun ns-handle-args (args)
112 "Process Nextstep-related command line options.
113This is run before the user's startup file is loaded.
114The options in ARGS are copied to `ns-invocation-args'.
115The Nextstep-related settings are then applied using the handlers
116defined in `command-line-ns-option-alist'.
117The return value is ARGS minus the number of arguments processed."
118 ;; We use ARGS to accumulate the args that we don't handle here, to return.
119 (setq ns-invocation-args args
120 args nil)
121 (while ns-invocation-args
122 (let* ((this-switch (pop ns-invocation-args))
123 (orig-this-switch this-switch)
124 completion argval aelt handler)
125 ;; Check for long options with attached arguments
126 ;; and separate out the attached option argument into argval.
127 (if (string-match "^--[^=]*=" this-switch)
128 (setq argval (substring this-switch (match-end 0))
129 this-switch (substring this-switch 0 (1- (match-end 0)))))
130 ;; Complete names of long options.
131 (if (string-match "^--" this-switch)
132 (progn
133 (setq completion (try-completion this-switch
134 command-line-ns-option-alist))
135 (if (eq completion t)
136 ;; Exact match for long option.
137 nil
138 (if (stringp completion)
139 (let ((elt (assoc completion command-line-ns-option-alist)))
140 ;; Check for abbreviated long option.
141 (or elt
142 (error "Option `%s' is ambiguous" this-switch))
143 (setq this-switch completion))))))
144 (setq aelt (assoc this-switch command-line-ns-option-alist))
145 (if aelt (setq handler (nth 2 aelt)))
146 (if handler
147 (if argval
148 (let ((ns-invocation-args
149 (cons argval ns-invocation-args)))
150 (funcall handler this-switch))
151 (funcall handler this-switch))
152 (setq args (cons orig-this-switch args)))))
153 (nreverse args))
154 85
155(defun ns-parse-geometry (geom) 86(defun ns-parse-geometry (geom)
156 "Parse a Nextstep-style geometry string GEOM. 87 "Parse a Nextstep-style geometry string GEOM.
@@ -1029,7 +960,7 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.")
1029 "Initialize Emacs for Nextstep (Cocoa / GNUstep) windowing." 960 "Initialize Emacs for Nextstep (Cocoa / GNUstep) windowing."
1030 961
1031 ;; PENDING: not needed? 962 ;; PENDING: not needed?
1032 (setq command-line-args (ns-handle-args command-line-args)) 963 (setq command-line-args (x-handle-args command-line-args))
1033 964
1034 (x-open-connection (system-name) nil t) 965 (x-open-connection (system-name) nil t)
1035 966
@@ -1048,7 +979,7 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.")
1048 979
1049 (setq ns-initialized t)) 980 (setq ns-initialized t))
1050 981
1051(add-to-list 'handle-args-function-alist '(ns . ns-handle-args)) 982(add-to-list 'handle-args-function-alist '(ns . x-handle-args))
1052(add-to-list 'frame-creation-function-alist '(ns . x-create-frame-with-faces)) 983(add-to-list 'frame-creation-function-alist '(ns . x-create-frame-with-faces))
1053(add-to-list 'window-system-initialization-alist '(ns . ns-initialize-window-system)) 984(add-to-list 'window-system-initialization-alist '(ns . ns-initialize-window-system))
1054 985