]> git.eshelyaron.com Git - emacs.git/commitdiff
* term/x-win.el: Include (invocation-name) in the error messages
authorJim Blandy <jimb@redhat.com>
Sun, 18 Jul 1993 06:21:42 +0000 (06:21 +0000)
committerJim Blandy <jimb@redhat.com>
Sun, 18 Jul 1993 06:21:42 +0000 (06:21 +0000)
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.

lisp/term/x-win.el

index 263a0a06d86f4ddc4b46d49e6f62ae3c2149936b..5001acaf671672da40f308da3d31e9f8dc29b19f 100644 (file)
@@ -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)
                ("-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)
              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)))
 
                (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 @@ This returns ARGS with the arguments that have been processed removed."
 ;;; 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 @@ This returns ARGS with the arguments that have been processed removed."
                                        (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