summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Rumney <jasonr@gnu.org>2008-07-14 10:30:56 +0000
committerJason Rumney <jasonr@gnu.org>2008-07-14 10:30:56 +0000
commit62bb0e59fd8c6cf9829931f3e83640047d9bad25 (patch)
tree44666828775c266bac360b19ac9c01aca6763746
parent4367c9054e6f5821f023c568ac13fc3165e48eb6 (diff)
downloademacs-62bb0e59fd8c6cf9829931f3e83640047d9bad25.tar.gz
(x-handle-switch, x-handle-name-switch)
(x-handle-numeric-switch, x-handle-initial-switch) (x-handle-xrm-switch, x-handle-args, x-handle-display) (xw-defined-colors, w32-initialize-window-system): Avoid use of cl pop and push macros.
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/term/w32-win.el79
2 files changed, 67 insertions, 20 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 7e9fc56c259..4595188cf04 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
+2008-07-14 Jason Rumney <jasonr@gnu.org>
+
+ * term/w32-win.el (x-handle-switch, x-handle-name-switch)
+ (x-handle-numeric-switch, x-handle-initial-switch)
+ (x-handle-xrm-switch, x-handle-args, x-handle-display)
+ (xw-defined-colors, w32-initialize-window-system):
+ Avoid use of cl pop and push macros.
+
2008-07-14 Martin Rudalics <rudalics@gmx.at>
* add-log.el (change-log-goto-source): Avoid wrong-type-argument
diff --git a/lisp/term/w32-win.el b/lisp/term/w32-win.el
index cf867b3505c..298234f465e 100644
--- a/lisp/term/w32-win.el
+++ b/lisp/term/w32-win.el
@@ -154,30 +154,53 @@ the last file dropped is selected."
"Handle SWITCH of the form \"-switch value\" or \"-switch\"."
(let ((aelt (assoc switch command-line-x-option-alist)))
(if aelt
- (push (cons (nth 3 aelt) (or (nth 4 aelt) (pop x-invocation-args)))
- default-frame-alist))))
+ (let ((param (nth 3 aelt))
+ (value (nth 4 aelt)))
+ (if value
+ (setq default-frame-alist
+ (cons (cons param value)
+ default-frame-alist))
+ (setq default-frame-alist
+ (cons (cons param
+ (car x-invocation-args))
+ default-frame-alist)
+ x-invocation-args (cdr x-invocation-args)))))))
(defun x-handle-numeric-switch (switch)
"Handle SWITCH of the form \"-switch n\"."
(let ((aelt (assoc switch command-line-x-option-alist)))
(if aelt
- (push (cons (nth 3 aelt) (string-to-number (pop x-invocation-args)))
- default-frame-alist))))
+ (let ((param (nth 3 aelt)))
+ (setq default-frame-alist
+ (cons (cons param
+ (string-to-number (car x-invocation-args)))
+ default-frame-alist)
+ x-invocation-args
+ (cdr x-invocation-args))))))
;; Handle options that apply to initial frame only
(defun x-handle-initial-switch (switch)
(let ((aelt (assoc switch command-line-x-option-alist)))
(if aelt
- (push (cons (nth 3 aelt) (or (nth 4 aelt) (pop x-invocation-args)))
- initial-frame-alist))))
+ (let ((param (nth 3 aelt))
+ (value (nth 4 aelt)))
+ (if value
+ (setq initial-frame-alist
+ (cons (cons param value)
+ initial-frame-alist))
+ (setq initial-frame-alist
+ (cons (cons param
+ (car x-invocation-args))
+ initial-frame-alist)
+ x-invocation-args (cdr x-invocation-args)))))))
(defun x-handle-iconic (switch)
"Make \"-iconic\" SWITCH apply only to the initial frame."
- (push '(visibility . icon) initial-frame-alist))
+ (setq default-frame-alist (cons '(icon-type) default-frame-alist)))
(defun x-handle-xrm-switch (switch)
"Handle the \"-xrm\" SWITCH."
- (or (consp x-invocation-args)
+ (unless (consp x-invocation-args)
(error "%s: missing argument to `%s' option" (invocation-name) switch))
(setq x-command-line-resources
(if (null x-command-line-resources)
@@ -221,15 +244,26 @@ the last file dropped is selected."
;; to the option's operand; set the name of the initial frame, too.
(or (consp x-invocation-args)
(error "%s: missing argument to `%s' option" (invocation-name) switch))
- (setq x-resource-name (pop x-invocation-args))
- (push (cons 'name x-resource-name) initial-frame-alist))
+ (setq x-resource-name (car x-invocation-args)
+ x-invocation-args (cdr x-invocation-args))
+ (setq initial-frame-alist (cons (cons 'name x-resource-name)
+ initial-frame-alist)))
(defvar x-display-name nil
"The display name specifying server and frame.")
(defun x-handle-display (switch)
"Handle the \"-display\" SWITCH."
- (setq x-display-name (pop x-invocation-args)))
+ (setq x-display-name (car x-invocation-args)
+ x-invocation-args (cdr x-invocation-args))
+ ;; Make subshell programs see the same DISPLAY value Emacs really uses.
+ ;; Note that this isn't completely correct, since Emacs can use
+ ;; multiple displays. However, there is no way to tell an already
+ ;; running subshell which display the user is currently typing on.
+
+ ;; On Windows, this will not have any affect on Windows programs,
+ ;; but might be useful for X programs (running under Cygwin, tramp etc).
+ (setenv "DISPLAY" x-display-name))
(defun x-handle-args (args)
"Process the X-related command line options in ARGS.
@@ -273,7 +307,7 @@ This returns ARGS with the arguments that have been processed removed."
(cons argval x-invocation-args)))
(funcall handler this-switch))
(funcall handler this-switch))
- (push orig-this-switch args))))
+ (setq args (cons orig-this-switch args)))))
(nconc (nreverse args) x-invocation-args))
;;
@@ -381,7 +415,7 @@ XConsortium: rgb.txt,v 10.41 94/02/20 18:39:36 rws Exp")
(let ((defined-colors nil))
(dolist (this-color (or (mapcar 'car w32-color-map) x-colors))
(and (color-supported-p this-color frame t)
- (push this-color defined-colors)))
+ (setq defined-colors (cons this-color defined-colors))))
defined-colors))
@@ -507,18 +541,23 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.")
;; All geometry parms apply to the initial frame.
(setq initial-frame-alist (append initial-frame-alist parsed))
;; The size parms apply to all frames.
- (if (assq 'height parsed)
- (push (cons 'height (cdr (assq 'height parsed)))
- default-frame-alist))
- (if (assq 'width parsed)
- (push (cons 'width (cdr (assq 'width parsed)))
- default-frame-alist)))))
+ (if (and (assq 'height parsed)
+ (not (assq 'height default-frame-alist)))
+ (setq default-frame-alist
+ (cons (cons 'height (cdr (assq 'height parsed)))
+ default-frame-alist))
+ (if (and (assq 'width parsed)
+ (not (assq 'width default-frame-alist)))
+ (setq default-frame-alist
+ (cons (cons 'width (cdr (assq 'width parsed)))
+ default-frame-alist)))))))
;; Check the reverseVideo resource.
(let ((case-fold-search t))
(let ((rv (x-get-resource "reverseVideo" "ReverseVideo")))
(if (and rv (string-match "^\\(true\\|yes\\|on\\)$" rv))
- (push '(reverse . t) default-frame-alist))))
+ (setq default-frame-alist
+ (cons '(reverse . t) default-frame-alist)))))
;; Don't let Emacs suspend under w32 gui
(add-hook 'suspend-hook 'x-win-suspend-error)