annotate lisp/gtk-init.el @ 5560:58b38d5b32d0

Implement print-circle, allowing recursive and circular structures to be read. src/ChangeLog addition: 2011-09-04 Aidan Kehoe <kehoea@parhasard.net> * alloc.c: * alloc.c (ALLOC_FROB_BLOCK_LISP_OBJECT_1): * alloc.c (ALLOC_FROB_BLOCK_LISP_OBJECT): * alloc.c (cons_print_preprocess): * alloc.c (vector_print_preprocess): * alloc.c (vector_nsubst_structures_descend): * alloc.c (Fmake_symbol): * alloc.c (UNMARK_symbol): * alloc.c (sweep_symbols): * alloc.c (reinit_alloc_objects_early): * alloc.c (reinit_alloc_early): * bytecode.c: * bytecode.c (compiled_function_print_preprocess): * bytecode.c (compiled_function_nsubst_structures_descend): * bytecode.c (set_compiled_function_arglist): * bytecode.c (set_compiled_function_interactive): * bytecode.c (bytecode_objects_create): * chartab.c: * chartab.c (print_preprocess_mapper): * chartab.c (nsubst_structures_mapper): * chartab.c (char_table_nsubst_structures_descend): * chartab.c (chartab_objects_create): * elhash.c: * elhash.c (nsubst_structures_map_hash_table): * elhash.c (hash_table_nsubst_structures_descend): * elhash.c (print_preprocess_mapper): * elhash.c (hash_table_print_preprocess): * elhash.c (inchash_eq): * elhash.c (hash_table_objects_create): * elhash.c (syms_of_elhash): * elhash.h: * emacs.c (main_1): * fns.c: * fns.c (check_eq_nokey): * fns.c (Fnsubst): * fns.c (syms_of_fns): * lisp.h: * lisp.h (struct Lisp_Symbol): * lisp.h (IN_OBARRAY): * lisp.h (struct): * lisp.h (PRINT_PREPROCESS): * lread.c (read1): * lrecord.h: * lrecord.h (struct lrecord_implementation): * lrecord.h (DEFINE_DUMPABLE_MODULE_LISP_OBJECT): * print.c: * print.c (PRINT_CIRCLE_LIMIT): * print.c (print_continuous_numbering_changed): * print.c (print_prepare): * print.c (print_finish): * print.c (Fprin1_to_string): * print.c (print_cons): * print.c (print_preprocess_inchash_eq): * print.c (print_preprocess): * print.c (print_sort_get_numbers): * print.c (print_sort_compare_ordinals): * print.c (print_gensym_or_circle): * print.c (nsubst_structures_descend): * print.c (nsubst_structures): * print.c (print_internal): * print.c (print_symbol): * print.c (vars_of_print): * rangetab.c: * rangetab.c (range_table_print_preprocess): * rangetab.c (range_table_nsubst_structures_descend): * rangetab.c (rangetab_objects_create): * rangetab.c (syms_of_rangetab): * symbols.c: * symbols.c (symbol_print_preprocess): * symbols.c (Fintern): * symbols.c (Funintern): * symbols.c (reinit_symbol_objects_early): * symbols.c (init_symbols_once_early): * symsinit.h: Implement print-circle, printing circular structures in a readable fashion, and treating them appropriately on read. This is by means of two new object methods, print_preprocess (detecting circularities), and nsubst_structures_descend (replacing placeholders with the read objects). Expose the substitution to Lisp via #'nsubst and its new :descend-structures keyword. Store information as to whether symbols are interned in obarray or not in their header, making checking for keywords and uninterned symbols (and thus printing) cheaper. Default print_gensym to t, as Common Lisp does, and as a more-than-decade old comment suggests. lisp/ChangeLog addition: 2011-09-04 Aidan Kehoe <kehoea@parhasard.net> * bytecomp.el (byte-compile-output-file-form): * bytecomp.el (byte-compile-output-docform): Bind print-circle, print-continuous-numbering in these functions, now those variables are available. * lisp.el (forward-sexp): * lisp.el (backward-sexp): Recognise leading #N= as being part of an expression. tests/ChangeLog addition: 2011-09-04 Aidan Kehoe <kehoea@parhasard.net> * automated/lisp-reader-tests.el: * automated/lisp-tests.el (literal-with-uninterned): * automated/symbol-tests.el (foo): Test print-circle, for printing (mutually-)recursive and circular structures. Bind print-continuous-numbering where appropriate.
author Aidan Kehoe <kehoea@parhasard.net>
date Sun, 04 Sep 2011 19:51:35 +0100
parents 3d1f8f0e690f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1 ;;; gtk-init.el --- initialization code for mswindows
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
2 ;; Copyright (C) 1990, 1993, 1994 Free Software Foundation, Inc.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
3 ;; Copyright (C) 1995 Board of Trustees, University of Illinois.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
4 ;; Copyright (C) 1995, 1996 Ben Wing.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
5
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
6 ;; Author: various
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
7 ;; Rewritten for Gtk by: William Perry
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
8
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
9 ;; This file is part of XEmacs.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
10
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4477
diff changeset
11 ;; XEmacs is free software: you can redistribute it and/or modify it
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4477
diff changeset
12 ;; under the terms of the GNU General Public License as published by the
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4477
diff changeset
13 ;; Free Software Foundation, either version 3 of the License, or (at your
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4477
diff changeset
14 ;; option) any later version.
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
15
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4477
diff changeset
16 ;; XEmacs is distributed in the hope that it will be useful, but WITHOUT
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4477
diff changeset
17 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4477
diff changeset
18 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4477
diff changeset
19 ;; for more details.
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
20
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4477
diff changeset
22 ;; along with XEmacs. If not, see <http://www.gnu.org/licenses/>.
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
23
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 487
diff changeset
24 (globally-declare-boundp
4477
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4380
diff changeset
25 '(gtk-initial-argv-list gtk-initial-geometry))
506
39ccc7dd8077 [xemacs-hg @ 2001-05-05 08:39:59 by ben]
ben
parents: 502
diff changeset
26
39ccc7dd8077 [xemacs-hg @ 2001-05-05 08:39:59 by ben]
ben
parents: 502
diff changeset
27 (globally-declare-fboundp
39ccc7dd8077 [xemacs-hg @ 2001-05-05 08:39:59 by ben]
ben
parents: 502
diff changeset
28 '(gtk-keysym-on-keyboard-p))
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 487
diff changeset
29
4477
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4380
diff changeset
30 (defvar gtk-early-lisp-options-file "~/.xemacs/gtk-options.el"
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4380
diff changeset
31 "Path where GTK-specific early options should be stored.
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4380
diff changeset
32
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4380
diff changeset
33 This allows the user to set initial geometry without using GNOME and session
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4380
diff changeset
34 management, and, since it is read before GTK is initialized, it avoids
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4380
diff changeset
35 window flicker on resizing.
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4380
diff changeset
36
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4380
diff changeset
37 It is normally not useful to change without recompiling XEmacs.")
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
38
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
39 (defvar gtk-command-switch-alist
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
40 '(
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
41 ;; GNOME Options
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
42 ("--disable-sound" . nil)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
43 ("--enable-sound" . nil)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
44 ("--espeaker" . t)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
45
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
46 ;; GTK Options
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
47 ("--gdk-debug" . t)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
48 ("--gdk-no-debug" . t)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
49 ("--display" . t)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
50 ("--sync" . nil)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
51 ("--no-xshm" . nil)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
52 ("--name" . t)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
53 ("--class" . t)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
54 ("--gxid_host" . t)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
55 ("--gxid_port" . t)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
56 ("--xim-preedit" . t)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
57 ("--xim-status" . t)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
58 ("--gtk-debug" . t)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
59 ("--gtk-no-debug" . t)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
60 ("--gtk-module" . t)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
61
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
62 ;; Glib options
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
63 ("--g-fatal-warnings" . nil)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
64
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
65 ;; Session management options
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
66 ("--sm-client-id" . t)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
67 ("--sm-config-prefix" . t)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
68 ("--sm-disable" . t)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
69 )
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
70
4477
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4380
diff changeset
71 "An assoc list of command line args that should be in gtk-initial-argv-list.
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4380
diff changeset
72 This is necessary because GTK and GNOME consider it a fatal error if they
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4380
diff changeset
73 receive unknown command line arguments (perfectly reasonable). But this
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4380
diff changeset
74 means that if the user specifies a file name on the command line they will
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4380
diff changeset
75 be unable to start. So we filter the command line and allow only items in
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4380
diff changeset
76 this list in.
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4380
diff changeset
77
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4380
diff changeset
78 The CDR of the assoc list is whether it accepts an argument. For the
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4380
diff changeset
79 moment, all options are in GNU long form.")
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4380
diff changeset
80
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4380
diff changeset
81 (defvar make-device-early-gtk-entry-point-called-p nil
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4380
diff changeset
82 "Whether `make-device-early-gtk-entry-point' has been called, at least once.
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4380
diff changeset
83
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4380
diff changeset
84 Much of the GTK-specific Lisp init code should only be called the first time
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4380
diff changeset
85 a GTK device is created; this variable allows for that.")
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
86
4477
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4380
diff changeset
87 (defvar make-device-late-gtk-entry-point-called-p nil
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4380
diff changeset
88 "Whether `make-device-late-gtk-entry-point' has been called, at least once.
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4380
diff changeset
89
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4380
diff changeset
90 Much of the GTK-specific Lisp init code should only be called the first time
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4380
diff changeset
91 a GTK device is created; this variable allows for that.")
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
92
4477
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4380
diff changeset
93 (defun make-device-early-gtk-entry-point ()
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4380
diff changeset
94 "Entry point to set up the Lisp environment before GTK device creation."
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4380
diff changeset
95 (unless make-device-early-gtk-entry-point-called-p
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4380
diff changeset
96 (setq initial-frame-plist
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4380
diff changeset
97 (and initial-frame-unmapped-p '(initially-unmapped t))
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4380
diff changeset
98 gtk-initial-argv-list
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4380
diff changeset
99 (cons (car command-line-args) (gtk-filter-arguments))
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4380
diff changeset
100 gtk-initial-geometry
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4380
diff changeset
101 (nth 1 (member "-geometry" command-line-args-left))
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4380
diff changeset
102 make-device-early-gtk-entry-point-called-p t)
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4380
diff changeset
103 (unless vanilla-inhibiting
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4380
diff changeset
104 (load gtk-early-lisp-options-file t t t))))
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
105
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
106 (defun gtk-init-handle-geometry (arg)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
107 "Set up initial geometry info for GTK devices."
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
108 (setq gtk-initial-geometry (pop command-line-args-left)))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
109
4477
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4380
diff changeset
110 (defun make-device-late-gtk-entry-point (device)
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4380
diff changeset
111 "Entry-Point to do any Lisp-level GTK device-specific initialization."
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4380
diff changeset
112 (unless make-device-late-gtk-entry-point-called-p
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4380
diff changeset
113 (setq make-device-late-gtk-entry-point-called-p t)))
e34711681f30 Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents: 4380
diff changeset
114
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
115 (defun gtk-filter-arguments ()
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
116 (let ((accepted nil)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
117 (rejected nil)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
118 (todo nil))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
119 (setq todo (mapcar (lambda (argdesc)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
120 (if (cdr argdesc)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
121 ;; Need to look for --foo=bar
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
122 (concat "^" (car argdesc) "=")
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
123 ;; Just a simple arg
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
124 (concat "^" (regexp-quote (car argdesc)) "$")))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
125 gtk-command-switch-alist))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
126
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
127 (while command-line-args-left
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
128 (if (catch 'found
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
129 (mapc (lambda (r)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
130 (if (string-match r (car command-line-args-left))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
131 (throw 'found t))) todo)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
132 (mapc (lambda (argdesc)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
133 (if (cdr argdesc)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
134 ;; This time we only care about argument items
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
135 ;; that take an argument. We'll check to see if
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
136 ;; someone used --foo bar instead of --foo=bar
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
137 (if (string-match (concat "^" (car argdesc) "$") (car command-line-args-left))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
138 ;; Yup! Need to push
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
139 (progn
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
140 (push (pop command-line-args-left) accepted)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
141 (throw 'found t)))))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
142 gtk-command-switch-alist)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
143 nil)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
144 (push (pop command-line-args-left) accepted)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
145 (push (pop command-line-args-left) rejected)))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
146 (setq command-line-args-left (nreverse rejected))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
147 (nreverse accepted)))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
148
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
149 (push '("-geometry" . gtk-init-handle-geometry) command-switch-alist)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
150