[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r102096: Simplifications for lisp/ter
From: |
Glenn Morris |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r102096: Simplifications for lisp/term/common-win.el |
Date: |
Sun, 24 Oct 2010 22:39:21 -0700 |
User-agent: |
Bazaar (2.0.3) |
------------------------------------------------------------
revno: 102096
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Sun 2010-10-24 22:39:21 -0700
message:
Simplifications for lisp/term/common-win.el
* lisp/term/common-win.el (x-handle-switch): Simplify with pop.
Optionally handle numeric switches.
(x-handle-numeric-switch): Just call x-handle-switch.
(x-handle-initial-switch, x-handle-xrm-switch, x-handle-geometry)
(x-handle-name-switch, x-handle-display, x-handle-args):
Simplify with pop.
modified:
lisp/ChangeLog
lisp/term/common-win.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2010-10-25 00:48:26 +0000
+++ b/lisp/ChangeLog 2010-10-25 05:39:21 +0000
@@ -1,5 +1,12 @@
2010-10-25 Glenn Morris <address@hidden>
+ * term/common-win.el (x-handle-switch): Simplify with pop.
+ Optionally handle numeric switches.
+ (x-handle-numeric-switch): Just call x-handle-switch.
+ (x-handle-initial-switch, x-handle-xrm-switch, x-handle-geometry)
+ (x-handle-name-switch, x-handle-display, x-handle-args):
+ Simplify with pop.
+
* term/ns-win.el: Do not require easymenu.
(menu-bar-edit-menu) <copy, paste, paste-from-menu, separator-undo>:
<spell>: Move adjustments to menu-bar.el.
=== modified file 'lisp/term/common-win.el'
--- a/lisp/term/common-win.el 2010-10-24 22:04:45 +0000
+++ b/lisp/term/common-win.el 2010-10-25 05:39:21 +0000
@@ -103,48 +103,28 @@
(defvar x-command-line-resources nil)
;; Handler for switches of the form "-switch value" or "-switch".
-(defun x-handle-switch (switch)
+(defun x-handle-switch (switch &optional numeric)
(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)))))))
+ (setq default-frame-alist
+ (cons (cons (nth 3 aelt)
+ (if numeric
+ (string-to-number (pop x-invocation-args))
+ (or (nth 4 aelt) (pop x-invocation-args))))
+ default-frame-alist)))))
;; Handler for switches of the form "-switch n"
(defun x-handle-numeric-switch (switch)
- (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-number (car x-invocation-args)))
- default-frame-alist)
- x-invocation-args
- (cdr x-invocation-args))))))
+ (x-handle-switch switch t))
;; 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)))))))
+ (setq initial-frame-alist
+ (cons (cons (nth 3 aelt)
+ (or (nth 4 aelt) (pop x-invocation-args)))
+ initial-frame-alist)))))
;; Make -iconic apply only to the initial frame!
(defun x-handle-iconic (switch)
@@ -157,15 +137,14 @@
(error "%s: missing argument to `%s' option" (invocation-name) switch))
(setq x-command-line-resources
(if (null x-command-line-resources)
- (car x-invocation-args)
- (concat x-command-line-resources "\n" (car x-invocation-args))))
- (setq x-invocation-args (cdr x-invocation-args)))
+ (pop x-invocation-args)
+ (concat x-command-line-resources "\n" (pop x-invocation-args)))))
(declare-function x-parse-geometry "frame.c" (string))
;; Handle the geometry option
(defun x-handle-geometry (switch)
- (let* ((geo (x-parse-geometry (car x-invocation-args)))
+ (let* ((geo (x-parse-geometry (pop x-invocation-args)))
(left (assq 'left geo))
(top (assq 'top geo))
(height (assq 'height geo))
@@ -186,8 +165,7 @@
(append initial-frame-alist
'((user-position . t))
(if left (list left))
- (if top (list top)))))
- (setq x-invocation-args (cdr x-invocation-args))))
+ (if top (list top)))))))
(defvar x-resource-name)
@@ -197,9 +175,8 @@
(defun x-handle-name-switch (switch)
(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)
+ (setq x-resource-name (pop x-invocation-args)
+ initial-frame-alist (cons (cons 'name x-resource-name)
initial-frame-alist)))
(defvar x-display-name nil
@@ -209,8 +186,7 @@
(defun x-handle-display (switch)
"Handle -display DISPLAY option."
- (setq x-display-name (car x-invocation-args)
- x-invocation-args (cdr x-invocation-args))
+ (setq x-display-name (pop 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
@@ -229,10 +205,9 @@
args nil)
(while (and x-invocation-args
(not (equal (car x-invocation-args) "--")))
- (let* ((this-switch (car x-invocation-args))
+ (let* ((this-switch (pop x-invocation-args))
(orig-this-switch this-switch)
completion argval aelt handler)
- (setq x-invocation-args (cdr x-invocation-args))
;; Check for long options with attached arguments
;; and separate out the attached option argument into argval.
(if (string-match "^--[^=]*=" this-switch)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r102096: Simplifications for lisp/term/common-win.el,
Glenn Morris <=