# HG changeset patch # User Jim Blandy # Date 742976502 0 # Node ID e0345afdf64ec16f30f34b60d340ca7560c55ba7 # Parent c9a0f06110bde357214242a33e6c279b05ea0144 * 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. diff -r c9a0f06110bd -r e0345afdf64e lisp/term/x-win.el --- a/lisp/term/x-win.el Sun Jul 18 06:20:47 1993 +0000 +++ b/lisp/term/x-win.el Sun Jul 18 06:21:42 1993 +0000 @@ -65,7 +65,7 @@ ;; ../startup.el. (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 'mouse) @@ -82,7 +82,8 @@ (append '(("-bw" . x-handle-numeric-switch) ("-d" . 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) ("-r" . x-handle-switch) ("-rv" . x-handle-switch) @@ -100,7 +101,7 @@ ("-itype" . x-handle-switch) ("-i" . x-handle-switch) ("-iconic" . x-handle-switch) - ("-rn" . x-handle-rn-switch) + ("-xrm" . x-handle-xrm-switch) ("-cr" . x-handle-switch) ("-vb" . x-handle-switch) ("-hb" . x-handle-switch) @@ -155,8 +156,10 @@ x-invocation-args (cdr x-invocation-args))))) -;; Handle the -rn option. -(defun x-handle-rn-switch (switch) +;; Handle the -xrm option. +(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-invocation-args (cdr x-invocation-args))) @@ -167,6 +170,18 @@ (x-parse-geometry (car 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 "The X display name specifying server and X frame.") @@ -515,6 +530,17 @@ ;;; functions and variables that we use now. (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 (setq x-display-name (getenv "DISPLAY"))) x-command-line-resources) @@ -530,11 +556,12 @@ (x-parse-geometry res-geometry))))) ;; Check the reverseVideo resource. -(if (assoc - (x-get-resource "reverseVideo" - "ReverseVideo") - '("True" "true" "Yes" "yes")) - (setq default-frame-alist (cons '(reverse . t) default-frame-alist))) +(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))))) ;; Set x-selection-timeout, measured in milliseconds. (let ((res-selection-timeout