Commit 800642d2 authored by Jim Blandy's avatar Jim Blandy
Browse files

* term/x-win.el: Include (invocation-name) in the error messages

	which might occur during startup.

	* term/x-win.el: Make the `-rn NAME' option specify a resource
	name, as documented, and not a resource database string.  Make
	`-name NAME' act like `-rn NAME' and also set the name of the
	initial frame.
	(command-switch-alist): Process the `-rn' and `-name' options
	using the x-handle-name-rn-switch function.
	(x-handle-name-rn-switch): New function, which sets the
	x-resource-name variable.
	(opening connection): Make sure x-resource-name is valid.  If it's
	not a string, set it to (invocation-name), with any periods or
	asterisks changed to hyphens.

	* term/x-win.el: Make the `-xrm STRING' option specify a resource
	database string.  `-rn' used to behave this way.
	(command-switch-alist): Process the `-xrm' switch using
	x-handle-xrm-switch.
	(x-handle-xrm-switch): Renamed from x-handle-rn-switch; this
	function does the right thing for `-xrm', not for `-rn'.

	* term/x-win.el: Recognize affirmative values for reverseVideo
	properly.  Include "on" in the list of recognized values.
parent ac75ef20
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
;; ../startup.el. ;; ../startup.el.
(if (not (eq window-system 'x)) (if (not (eq window-system 'x))
(error "Loading x-win.el but not compiled for X")) (error "%s: Loading x-win.el but not compiled for X" (invocation-name)))
(require 'frame) (require 'frame)
(require 'mouse) (require 'mouse)
...@@ -82,7 +82,8 @@ ...@@ -82,7 +82,8 @@
(append '(("-bw" . x-handle-numeric-switch) (append '(("-bw" . x-handle-numeric-switch)
("-d" . x-handle-display) ("-d" . x-handle-display)
("-display" . x-handle-display) ("-display" . x-handle-display)
("-name" . x-handle-switch) ("-name" . x-handle-name-rn-switch)
("-rn" . x-handle-name-rn-switch)
("-T" . x-handle-switch) ("-T" . x-handle-switch)
("-r" . x-handle-switch) ("-r" . x-handle-switch)
("-rv" . x-handle-switch) ("-rv" . x-handle-switch)
...@@ -100,7 +101,7 @@ ...@@ -100,7 +101,7 @@
("-itype" . x-handle-switch) ("-itype" . x-handle-switch)
("-i" . x-handle-switch) ("-i" . x-handle-switch)
("-iconic" . x-handle-switch) ("-iconic" . x-handle-switch)
("-rn" . x-handle-rn-switch) ("-xrm" . x-handle-xrm-switch)
("-cr" . x-handle-switch) ("-cr" . x-handle-switch)
("-vb" . x-handle-switch) ("-vb" . x-handle-switch)
("-hb" . x-handle-switch) ("-hb" . x-handle-switch)
...@@ -155,8 +156,10 @@ ...@@ -155,8 +156,10 @@
x-invocation-args x-invocation-args
(cdr x-invocation-args))))) (cdr x-invocation-args)))))
;; Handle the -rn option. ;; Handle the -xrm option.
(defun x-handle-rn-switch (switch) (defun x-handle-xrm-switch (switch)
(or (consp x-invocation-args)
(error "%s: missing argument to `%s' option" (invocation-name) switch))
(setq x-command-line-resources (car x-invocation-args)) (setq x-command-line-resources (car x-invocation-args))
(setq x-invocation-args (cdr x-invocation-args))) (setq x-invocation-args (cdr x-invocation-args)))
...@@ -167,6 +170,18 @@ ...@@ -167,6 +170,18 @@
(x-parse-geometry (car x-invocation-args))) (x-parse-geometry (car x-invocation-args)))
x-invocation-args (cdr x-invocation-args))) x-invocation-args (cdr x-invocation-args)))
;; Handle the -name and -rn options. Set the variable x-resource-name
;; to the option's operand; if the switch was `-name', set the name of
;; the initial frame, too.
(defun x-handle-name-rn-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))
(if (string= switch "-name")
(setq initial-frame-alist (cons (cons 'name x-resource-name)
initial-frame-alist))))
(defvar x-display-name nil (defvar x-display-name nil
"The X display name specifying server and X frame.") "The X display name specifying server and X frame.")
...@@ -515,6 +530,17 @@ This returns ARGS with the arguments that have been processed removed." ...@@ -515,6 +530,17 @@ This returns ARGS with the arguments that have been processed removed."
;;; functions and variables that we use now. ;;; functions and variables that we use now.
(setq command-line-args (x-handle-args command-line-args)) (setq command-line-args (x-handle-args command-line-args))
;;; 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 ?-))))
(x-open-connection (or x-display-name (x-open-connection (or x-display-name
(setq x-display-name (getenv "DISPLAY"))) (setq x-display-name (getenv "DISPLAY")))
x-command-line-resources) x-command-line-resources)
...@@ -530,11 +556,12 @@ This returns ARGS with the arguments that have been processed removed." ...@@ -530,11 +556,12 @@ This returns ARGS with the arguments that have been processed removed."
(x-parse-geometry res-geometry))))) (x-parse-geometry res-geometry)))))
;; Check the reverseVideo resource. ;; Check the reverseVideo resource.
(if (assoc (let ((case-fold-search t))
(x-get-resource "reverseVideo" (let ((rv (x-get-resource "reverseVideo" "ReverseVideo")))
"ReverseVideo") (if (and rv
'("True" "true" "Yes" "yes")) (string-match "^\\(true\\|yes\\|on\\)$" rv))
(setq default-frame-alist (cons '(reverse . t) default-frame-alist))) (setq default-frame-alist
(cons '(reverse . t) default-frame-alist)))))
;; Set x-selection-timeout, measured in milliseconds. ;; Set x-selection-timeout, measured in milliseconds.
(let ((res-selection-timeout (let ((res-selection-timeout
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment