Several enhancements for support of the JSC style
[texmacs.git] / src / TeXmacs / progs / init-texmacs.scm
blob1f1474f2e0c291d84df56d646cd9db35be17e48b
2 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3 ;;
4 ;; MODULE      : init-texmacs.scm
5 ;; DESCRIPTION : This is the standard TeXmacs initialization file
6 ;; COPYRIGHT   : (C) 1999  Joris van der Hoeven
7 ;;
8 ;; This software falls under the GNU general public license version 3 or later.
9 ;; It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
10 ;; in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
12 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14 (define boot-start (texmacs-time))
16 ;; TODO: scheme file caching using (set! primitive-load ...) and
17 ;; (set! %search-load-path)
19 ;; (debug-enable 'backtrace 'debug)
20 ;; (define load-indent 0)
21 ;; (define old-primitive-load primitive-load)
22 ;; (define (new-primitive-load . x)
23 ;;   (for-each display (make-list load-indent "  "))
24 ;;   (display "Load ") (apply display x) (display "\n")
25 ;;   (set! load-indent (+ load-indent 1))
26 ;;   (apply old-primitive-load x)
27 ;;   (set! load-indent (- load-indent 1))
28 ;;   (for-each display (make-list load-indent "  "))
29 ;;   (display "Done\n"))
30 ;; (set! primitive-load new-primitive-load)
32 ;(display "Booting TeXmacs kernel functionality\n")
33 (if (os-mingw?)
34     (load "kernel/boot/boot.scm")
35     (load (url-concretize "$TEXMACS_PATH/progs/kernel/boot/boot.scm")))
36 (inherit-modules (kernel boot compat) (kernel boot abbrevs)
37                  (kernel boot debug) (kernel boot srfi)
38                  (kernel boot ahash-table) (kernel boot prologue))
39 (inherit-modules (kernel library base) (kernel library list)
40                  (kernel library tree) (kernel library content))
41 (inherit-modules (kernel regexp regexp-match) (kernel regexp regexp-select))
42 (inherit-modules (kernel drd drd-rules) (kernel drd drd-query)
43                  (kernel drd drd-data))
44 (inherit-modules (kernel texmacs tm-overload) (kernel texmacs tm-define)
45                  (kernel texmacs tm-preferences) (kernel texmacs tm-modes)
46                  (kernel texmacs tm-plugins) (kernel texmacs tm-secure)
47                  (kernel texmacs tm-convert) (kernel texmacs tm-dialogue)
48                  (kernel texmacs tm-file-system))
49 (inherit-modules (kernel gui menu-define) (kernel gui menu-widget)
50                  (kernel gui kbd-define) (kernel gui gui-widget)
51                  (kernel gui gui-factory) (kernel gui gui-form))
52 ;(display* "time: " (- (texmacs-time) boot-start) "\n")
54 ;(display "Booting utilities\n")
55 (lazy-define (utils cas cas-out) cas->stree)
56 ;(display* "time: " (- (texmacs-time) boot-start) "\n")
58 ;(display "Booting BibTeX style modules\n")
59 (use-modules (bibtex bib-utils))
60 ;(display* "time: " (- (texmacs-time) boot-start) "\n")
62 ;(display "Booting main TeXmacs functionality\n")
63 (use-modules (texmacs texmacs tm-server) (texmacs texmacs tm-view)
64              (texmacs texmacs tm-files) (texmacs texmacs tm-print))
65 (use-modules (texmacs keyboard config-kbd))
66 (lazy-keyboard (texmacs keyboard wildcards-kbd) always?)
67 (lazy-keyboard (texmacs keyboard texmacs-kbd) always?)
68 (cond ((like-windows?) (lazy-keyboard (texmacs keyboard windows-kbd) always?))
69       ((like-macos?) (lazy-keyboard (texmacs keyboard macos-kbd) always?))
70       (else (lazy-keyboard (texmacs keyboard emacs-kbd) always?)))
71 (lazy-keyboard (texmacs keyboard latex-kbd) always?)
72 (lazy-menu (texmacs menus file-menu) file-menu go-menu
73            new-file-menu load-menu save-menu print-menu close-menu)
74 (lazy-menu (texmacs menus edit-menu) edit-menu)
75 (lazy-menu (texmacs menus view-menu) view-menu)
76 (lazy-menu (texmacs menus tools-menu) tools-menu)
77 (lazy-menu (texmacs menus preferences-menu) preferences-menu page-setup-menu)
78 (use-modules (texmacs menus main-menu))
79 ;(display* "time: " (- (texmacs-time) boot-start) "\n")
81 ;(display "Booting generic mode\n")
82 (lazy-keyboard (generic generic-kbd) always?)
83 (lazy-menu (generic format-menu) format-menu font-size-menu color-menu)
84 (lazy-menu (generic document-menu) document-menu
85            project-menu document-style-menu global-language-menu)
86 (lazy-menu (generic document-part) document-part-menu project-manage-menu)
87 (lazy-menu (generic insert-menu) insert-menu
88            insert-link-menu insert-image-menu insert-animation-menu
89            insert-page-insertion-menu position-float-menu)
90 ;(display* "time: " (- (texmacs-time) boot-start) "\n")
92 ;(display "Booting text mode\n")
93 (lazy-keyboard (text text-kbd) in-text?)
94 (lazy-keyboard (text format-text-kbd) in-text?)
95 (lazy-keyboard (text std-text-kbd) in-std-text?)
96 (lazy-menu (text format-text-menu) text-format-menu text-format-icons)
97 (lazy-menu (text text-menu) text-menu text-icons)
98 ;(display* "time: " (- (texmacs-time) boot-start) "\n")
100 ;(display "Booting math mode\n")
101 (lazy-keyboard (math math-kbd) in-math?)
102 (lazy-menu (math format-math-menu) math-format-menu math-format-icons)
103 (lazy-menu (math math-menu) math-menu math-icons insert-math-menu)
104 ;(display* "time: " (- (texmacs-time) boot-start) "\n")
106 ;(display "Booting programming modes\n")
107 (lazy-keyboard (prog scheme-edit) in-prog-scheme?)
108 ;(display* "time: " (- (texmacs-time) boot-start) "\n")
110 ;(display "Booting source mode\n")
111 (lazy-keyboard (source source-kbd) always?)
112 (lazy-menu (source source-menu) source-menu source-icons
113            source-transformational-menu source-executable-menu)
114 ;(display* "time: " (- (texmacs-time) boot-start) "\n")
116 ;(display "Booting table mode\n")
117 (lazy-keyboard (table table-kbd) in-table?)
118 (lazy-menu (table table-menu) table-menu table-icons insert-table-menu
119            horizontal-table-cell-menu vertical-table-cell-menu)
120 ;(display* "time: " (- (texmacs-time) boot-start) "\n")
122 ;(display "Booting graphics mode\n")
123 (lazy-menu (graphics graphics-menu) graphics-menu graphics-icons)
124 (lazy-define (graphics graphics-edit)
125              graphics-reset-context graphics-undo-enabled
126              graphics-insert-point graphics-remove-point
127              graphics-last-point graphics-start-drag
128              graphics-dragging graphics-end-drag)
129 ;(display* "time: " (- (texmacs-time) boot-start) "\n")
131 ;(display "Booting dynamic features\n")
132 (lazy-keyboard (dynamic fold-kbd) always?)
133 (lazy-keyboard (dynamic scripts-kbd) always?)
134 (lazy-menu (dynamic format-prog-menu) prog-format-menu prog-format-icons)
135 (lazy-menu (dynamic fold-menu) insert-fold-menu)
136 (lazy-define (dynamic session-edit) scheme-eval)
137 (lazy-menu (dynamic session-menu) insert-session-menu
138            session-menu session-icons session-help-icons help-icons)
139 (lazy-menu (dynamic scripts-menu) scripts-eval-menu
140            plugin-eval-menu plugin-eval-toggle-menu plugin-plot-menu)
141 (lazy-define (dynamic form-edit) form-ref form-set! form-toggle)
142 ;(display* "time: " (- (texmacs-time) boot-start) "\n")
144 ;(display "Booting documentation\n")
145 (lazy-keyboard (doc tmdoc-kbd) in-tmdoc?)
146 (lazy-menu (doc help-menu) help-menu)
147 (lazy-define (doc tmdoc) tmdoc-expand-help tmdoc-expand-help-manual
148              tmdoc-expand-this tmdoc-include)
149 (lazy-define (doc docgrep) docgrep-in-doc docgrep-in-src docgrep-in-texts)
150 (lazy-define (doc tmweb) tmweb-convert-dir tmweb-interactive-build)
151 (define-secure-symbols tmdoc-include)
152 ;(display* "time: " (- (texmacs-time) boot-start) "\n")
154 ;(display "Booting converters\n")
155 (lazy-format (convert rewrite init-rewrite) texmacs scheme verbatim)
156 (lazy-format (convert tmml init-tmml) tmml)
157 (lazy-format (convert latex init-latex) latex)
158 (lazy-format (convert html init-html) html)
159 (lazy-format (convert bibtex init-bibtex) bibtex)
160 (lazy-format (convert images init-images)
161              postscript pdf xfig xmgrace svg xpm jpeg ppm gif png pnm)
162 (lazy-define (convert rewrite init-rewrite) texmacs->verbatim)
163 (lazy-define (convert html tmhtml-expand) tmhtml-env-patch)
164 (lazy-define (convert latex latex-drd) latex-arity latex-type)
165 (lazy-define (convert latex textm) textm-finalize)
166 (lazy-define (convert latex tmtex) tmtex-env-patch)
167 ;(display* "time: " (- (texmacs-time) boot-start) "\n")
169 ;(display "Booting remote facilities\n")
170 (lazy-define (remote tmfs-remote) remote-load remote-save
171              remote-name remote-permission? remote-project-load-by-name)
172 (lazy-menu (remote remote-menu) remote-menu)
173 (lazy-menu (remote chat-menu) chat-menu)
174 (lazy-menu (remote tmfs-menu) remote-file-menu)
175 (tmfs-handler #t 'load remote-load)
176 (tmfs-handler #t 'save remote-save)
177 (tmfs-handler #t 'name remote-name)
178 (tmfs-handler #t 'permission? remote-permission?)
179 ;(display* "time: " (- (texmacs-time) boot-start) "\n")
181 ;(display "Booting linking facilities\n")
182 (lazy-menu (link link-menu) link-menu)
183 (lazy-keyboard (link link-kbd) with-linking-tool?)
184 (lazy-define (link link-edit) create-unique-id)
185 (lazy-define (link link-navigate) link-active-upwards link-active-ids
186              link-follow-ids)
187 (lazy-define (link link-extern) get-constellation
188              get-link-locations register-link-locations)
189 ;(display* "time: " (- (texmacs-time) boot-start) "\n")
191 ;(display "Booting versioning facilities\n")
192 (lazy-menu (version version-menu) version-menu)
193 (lazy-keyboard (version version-kbd) with-versioning-tool?)
194 ;(display* "time: " (- (texmacs-time) boot-start) "\n")
196 ;(display "Booting debugging facilities\n")
197 (lazy-menu (texmacs menus debug-menu) debug-menu)
198 ;(display* "time: " (- (texmacs-time) boot-start) "\n")
200 ;(display "Booting plugins\n")
201 (for-each lazy-plugin-initialize (plugin-list))
202 ;(display* "time: " (- (texmacs-time) boot-start) "\n")
204 ;(display "Booting fonts\n")
205 (use-modules (fonts fonts-ec) (fonts fonts-adobe) (fonts fonts-x)
206              (fonts fonts-math) (fonts fonts-foreign) (fonts fonts-misc)
207              (fonts fonts-composite))
208 (if (> (get-font-type) 0) (use-modules (fonts fonts-truetype)))
209 ;(display* "time: " (- (texmacs-time) boot-start) "\n")
211 ;(display "------------------------------------------------------\n")
212 (delayed (:idle 10000) (delayed-auto-save))
213 (texmacs-banner)
214 ;(display "Initialization done\n")