comparison lisp/startup.el @ 9173:6ee3eeec722b

(command-line): Recognize --longopt synonyms for all options handled here.
author Karl Heuer <kwzh@gnu.org>
date Wed, 28 Sep 1994 22:15:38 +0000
parents 54b7aaded223
children 900fdf19446a
comparison
equal deleted inserted replaced
9172:393a55341859 9173:6ee3eeec722b
39 ; -q load no init file 39 ; -q load no init file
40 ; -no-init-file same 40 ; -no-init-file same
41 ; -u user load user's init file 41 ; -u user load user's init file
42 ; -user user same 42 ; -user user same
43 ; -debug-init Don't catch errors in init file; let debugger run. 43 ; -debug-init Don't catch errors in init file; let debugger run.
44 ; -no-site-file Don't load site-run-file.
44 45
45 ; These are processed in the order encountered. 46 ; These are processed in the order encountered.
46 ; -f function execute function 47 ; -f function execute function
47 ; -funcall function same 48 ; -funcall function same
48 ; -l file load file 49 ; -l file load file
49 ; -load file same 50 ; -load file same
50 ; -insert file same 51 ; -insert file insert file into buffer
51 ; file visit file 52 ; file visit file
52 ; -kill kill (exit) emacs 53 ; -kill kill (exit) emacs
53 54
54 ;;; Code: 55 ;;; Code:
55 56
289 290
290 ;; Process the command-line args, and delete the arguments 291 ;; Process the command-line args, and delete the arguments
291 ;; processed. This is consistent with the way main in emacs.c 292 ;; processed. This is consistent with the way main in emacs.c
292 ;; does things. 293 ;; does things.
293 (while (and (not done) args) 294 (while (and (not done) args)
294 (let ((argi (car args))) 295 (let ((longopts '(("--no-init-file") ("--no-site-file") ("--user")
296 ("--debug-init")))
297 (argi (car args))
298 (argval nil))
299 (if (string-match "=" argi)
300 (setq argi (substring argi 0 (1- (match-beginning 0)))
301 argval (substring argi (match-end 0))))
302 (let ((completion (try-completion argi longopts)))
303 (if (eq completion t)
304 (setq argi (substring argi 1))
305 (if (stringp completion)
306 (let ((elt (assoc completion longopts)))
307 (or elt
308 (error "Option `%s' is ambiguous" argi))
309 (setq argi (substring (car elt) 1))))))
295 (cond 310 (cond
296 ((or (string-equal argi "-q") 311 ((or (string-equal argi "-q")
297 (string-equal argi "-no-init-file")) 312 (string-equal argi "-no-init-file"))
298 (setq init-file-user nil 313 (setq init-file-user nil
299 args (cdr args))) 314 args (cdr args)))
300 ((or (string-equal argi "-u") 315 ((or (string-equal argi "-u")
301 (string-equal argi "-user")) 316 (string-equal argi "-user"))
302 (setq args (cdr args) 317 (or argval
303 init-file-user (car args) 318 (setq argval (car args)
319 args (cdr args)))
320 (setq init-file-user argval
321 argval nil
304 args (cdr args))) 322 args (cdr args)))
305 ((string-equal argi "-no-site-file") 323 ((string-equal argi "-no-site-file")
306 (setq site-run-file nil 324 (setq site-run-file nil
307 args (cdr args))) 325 args (cdr args)))
308 ((string-equal argi "-debug-init") 326 ((string-equal argi "-debug-init")
309 (setq init-file-debug t 327 (setq init-file-debug t
310 args (cdr args))) 328 args (cdr args)))
311 (t (setq done t))))) 329 (t (setq done t)))
312 330 ;; Was argval set but not used?
331 (and argval
332 (error "Option `%s' doesn't allow an argument" argi))))
333
313 ;; Re-attach the program name to the front of the arg list. 334 ;; Re-attach the program name to the front of the arg list.
314 (setcdr command-line-args args)) 335 (setcdr command-line-args args))
315 336
316 ;; Under X Windows, this creates the X frame and deletes the terminal frame. 337 ;; Under X Windows, this creates the X frame and deletes the terminal frame.
317 (if (fboundp 'face-initialize) 338 (if (fboundp 'face-initialize)