Mercurial > emacs
comparison lisp/term/x-win.el @ 4132:e0345afdf64e
* 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.
author | Jim Blandy <jimb@redhat.com> |
---|---|
date | Sun, 18 Jul 1993 06:21:42 +0000 |
parents | dcf86f82f2c8 |
children | 8e14db210975 |
comparison
equal
deleted
inserted
replaced
4131:c9a0f06110bd | 4132:e0345afdf64e |
---|---|
63 | 63 |
64 ;; An alist of X options and the function which handles them. See | 64 ;; An alist of X options and the function which handles them. See |
65 ;; ../startup.el. | 65 ;; ../startup.el. |
66 | 66 |
67 (if (not (eq window-system 'x)) | 67 (if (not (eq window-system 'x)) |
68 (error "Loading x-win.el but not compiled for X")) | 68 (error "%s: Loading x-win.el but not compiled for X" (invocation-name))) |
69 | 69 |
70 (require 'frame) | 70 (require 'frame) |
71 (require 'mouse) | 71 (require 'mouse) |
72 (require 'scroll-bar) | 72 (require 'scroll-bar) |
73 (require 'faces) | 73 (require 'faces) |
80 | 80 |
81 (setq command-switch-alist | 81 (setq command-switch-alist |
82 (append '(("-bw" . x-handle-numeric-switch) | 82 (append '(("-bw" . x-handle-numeric-switch) |
83 ("-d" . x-handle-display) | 83 ("-d" . x-handle-display) |
84 ("-display" . x-handle-display) | 84 ("-display" . x-handle-display) |
85 ("-name" . x-handle-switch) | 85 ("-name" . x-handle-name-rn-switch) |
86 ("-rn" . x-handle-name-rn-switch) | |
86 ("-T" . x-handle-switch) | 87 ("-T" . x-handle-switch) |
87 ("-r" . x-handle-switch) | 88 ("-r" . x-handle-switch) |
88 ("-rv" . x-handle-switch) | 89 ("-rv" . x-handle-switch) |
89 ("-reverse" . x-handle-switch) | 90 ("-reverse" . x-handle-switch) |
90 ("-fn" . x-handle-switch) | 91 ("-fn" . x-handle-switch) |
98 ("-background". x-handle-switch) | 99 ("-background". x-handle-switch) |
99 ("-ms" . x-handle-switch) | 100 ("-ms" . x-handle-switch) |
100 ("-itype" . x-handle-switch) | 101 ("-itype" . x-handle-switch) |
101 ("-i" . x-handle-switch) | 102 ("-i" . x-handle-switch) |
102 ("-iconic" . x-handle-switch) | 103 ("-iconic" . x-handle-switch) |
103 ("-rn" . x-handle-rn-switch) | 104 ("-xrm" . x-handle-xrm-switch) |
104 ("-cr" . x-handle-switch) | 105 ("-cr" . x-handle-switch) |
105 ("-vb" . x-handle-switch) | 106 ("-vb" . x-handle-switch) |
106 ("-hb" . x-handle-switch) | 107 ("-hb" . x-handle-switch) |
107 ("-bd" . x-handle-switch)) | 108 ("-bd" . x-handle-switch)) |
108 command-switch-alist)) | 109 command-switch-alist)) |
153 (string-to-int (car x-invocation-args))) | 154 (string-to-int (car x-invocation-args))) |
154 default-frame-alist) | 155 default-frame-alist) |
155 x-invocation-args | 156 x-invocation-args |
156 (cdr x-invocation-args))))) | 157 (cdr x-invocation-args))))) |
157 | 158 |
158 ;; Handle the -rn option. | 159 ;; Handle the -xrm option. |
159 (defun x-handle-rn-switch (switch) | 160 (defun x-handle-xrm-switch (switch) |
161 (or (consp x-invocation-args) | |
162 (error "%s: missing argument to `%s' option" (invocation-name) switch)) | |
160 (setq x-command-line-resources (car x-invocation-args)) | 163 (setq x-command-line-resources (car x-invocation-args)) |
161 (setq x-invocation-args (cdr x-invocation-args))) | 164 (setq x-invocation-args (cdr x-invocation-args))) |
162 | 165 |
163 ;; Handle the geometry option | 166 ;; Handle the geometry option |
164 (defun x-handle-geometry (switch) | 167 (defun x-handle-geometry (switch) |
165 (setq initial-frame-alist | 168 (setq initial-frame-alist |
166 (append initial-frame-alist | 169 (append initial-frame-alist |
167 (x-parse-geometry (car x-invocation-args))) | 170 (x-parse-geometry (car x-invocation-args))) |
168 x-invocation-args (cdr x-invocation-args))) | 171 x-invocation-args (cdr x-invocation-args))) |
172 | |
173 ;; Handle the -name and -rn options. Set the variable x-resource-name | |
174 ;; to the option's operand; if the switch was `-name', set the name of | |
175 ;; the initial frame, too. | |
176 (defun x-handle-name-rn-switch (switch) | |
177 (or (consp x-invocation-args) | |
178 (error "%s: missing argument to `%s' option" (invocation-name) switch)) | |
179 (setq x-resource-name (car x-invocation-args) | |
180 x-invocation-args (cdr x-invocation-args)) | |
181 (if (string= switch "-name") | |
182 (setq initial-frame-alist (cons (cons 'name x-resource-name) | |
183 initial-frame-alist)))) | |
169 | 184 |
170 (defvar x-display-name nil | 185 (defvar x-display-name nil |
171 "The X display name specifying server and X frame.") | 186 "The X display name specifying server and X frame.") |
172 | 187 |
173 (defun x-handle-display (switch) | 188 (defun x-handle-display (switch) |
513 | 528 |
514 ;;; Do the actual X Windows setup here; the above code just defines | 529 ;;; Do the actual X Windows setup here; the above code just defines |
515 ;;; functions and variables that we use now. | 530 ;;; functions and variables that we use now. |
516 | 531 |
517 (setq command-line-args (x-handle-args command-line-args)) | 532 (setq command-line-args (x-handle-args command-line-args)) |
533 | |
534 ;;; Make sure we have a valid resource name. | |
535 (or (stringp x-resource-name) | |
536 (let (i) | |
537 (setq x-resource-name (invocation-name)) | |
538 | |
539 ;; Change any . or * characters in x-resource-name to hyphens, | |
540 ;; so as not to choke when we use it in X resource queries. | |
541 (while (setq i (string-match "[.*]" x-resource-name)) | |
542 (aset x-resource-name i ?-)))) | |
543 | |
518 (x-open-connection (or x-display-name | 544 (x-open-connection (or x-display-name |
519 (setq x-display-name (getenv "DISPLAY"))) | 545 (setq x-display-name (getenv "DISPLAY"))) |
520 x-command-line-resources) | 546 x-command-line-resources) |
521 | 547 |
522 (setq frame-creation-function 'x-create-frame-with-faces) | 548 (setq frame-creation-function 'x-create-frame-with-faces) |
528 (if res-geometry | 554 (if res-geometry |
529 (setq initial-frame-alist (append initial-frame-alist | 555 (setq initial-frame-alist (append initial-frame-alist |
530 (x-parse-geometry res-geometry))))) | 556 (x-parse-geometry res-geometry))))) |
531 | 557 |
532 ;; Check the reverseVideo resource. | 558 ;; Check the reverseVideo resource. |
533 (if (assoc | 559 (let ((case-fold-search t)) |
534 (x-get-resource "reverseVideo" | 560 (let ((rv (x-get-resource "reverseVideo" "ReverseVideo"))) |
535 "ReverseVideo") | 561 (if (and rv |
536 '("True" "true" "Yes" "yes")) | 562 (string-match "^\\(true\\|yes\\|on\\)$" rv)) |
537 (setq default-frame-alist (cons '(reverse . t) default-frame-alist))) | 563 (setq default-frame-alist |
564 (cons '(reverse . t) default-frame-alist))))) | |
538 | 565 |
539 ;; Set x-selection-timeout, measured in milliseconds. | 566 ;; Set x-selection-timeout, measured in milliseconds. |
540 (let ((res-selection-timeout | 567 (let ((res-selection-timeout |
541 (x-get-resource "selectionTimeout" "SelectionTimeout"))) | 568 (x-get-resource "selectionTimeout" "SelectionTimeout"))) |
542 (setq x-selection-timeout 5000) | 569 (setq x-selection-timeout 5000) |