comparison lisp/term/common-win.el @ 111185:050a28bd1797

Remove ns-handle-* functions that duplicate x-handle-*. * lisp/term/ns-win.el (ns-version-string): Remove unused declaration. (ns-invocation-args): Change to x-invocation-args. (ns-handle-switch, ns-handle-numeric-switch, ns-handle-iconic) (ns-handle-name-switch, ns-ignore-2-arg): Remove. (ns-handle-nxopen, ns-handle-nxopentemp, ns-ignore-1-arg): Use x-invocation-args instead of ns-invocation-args. (ns-initialize-window-system, handle-args-function-alist): Use x-handle-args instead of ns-handle-args. * lisp/term/common-win.el (x-handle-args): Also handle nextstep arguments. * lisp/startup.el (command-line-ns-option-alist): Replace ns-handle-name-switch, ns-handle-switch, ns-handle-numeric-switch, ns-handle-iconic with the x- equivalents.
author Glenn Morris <rgm@gnu.org>
date Mon, 25 Oct 2010 20:58:19 -0700
parents 72ef880ed198
children ed5bac97776a
comparison
equal deleted inserted replaced
111184:c7c697c81a21 111185:050a28bd1797
314 ;; multiple displays. However, there is no way to tell an already 314 ;; multiple displays. However, there is no way to tell an already
315 ;; running subshell which display the user is currently typing on. 315 ;; running subshell which display the user is currently typing on.
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.
320 This is done before the user's startup file is loaded. They are copied to 320 This is done before the user's startup file is loaded.
321 `x-invocation-args', from which the X-related things are extracted, first 321 Copies the options in ARGS to `x-invocation-args'. It then extracts
322 the switch (e.g., \"-fg\") in the following code, and possible values 322 the 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').
324 This function returns ARGS minus the arguments that have been processed." 324 For example, `x-handle-switch' handles a switch like \"-fg\" and its
325 value \"black\". This function returns ARGS minus the arguments that
326 have 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)
328 (while (and x-invocation-args 330 (while (and x-invocation-args
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.
335 (if (string-match "^--[^=]*=" this-switch) 340 (if (string-match "^--[^=]*=" this-switch)
336 (setq argval (substring this-switch (match-end 0)) 341 (setq argval (substring this-switch (match-end 0))
337 this-switch (substring this-switch 0 (1- (match-end 0))))) 342 this-switch (substring this-switch 0 (1- (match-end 0)))))
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
355 (let ((x-invocation-args 360 (let ((x-invocation-args
356 (cons argval x-invocation-args))) 361 (cons argval x-invocation-args)))