aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorEli Zaretskii1997-10-13 16:05:32 +0000
committerEli Zaretskii1997-10-13 16:05:32 +0000
commitc8a6e3b923e946cd48f4b5bd2b8c3c56f7bdfb80 (patch)
tree11a5ffacd5b0629a95573648fd48d18ff6d36c29 /lisp
parent12f230a16e2383b6696dde353f513ff7545f64a2 (diff)
downloademacs-c8a6e3b923e946cd48f4b5bd2b8c3c56f7bdfb80.tar.gz
emacs-c8a6e3b923e946cd48f4b5bd2b8c3c56f7bdfb80.zip
(x-long-option-alist): New variable.
(msdos-handle-args): Handle and complete long options with attached arguments. Support "-name", "-T" and "-rv" options.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/term/pc-win.el76
1 files changed, 63 insertions, 13 deletions
diff --git a/lisp/term/pc-win.el b/lisp/term/pc-win.el
index b5a4aea0bef..5c18716a445 100644
--- a/lisp/term/pc-win.el
+++ b/lisp/term/pc-win.el
@@ -398,27 +398,77 @@ This is in addition to the primary selection.")
398(fset 'set-mouse-color 'ignore) ; We cannot, I think. 398(fset 'set-mouse-color 'ignore) ; We cannot, I think.
399(fset 'set-cursor-color 'ignore) ; Hardware determined by char under. 399(fset 'set-cursor-color 'ignore) ; Hardware determined by char under.
400(fset 'set-border-color 'ignore) ; Not useful. 400(fset 'set-border-color 'ignore) ; Not useful.
401
402;; From lisp/term/x-win.el:
403(defconst x-long-option-alist
404 '(("--name" . "-name")
405 ("--title" . "-T")
406 ("--reverse-video" . "-reverse")
407 ("--foreground-color" . "-fg")
408 ("--background-color" . "-bg")))
401;; --------------------------------------------------------------------------- 409;; ---------------------------------------------------------------------------
402;; Handle the X-like command line parameters "-fg" and "-bg" 410;; Handle the X-like command line parameters "-fg", "-bg", "-name", etc.
403(defun msdos-handle-args (args) 411(defun msdos-handle-args (args)
404 (let ((rest nil)) 412 (let ((rest nil))
413 (message "%s" args)
405 (while args 414 (while args
406 (let ((this (car args))) 415 (let* ((this (car args))
416 (orig-this this)
417 completion argval)
407 (setq args (cdr args)) 418 (setq args (cdr args))
419 ;; Check for long options with attached arguments
420 ;; and separate out the attached option argument into argval.
421 (if (string-match "^--[^=]*=" this)
422 (setq argval (substring this (match-end 0))
423 this (substring this 0 (1- (match-end 0)))))
424 (setq completion (try-completion this x-long-option-alist))
425 (if (eq completion t)
426 ;; Exact match for long option.
427 (setq this (cdr (assoc this x-long-option-alist)))
428 (if (stringp completion)
429 (let ((elt (assoc completion x-long-option-alist)))
430 ;; Check for abbreviated long option.
431 (or elt
432 (error "Option `%s' is ambiguous" this))
433 (setq this (cdr elt)))
434 ;; Check for a short option.
435 (setq argval nil this orig-this)))
408 (cond ((or (string= this "-fg") (string= this "-foreground")) 436 (cond ((or (string= this "-fg") (string= this "-foreground"))
409 (if args 437 (or argval (setq argval (car args) args (cdr args)))
410 (setq default-frame-alist 438 (setq default-frame-alist
411 (cons (cons 'foreground-color (car args)) 439 (cons (cons 'foreground-color argval)
412 default-frame-alist) 440 default-frame-alist)))
413 args (cdr args))))
414 ((or (string= this "-bg") (string= this "-background")) 441 ((or (string= this "-bg") (string= this "-background"))
415 (if args 442 (or argval (setq argval (car args) args (cdr args)))
416 (setq default-frame-alist 443 (setq default-frame-alist
417 (cons (cons 'background-color (car args)) 444 (cons (cons 'background-color argval)
418 default-frame-alist) 445 default-frame-alist)))
419 args (cdr args)))) 446 ((or (string= this "-T") (string= this "-name"))
447 (or argval (setq argval (car args) args (cdr args)))
448 (setq default-frame-alist
449 (cons
450 (cons 'title
451 (if (stringp argval)
452 argval
453 (let ((case-fold-search t)
454 i)
455 (setq argval (invocation-name))
456
457 ;; Change any . or * characters in name to
458 ;; hyphens, so as to emulate behavior on X.
459 (while
460 (setq i (string-match "[.*]" argval))
461 (aset argval i ?-))
462 argval)))
463 default-frame-alist)))
464 ((or (string= this "-r")
465 (string= this "-rv")
466 (string= this "-reverse"))
467 (setq default-frame-alist
468 (cons '(reverse . t)
469 default-frame-alist)))
420 (t (setq rest (cons this rest)))))) 470 (t (setq rest (cons this rest))))))
421 (nreverse rest))) 471 (nreverse rest)))
422 472
423(setq command-line-args (msdos-handle-args command-line-args)) 473(setq command-line-args (msdos-handle-args command-line-args))
424;; --------------------------------------------------------------------------- 474;; ---------------------------------------------------------------------------