summaryrefslogtreecommitdiff
path: root/lisp/term
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2005-01-23 16:56:11 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2005-01-23 16:56:11 +0000
commitbd6a8278adac29297a853a8f8d4651dd1f715932 (patch)
tree14ae396b1a45a6595dae2622d04207c72765e9dc /lisp/term
parent8f958b40ccfca8cf0c090849d75c4f42e126706a (diff)
downloademacs-bd6a8278adac29297a853a8f8d4651dd1f715932.tar.gz
Simplify code.
Diffstat (limited to 'lisp/term')
-rw-r--r--lisp/term/w32-win.el93
1 files changed, 27 insertions, 66 deletions
diff --git a/lisp/term/w32-win.el b/lisp/term/w32-win.el
index e49f3ddb2e6..69e5c0e793b 100644
--- a/lisp/term/w32-win.el
+++ b/lisp/term/w32-win.el
@@ -1,6 +1,6 @@
;;; w32-win.el --- parse switches controlling interface with W32 window system
-;; Copyright (C) 1993, 1994, 2003, 2004 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 1994, 2003, 2004, 2005 Free Software Foundation, Inc.
;; Author: Kevin Gallo
;; Keywords: terminals
@@ -139,50 +139,26 @@ 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
- (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)))))))
+ (push (cons (nth 3 aelt) (or (nth 4 aelt) (pop x-invocation-args)))
+ default-frame-alist))))
(defun x-handle-numeric-switch (switch)
"Handle SWITCH of the form \"-switch n\"."
(let ((aelt (assoc switch command-line-x-option-alist)))
(if aelt
- (let ((param (nth 3 aelt)))
- (setq default-frame-alist
- (cons (cons param
- (string-to-int (car x-invocation-args)))
- default-frame-alist)
- x-invocation-args
- (cdr x-invocation-args))))))
+ (push (cons (nth 3 aelt) (string-to-int (pop x-invocation-args)))
+ default-frame-alist))))
;; 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
- (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)))))))
+ (push (cons (nth 3 aelt) (or (nth 4 aelt) (pop x-invocation-args)))
+ initial-frame-alist))))
(defun x-handle-iconic (switch)
"Make \"-iconic\" SWITCH apply only to the initial frame."
- (setq initial-frame-alist
- (cons '(visibility . icon) initial-frame-alist)))
+ (push '(visibility . icon) initial-frame-alist))
(defun x-handle-xrm-switch (switch)
"Handle the \"-xrm\" SWITCH."
@@ -226,18 +202,15 @@ 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 (car x-invocation-args)
- x-invocation-args (cdr x-invocation-args))
- (setq initial-frame-alist (cons (cons 'name x-resource-name)
- initial-frame-alist)))
+ (setq x-resource-name (pop x-invocation-args))
+ (push (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 (car x-invocation-args)
- x-invocation-args (cdr x-invocation-args)))
+ (setq x-display-name (pop x-invocation-args)))
(defun x-handle-args (args)
"Process the X-related command line options in ARGS.
@@ -281,7 +254,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))
- (setq args (cons orig-this-switch args)))))
+ (push orig-this-switch args))))
(nconc (nreverse args) x-invocation-args))
;;
@@ -1046,15 +1019,10 @@ XConsortium: rgb.txt,v 10.41 94/02/20 18:39:36 rws Exp")
(defun xw-defined-colors (&optional frame)
"Internal function called by `defined-colors', which see."
(or frame (setq frame (selected-frame)))
- (let* ((color-map-colors (mapcar (lambda (clr) (car clr)) w32-color-map))
- (all-colors (or color-map-colors x-colors))
- (this-color nil)
- (defined-colors nil))
- (while all-colors
- (setq this-color (car all-colors)
- all-colors (cdr all-colors))
+ (let ((defined-colors nil))
+ (dolist (this-color (or (mapcar 'car w32-color-map) x-colors))
(and (color-supported-p this-color frame t)
- (setq defined-colors (cons this-color defined-colors))))
+ (push this-color defined-colors)))
defined-colors))
@@ -1076,13 +1044,10 @@ XConsortium: rgb.txt,v 10.41 94/02/20 18:39:36 rws Exp")
;;; Make sure we have a valid resource name.
(or (stringp x-resource-name)
- (let (i)
- (setq x-resource-name (invocation-name))
-
- ;; Change any . or * characters in x-resource-name to hyphens,
- ;; so as not to choke when we use it in X resource queries.
- (while (setq i (string-match "[.*]" x-resource-name))
- (aset x-resource-name i ?-))))
+ (setq x-resource-name
+ ;; Change any . or * characters in x-resource-name to hyphens,
+ ;; so as not to choke when we use it in X resource queries.
+ (replace-regexp-in-string "[.*]" "-" (invocation-name))))
;; For the benefit of older Emacses (19.27 and earlier) that are sharing
;; the same lisp directory, don't pass the third argument unless we seem
@@ -1166,21 +1131,17 @@ See the documentation of `create-fontset-from-fontset-spec for the format.")
(setq initial-frame-alist (append initial-frame-alist parsed))
;; The size parms apply to all frames.
(if (assq 'height parsed)
- (setq default-frame-alist
- (cons (cons 'height (cdr (assq 'height parsed)))
- default-frame-alist)))
+ (push (cons 'height (cdr (assq 'height parsed)))
+ default-frame-alist))
(if (assq 'width parsed)
- (setq default-frame-alist
- (cons (cons 'width (cdr (assq 'width parsed)))
- default-frame-alist))))))
+ (push (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))
- (setq default-frame-alist
- (cons '(reverse . t) default-frame-alist)))))
+ (if (and rv (string-match "^\\(true\\|yes\\|on\\)$" rv))
+ (push '(reverse . t) default-frame-alist))))
(defun x-win-suspend-error ()
"Report an error when a suspend is attempted."
@@ -1244,7 +1205,7 @@ font dialog to get the matching FONTS. Otherwise use a pop-up menu
(and chosen-font (list chosen-font)))
(x-popup-menu
last-nonmenu-event
- ;; Append list of fontsets currently defined.
+ ;; Append list of fontsets currently defined.
;; Conditional on new-fontset so bootstrapping works on non-GUI compiles
(if (fboundp 'new-fontset)
(append w32-fixed-font-alist (list (generate-fontset-menu)))))))
@@ -1268,5 +1229,5 @@ font dialog to get the matching FONTS. Otherwise use a pop-up menu
(tiff "libtiff3.dll" "libtiff.dll")
(gif "libungif.dll")))
-;;; arch-tag: 69fb1701-28c2-4890-b351-3d1fe4b4f166
+;; arch-tag: 69fb1701-28c2-4890-b351-3d1fe4b4f166
;;; w32-win.el ends here