1 /*
2 * $Id: init.c,v 1.10 2001/02/14 19:22:57 danny Exp $
3 *
4 * Copyright � 1993, 2000, 2001 Free Software Foundation, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this software; see the file COPYING. If not, write to
18 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21 #ifdef HAVE_CONFIG_H
22 #include "config.h"
23 #endif
24
25 #ifdef WITH_DMALLOC
26 #include <dmalloc.h>
27 #endif
28
29 #include "proto.h"
30 #include "init.h"
31 #include "global.h"
32 #include "io-term.h"
33 #include "utils.h"
34 #include "cmd.h"
35 /*
36 * These commands are run before we are ready to do output. They
37 * should not do any kind of io or cause errors. If they do, you
38 * will experience core dumps.
39 */
40 static char *init_cmds[] =
41 {
42 "",
43 "# The keymap tree.",
44 "",
45 "# The map `universal' already exists, and is always the keymap of last",
46 "# resort. It is almost always a bad idea to add new bindings there.",
47 "",
48 "# This is the generic top-level keymap. It should contain bindings that",
49 "# apply at the top level keymap regardless of what mode the editor is in.",
50 "# All keymaps that are used at the top level should inherit from this.",
51 "create-keymap generic-main universal",
52 "",
53 "# This is the keymap in force at the top level when no command arguments are",
54 "# being edited.",
55 "create-keymap main generic-main",
56 "",
57 "# The keymap after a M- or ESC prefix in main:",
58 "create-keymap generic-meta universal",
59 "create-keymap meta generic-meta",
60 "",
61 "# The keymap for ESC [, Arrow keys are bound in this map.",
62 "create-keymap generic-ansi universal",
63 "create-keymap ansi generic-ansi",
64 "",
65 "create-keymap generic-trolx universal",
66 "create-keymap trolx generic-trolx",
67 "",
68 "# Bindings that define prefix keys.",
69 "bind-key generic-main generic-meta ^[",
70 "bind-key main meta ^[",
71 "",
72 "create-keymap mouse universal",
73 "bind-key generic-main mouse ^\\\\",
74 "bind-key mouse mouse-goto 0",
75 "bind-key mouse mouse-mark 1",
76 "bind-key mouse mouse-mark-and-goto 2",
77 "",
78 "",
79 "bind-key generic-main generic-trolx ^x",
80 "bind-key main trolx ^x",
81 "",
82 "bind-key generic-meta generic-ansi [",
83 "bind-key meta ansi [",
84 "",
85 "# Misc generic commands",
86 "",
87 "bind-key universal break ^g",
88 "bind-key universal redraw-screen ^l",
89 "bind-key generic-main universal-argument ^u",
90 "bind-key generic-main suspend-oleo ^z",
91 "bind-key generic-trolx kill-oleo ^c",
92 "bind-key generic-trolx recalculate !",
93 "bind-key generic-meta exec x",
94 "",
95 "# Prefix argument handling",
96 "# This keymap is magicly invoked within command_loop in cmd.c.",
97 "create-keymap prefix universal",
98 "bind-set prefix universal-argument 0-9",
99 "bind-key prefix universal-argument -",
100 "",
101 "#",
102 "# Cursor motion",
103 "#",
104 "",
105 "# For EMACS users",
106 "# Notice that these motion commands are not bound genericly. They don't",
107 "# in general apply if the input area is active.",
108 "",
109 "bind-key main up-cell ^p",
110 "bind-key main right-cell ^f",
111 "bind-key main left-cell ^b",
112 "bind-key main down-cell ^n",
113 "",
114 "# Ansi motion.",
115 "bind-key generic-ansi up-cell A",
116 "bind-key generic-ansi down-cell B",
117 "bind-key generic-ansi right-cell C",
118 "bind-key generic-ansi left-cell D",
119 "",
120 "# These are only useful under X, but there, they are quite useful.",
121 "name-macro-string up-cell-and-edit \\",
122 "{exit-minibuffer}{up-cell}{edit-cell}",
123 "name-macro-string down-cell-and-edit \\",
124 "{exit-minibuffer}{down-cell}{edit-cell}",
125 "name-macro-string left-cell-and-edit \\",
126 "{exit-minibuffer}{left-cell}{edit-cell}",
127 "name-macro-string right-cell-and-edit \\",
128 "{exit-minibuffer}{right-cell}{edit-cell}",
129 "",
130 "create-keymap edit-ansi generic-ansi",
131 "bind-key edit-ansi up-cell-and-edit A",
132 "bind-key edit-ansi down-cell-and-edit B",
133 "bind-key edit-ansi forward-char C",
134 "bind-key edit-ansi backward-char D",
135 "",
136 "create-keymap meta-edit-ansi universal",
137 "bind-key edit-ansi meta-edit-ansi ^[",
138 "bind-key meta-edit-ansi up-cell-and-edit A",
139 "bind-key meta-edit-ansi down-cell-and-edit B",
140 "bind-key meta-edit-ansi right-cell-and-edit C",
141 "bind-key meta-edit-ansi left-cell-and-edit D",
142 "",
143 "bind-key trolx goto-cell j",
144 "bind-key meta goto-region j",
145 "",
146 "# Going to extremes",
147 "bind-key meta upper-left <",
148 "bind-key meta lower-right >",
149 "",
150 "# Marking time",
151 "bind-key trolx exchange-point-and-mark ^X",
152 "bind-key main mark-cell ^@",
153 "",
154 "# Scrolling commands.",
155 "bind-key meta scroll-up v",
156 "bind-key main scroll-down ^V",
157 "bind-key trolx scroll-right >",
158 "bind-key trolx scroll-left <",
159 "",
160 "# Other ways of moving the cell cursor.",
161 "",
162 "bind-key meta scan-up p",
163 "bind-key meta scan-down n",
164 "bind-key meta scan-left b",
165 "bind-key meta scan-right f",
166 "",
167 "bind-key main beginning-of-row ^a",
168 "bind-key main end-of-row ^e",
169 "bind-key meta beginning-of-col ^a",
170 "bind-key meta end-of-col ^e",
171 "",
172 "# Macros",
173 "bind-key generic-trolx start-entering-macro (",
174 "bind-key generic-trolx stop-entering-macro )",
175 "bind-key generic-trolx call-last-kbd-macro e",
176 "bind-key generic-trolx store-last-macro =",
177 "",
178 "# The keymap used when prompting for a key-sequence: ",
179 "create-keymap read-keyseq universal",
180 "bind-set read-keyseq self-map-command \\000-\\377",
181 "",
182 "# Help commands",
183 "create-keymap generic-help universal",
184 "create-keymap unprompted-help generic-help",
185 "create-keymap help generic-help",
186 "bind-key generic-main unprompted-help ^h",
187 "bind-key main help ^h",
188 "bind-key unprompted-help help ^h",
189 "bind-key unprompted-help help ?",
190 "",
191 "set-map-prompt help \\",
192 "Help keys (type ? for more explanation): C c f F k o v w W ^W",
193 "",
194 "bind-key generic-help help-with-command C",
195 "bind-key generic-help describe-key-briefly c",
196 "bind-key generic-help describe-function f",
197 "bind-key generic-help describe-formula F",
198 "bind-key generic-help describe-key k",
199 "bind-key generic-help show-options o",
200 "bind-key generic-help show-variable v",
201 "bind-key generic-help show-all-variables ^v",
202 "bind-key generic-help where-is w",
203 "",
204 "name-macro-string view-wallchart \\",
205 "{make-wallchart-info}{with-keymap view-info}{set-info wallchart}",
206 "bind-key generic-help view-wallchart W",
207 "",
208 "name-macro-string write-wallchart \\",
209 "{make-wallchart-info}{write-info wallchart}",
210 "bind-key generic-help write-wallchart ^w",
211 "",
212 "create-keymap verbose-help-map generic-help",
213 "set-map-prompt verbose-help-map \\",
214 "Help (+,-,ESC or one of the help characters): ",
215 "",
216 "",
217 "name-macro-string verbose-help \\",
218 " {with-keymap verbose-help-map}{builtin-help help-with-help}",
219 "",
220 "bind-key help verbose-help ^h",
221 "bind-key help verbose-help ?",
222 "",
223 "bind-key verbose-help-map exit-minibuffer ^[",
224 "bind-key verbose-help-map page-info +",
225 "bind-key verbose-help-map page-info-backwards -",
226 "",
227 "name-macro-string verbose-hwc {exit-minibuffer}{help-with-command}",
228 "name-macro-string verbose-dkb {exit-minibuffer}{describe-key-briefly}",
229 "name-macro-string verbose-df {exit-minibuffer}{describe-function}",
230 "name-macro-string verbose-dk {exit-minibuffer}{describe-key}",
231 "name-macro-string verbose-so {exit-minibuffer}{show-options}",
232 "name-macro-string verbose-sv {exit-minibuffer}{show-variable}",
233 "name-macro-string verbose-sav {exit-minibuffer}{show-all-variables}",
234 "name-macro-string verbose-w {exit-minibuffer}{where-is}",
235 "",
236 "bind-key verbose-help-map verbose-hwc C",
237 "bind-key verbose-help-map verbose-dkb c",
238 "bind-key verbose-help-map verbose-df f",
239 "bind-key verbose-help-map verbose-dk k",
240 "bind-key verbose-help-map verbose-so o",
241 "bind-key verbose-help-map verbose-sv v",
242 "bind-key verbose-help-map verbose-sav ^v",
243 "bind-key verbose-help-map verbose-w w",
244 "",
245 "",
246 "# Variables",
247 "bind-key trolx set-var :",
248 "",
249 "# Files",
250 "",
251 "bind-key generic-trolx save-spreadsheet ^s",
252 "bind-key trolx find-alternate-spreadsheet ^v",
253 "bind-key trolx merge-spreadsheet i",
254 "",
255 "bind-key meta copy-region c",
256 "bind-key meta copy-values-in-region ^c",
257 "bind-key meta move-region m",
258 "bind-key main insert-row ^o",
259 "bind-key meta insert-col o",
260 "bind-key main delete-row ^k",
261 "bind-key meta delete-col k",
262 "",
263 "# Changing cell formulas",
264 "bind-key main set-cell =",
265 "",
266 "# Some characters start editing the current cell and then are reinterpreted",
267 "# as editing commands:",
268 "bind-set main goto-edit-cell a-z",
269 "bind-set main goto-edit-cell A-Z",
270 "bind-set main goto-edit-cell 0-9",
271 "bind-key main goto-edit-cell \\",
272 "bind-key main goto-edit-cell +",
273 "bind-key main goto-edit-cell -",
274 "bind-key main goto-edit-cell *",
275 "bind-key main goto-edit-cell /",
276 "bind-key main goto-edit-cell (",
277 "bind-key main goto-edit-cell )",
278 "bind-key main goto-edit-cell @",
279 "bind-key main goto-edit-cell ^",
280 "bind-key main goto-edit-cell %",
281 "bind-key main goto-edit-cell >",
282 "bind-key main goto-edit-cell <",
283 "bind-key main goto-edit-cell !",
284 "bind-key main goto-edit-cell ?",
285 "bind-key main goto-edit-cell :",
286 "bind-key main goto-edit-cell #",
287 "bind-key main goto-edit-cell _",
288 "bind-key main goto-edit-cell .",
289 "bind-key main goto-edit-cell ,",
290 "bind-key main goto-edit-cell ;",
291 "bind-key main goto-edit-cell \"",
292 "bind-key meta set-region-formula =",
293 "bind-key main delete-cell ^?",
294 "bind-key meta delete-region ^?",
295 "",
296 "",
297 "# Window commands",
298 "",
299 "bind-key meta recenter-window ^l",
300 "bind-key trolx split-window-horizontally 5",
301 "bind-key trolx split-window-vertically 2",
302 "bind-key trolx delete-window 0",
303 "bind-key trolx delete-other-windows 1",
304 "bind-key meta goto-minibuffer ^",
305 "bind-key trolx other-window o",
306 "",
307 "# Command argument editing",
308 "",
309 "create-keymap read-string generic-main",
310 "create-keymap meta-read-string generic-meta",
311 "create-keymap trolx-read-string generic-trolx",
312 "",
313 "bind-key read-string meta-read-string ^[",
314 "bind-set read-string self-insert-command \\ -~",
315 "bind-set read-string self-insert-command �-�",
316 "bind-key read-string exit-minibuffer ^m",
317 "bind-key read-string beginning-of-line ^a",
318 "bind-key read-string end-of-line ^e",
319 "bind-key read-string backward-char ^b",
320 "bind-key meta-read-string backward-word b",
321 "bind-key read-string backward-delete-char ^?",
322 "bind-key meta-read-string backward-delete-word ^?",
323 "bind-key read-string forward-char ^f",
324 "bind-key meta-read-string forward-word f",
325 "bind-key read-string delete-char ^d",
326 "bind-key meta-read-string delete-word d",
327 "bind-key read-string kill-line ^k",
328 "bind-key meta-read-string insert-cell-expression e",
329 "bind-key meta-read-string insert-cell-value v",
330 "bind-key meta-read-string insert-rel-ref r",
331 "bind-key meta-read-string insert-abs-ref a",
332 "bind-key meta-read-string toggle-overwrite o",
333 "",
334 "bind-key read-string trolx-read-string ^x",
335 "bind-key trolx-read-string other-window o",
336 "",
337 "# Reading various argument types specificly",
338 "create-keymap read-symbol read-string",
339 "create-keymap read-word read-string",
340 "create-keymap read-range read-string",
341 "create-keymap read-filename read-string",
342 "create-keymap read-integer read-string",
343 "create-keymap read-float read-string",
344 "create-keymap read-formula read-string",
345 "",
346 "# Special arrow key meanings for edit mode",
347 "create-keymap meta-read-formula meta-read-string",
348 "bind-key read-formula meta-read-formula ^[",
349 "bind-key meta-read-formula edit-ansi [",
350 "",
351 "# auto-motion",
352 "create-keymap set-auto-motion universal",
353 "set-map-prompt set-auto-motion \\",
354 "Set auto-motion direction [^v<>`'/\\ or SPC for none] ",
355 "",
356 "bind-key generic-trolx set-auto-motion m",
357 "",
358 "bind-key set-auto-motion auto-move-up ^",
359 "bind-key set-auto-motion auto-move-down v",
360 "bind-key set-auto-motion auto-move-down V",
361 "bind-key set-auto-motion auto-move-left <",
362 "bind-key set-auto-motion auto-move-left ,",
363 "bind-key set-auto-motion auto-move-right >",
364 "bind-key set-auto-motion auto-move-right .",
365 "bind-key set-auto-motion auto-move-up-right '",
366 "bind-key set-auto-motion auto-move-up-left `",
367 "bind-key set-auto-motion auto-move-down-right \\\\ ",
368 "bind-key set-auto-motion auto-move-down-left /",
369 "bind-key set-auto-motion auto-move-no-motion \\ ",
370 "",
371 "bind-key read-formula next-edit ^i",
372 "bind-key read-formula next-edit-set ^j",
373 "",
374 "create-keymap read-most-chars universal",
375 "",
376 "bind-set read-most-chars exit-self-inserting \\000-\\377",
377 "bind-key read-most-chars break ^G",
378 "bind-key read-most-chars redraw-screen ^L",
379 "",
380 "create-keymap press-any universal",
381 "set-map-prompt press-any \\",
382 "Press any key to continue. ",
383 "bind-set press-any exit-minibuffer \\000-\\377",
384 "bind-key press-any break ^G",
385 "bind-key press-any redraw-screen ^L",
386 "",
387 "create-keymap read-char read-most-chars",
388 "bind-key read-char exit-self-inserting ^G",
389 "",
390 "",
391 "# Menu driven commands use this keymap to read menu selections",
392 "create-keymap read-menu read-most-chars",
393 "bind-key read-menu help-with-command ^h",
394 "",
395 "create-keymap read-format read-string",
396 "",
397 "# These maps are used to manipulate cell attributes.",
398 "# They reimplement the old format-cell, format-region and",
399 "# set-default commands.",
400 "",
401 "create-keymap set-cell-attr universal",
402 "create-keymap set-region-attr universal",
403 "create-keymap set-default-attr universal",
404 "",
405 "set-map-prompt set-cell-attr \\",
406 "Set cell [A]lignment [F]ormat f[O]nt [P]rotection [H]eight [W]idth",
407 "set-map-prompt set-region-attr \\",
408 "Set region [A]lignment [F]ormat f[O]nt [P]rotection [H]eight [W]idth",
409 "set-map-prompt set-default-attr \\",
410 "Set default [A]lignment [F]ormat f[O]nt [P]rotection [H]eight [W]idth",
411 "",
412 "bind-key meta set-default-attr d",
413 "bind-key meta set-region-attr r",
414 "bind-key meta set-cell-attr a",
415 "",
416 "bind-key set-cell-attr set-cell-alignment a",
417 "bind-key set-cell-attr set-cell-format f",
418 "bind-key set-cell-attr set-cell-font o",
419 "bind-key set-cell-attr set-cell-protection p",
420 "bind-key set-cell-attr set-cell-height h",
421 "bind-key set-cell-attr set-cell-width w",
422 "bind-key set-cell-attr set-cell-alignment A",
423 "bind-key set-cell-attr set-cell-format F",
424 "bind-key set-cell-attr set-cell-font O",
425 "bind-key set-cell-attr set-cell-protection P",
426 "bind-key set-cell-attr set-cell-height H",
427 "bind-key set-cell-attr set-cell-width W",
428 "",
429 "bind-key set-region-attr set-region-alignment a",
430 "bind-key set-region-attr set-region-format f",
431 "bind-key set-region-attr set-region-font o",
432 "bind-key set-region-attr set-region-protection p",
433 "bind-key set-region-attr set-region-height h",
434 "bind-key set-region-attr set-region-width w",
435 "bind-key set-region-attr set-region-alignment A",
436 "bind-key set-region-attr set-region-format F",
437 "bind-key set-region-attr set-region-font O",
438 "bind-key set-region-attr set-region-protection P",
439 "bind-key set-region-attr set-region-height H",
440 "bind-key set-region-attr set-region-width W",
441 "",
442 "bind-key set-default-attr set-default-alignment a",
443 "bind-key set-default-attr set-default-format f",
444 "bind-key set-default-attr set-default-font o",
445 "bind-key set-default-attr set-default-protection p",
446 "bind-key set-default-attr set-default-height h",
447 "bind-key set-default-attr set-default-width w",
448 "bind-key set-default-attr set-default-alignment A",
449 "bind-key set-default-attr set-default-format F",
450 "bind-key set-default-attr set-default-font O",
451 "bind-key set-default-attr set-default-protection P",
452 "bind-key set-default-attr set-default-height H",
453 "bind-key set-default-attr set-default-width W",
454 "",
455 "create-keymap view-info universal",
456 "bind-key view-info exit-minibuffer ^[",
457 "bind-key view-info page-info \\ ",
458 "bind-key view-info page-info +",
459 "bind-key view-info page-info-backwards -",
460 "",
461 "set-map-prompt view-info \\",
462 "+ (forward page) - (backward page) ESC (return to spreadsheet editing)",
463 "",
464 "",
465 "",
466 "",
467 "",
468 "# Verbose menu type keymaps use exit-minibuffer to move closer",
469 "# to the root of the menu.",
470 "",
471 "create-keymap generic-menu universal",
472 "bind-key generic-menu exit-minibuffer ^[",
473 "bind-key generic-menu exit-minibuffer ^m",
474 "bind-key generic-menu exit-minibuffer ^j",
475 "",
476 #ifdef HAVE_LIBPLOT
477 "# Graphing with GNU Plotutils",
478 "",
479 "create-keymap plotutils-commands generic-menu",
480 "name-macro-string plotutils-setup \\",
481 " {with-keymap plotutils-commands}{builtin-help Plotutils-graphs}",
482 "bind-key generic-meta plotutils-setup g",
483 "set-map-prompt plotutils-commands \\",
484 "(R C o d v, p x y t s f, X P B Esc)? ",
485 "",
486 "bind-key plotutils-commands plotutils-plot p",
487 "bind-key plotutils-commands plotutils-set-data-title t",
488 "bind-key plotutils-commands plotutils-set-data d",
489 "bind-key plotutils-commands plotutils-set-style s",
490 "bind-key plotutils-commands plotutils-set-filename f",
491 "",
492 "bind-key plotutils-commands plotutils-xy X",
493 "bind-key plotutils-commands plotutils-pie P",
494 "bind-key plotutils-commands plotutils-bar B",
495 "",
496 "name-macro-string plotutils-preset-msg {display-msg Graph reset}",
497 "name-macro-string plotutils-presets-verbosely \\",
498 "{plotutils-presets}{plotutils-preset-msg}{set-info _expanded__info_graphing}",
499 "bind-key plotutils-commands plotutils-presets-verbosely R",
500 "",
501 "name-macro-string plotutils-clear-msg {display-msg Graph data reset}",
502 "name-macro-string plotutils-clear-verbosely \\",
503 "{plotutils-clear-datasets}{plotutils-clear-msg}{set-info _expanded__info_graphing}",
504 "bind-key plotutils-commands plotutils-clear-verbosely C",
505 "",
506 "create-keymap plotutils-terminal-types universal",
507 "name-macro-string plotutils-select-output \\",
508 "{one-command-with-keymap plotutils-terminal-types}{builtin-help plotutils-output-types}",
509 "bind-key plotutils-commands plotutils-select-output o",
510 "set-map-prompt plotutils-terminal-types \\",
511 "Graph output type (p t r m i f P h g n x X): ",
512 "bind-key plotutils-terminal-types plotutils-postscript p",
513 "bind-key plotutils-terminal-types plotutils-tek t",
514 "bind-key plotutils-terminal-types plotutils-regis r",
515 "bind-key plotutils-terminal-types plotutils-metaplot m",
516 "bind-key plotutils-terminal-types plotutils-illustrator i",
517 "bind-key plotutils-terminal-types plotutils-fig f",
518 "bind-key plotutils-terminal-types plotutils-pcl P",
519 "bind-key plotutils-terminal-types plotutils-hpgl h",
520 "bind-key plotutils-terminal-types plotutils-gif g",
521 "bind-key plotutils-terminal-types plotutils-png n",
522 "bind-key plotutils-terminal-types plotutils-x-color X",
523 "bind-key plotutils-terminal-types plotutils-x-mono x",
524 "",
525 "create-keymap view-plotutils-parameters view-info",
526 "name-macro-string plotutils-verify \\",
527 "{plotutils-make-info}{with-keymap view-plotutils-parameters}{set-info graphing-parameters}",
528 "bind-key plotutils-commands plotutils-verify v",
529 "set-map-prompt view-plotutils-parameters \\",
530 "+ (forward page) - (backward page) p (plot) or ESC",
531 "bind-key view-plotutils-parameters plotutils-plot p",
532 "",
533 "create-keymap plotutils-x-axis-commands generic-menu",
534 "name-macro-string plotutils-x-axis \\",
535 "{with-keymap plotutils-x-axis-commands}{builtin-help plotutils-x-axis-help}",
536 "bind-key plotutils-commands plotutils-x-axis x",
537 "set-map-prompt plotutils-x-axis-commands X-axis (s [ ] l L Esc)",
538 "",
539 "name-macro-string plotutils-set-x-range-low {plotutils-set-axis-low x}",
540 "name-macro-string plotutils-set-x-range-high {plotutils-set-axis-high x}",
541 "bind-key plotutils-x-axis-commands plotutils-set-x-range-low [",
542 "bind-key plotutils-x-axis-commands plotutils-set-x-range-high ]",
543 "name-macro-string plotutils-set-x-labels {plotutils-set-axis-labels x}",
544 "bind-key plotutils-x-axis-commands plotutils-set-x-labels l",
545 "name-macro-string plotutils-default-x-labels {plotutils-default-axis-labels x}",
546 "bind-key plotutils-x-axis-commands plotutils-default-x-labels L",
547 "",
548 "create-keymap plotutils-y-axis-commands generic-menu",
549 "name-macro-string plotutils-y-axis \\",
550 "{with-keymap plotutils-y-axis-commands}{builtin-help plotutils-y-axis-help}",
551 "bind-key plotutils-commands plotutils-y-axis y",
552 "set-map-prompt plotutils-y-axis-commands Y-axis (s [ ] l L Esc)",
553 "",
554 "name-macro-string plotutils-set-y-range-low {plotutils-set-axis-low y}",
555 "name-macro-string plotutils-set-y-range-high {plotutils-set-axis-high y}",
556 "bind-key plotutils-y-axis-commands plotutils-set-y-range-low [",
557 "bind-key plotutils-y-axis-commands plotutils-set-y-range-high ]",
558 "name-macro-string plotutils-set-y-labels {plotutils-set-axis-labels y}",
559 "bind-key plotutils-y-axis-commands plotutils-set-y-labels l",
560 "name-macro-string plotutils-default-y-labels {plotutils-default-axis-labels y}",
561 "bind-key plotutils-y-axis-commands plotutils-default-y-labels L",
562 "",
563 #else
564 /* Don't use gnuplot if you also have plotutils */
565 # ifdef WITH_GNUPLOT
566 "# Graphing with gnuplot",
567 "",
568 "create-keymap graph-commands generic-menu",
569 "name-macro-string graph-setup \\",
570 " {with-keymap graph-commands}{builtin-help graphing}",
571 "bind-key generic-meta graph-setup g",
572 "set-map-prompt graph-commands \\",
573 "(R C o x y t d s p Esc)? ",
574 "",
575 "name-macro-string graph-preset-msg {display-msg Graph reset}",
576 "name-macro-string graph-presets-verbosely \\",
577 "{graph-presets}{graph-preset-msg}{set-info _expanded__info_graphing}",
578 "bind-key graph-commands graph-presets-verbosely R",
579 "",
580 "name-macro-string graph-clear-msg {display-msg Graph data reset}",
581 "name-macro-string graph-clear-verbosely \\",
582 "{graph-clear-datasets}{graph-clear-msg}{set-info _expanded__info_graphing}",
583 "bind-key graph-commands graph-clear-verbosely C",
584 "",
585 "bind-key graph-commands graph-set-data-title t",
586 "bind-key graph-commands graph-set-data d",
587 "bind-key graph-commands graph-set-style s",
588 "bind-key graph-commands graph-plot p",
589 "",
590 "create-keymap view-graphing-parameters view-info",
591 "name-macro-string graph-verify \\",
592 "{graph-make-info}{with-keymap view-graphing-parameters}{set-info graphing-parameters}",
593 "bind-key graph-commands graph-verify v",
594 "set-map-prompt view-graphing-parameters \\",
595 "+ (forward page) - (backward page) p (plot) or ESC",
596 "bind-key view-graphing-parameters graph-plot p",
597 "",
598 "create-keymap graph-terminal-types universal",
599 "name-macro-string graph-select-output \\",
600 "{one-command-with-keymap graph-terminal-types}{builtin-help graph-output-types}",
601 "bind-key graph-commands graph-select-output o",
602 "set-map-prompt graph-terminal-types \\",
603 "Graph output type (x X P): ",
604 "bind-key graph-terminal-types graph-postscript p",
605 "",
606 "create-keymap graph-x-axis-commands generic-menu",
607 "name-macro-string graph-x-axis \\",
608 "{with-keymap graph-x-axis-commands}{builtin-help graph-x-axis-help}",
609 "bind-key graph-commands graph-x-axis x",
610 "set-map-prompt graph-x-axis-commands X-axis (s [ ] l L Esc)",
611 "",
612 "name-macro-string graph-set-x-range-low {graph-set-axis-low x}",
613 "name-macro-string graph-set-x-range-high {graph-set-axis-high x}",
614 "bind-key graph-x-axis-commands graph-set-x-range-low [",
615 "bind-key graph-x-axis-commands graph-set-x-range-high ]",
616 "bind-key graph-x-axis-commands graph-set-x-axis-symbolic s",
617 "name-macro-string graph-set-x-labels {graph-set-axis-labels x}",
618 "bind-key graph-x-axis-commands graph-set-x-labels l",
619 "name-macro-string graph-default-x-labels {graph-default-axis-labels x}",
620 "bind-key graph-x-axis-commands graph-default-x-labels L",
621 "",
622 "create-keymap graph-y-axis-commands generic-menu",
623 "name-macro-string graph-y-axis \\",
624 "{with-keymap graph-y-axis-commands}{builtin-help graph-y-axis-help}",
625 "bind-key graph-commands graph-y-axis y",
626 "set-map-prompt graph-y-axis-commands Y-axis (s [ ] l L Esc)",
627 "",
628 "name-macro-string graph-set-y-range-low {graph-set-axis-low y}",
629 "name-macro-string graph-set-y-range-high {graph-set-axis-high y}",
630 "bind-key graph-y-axis-commands graph-set-y-range-low [",
631 "bind-key graph-y-axis-commands graph-set-y-range-high ]",
632 "name-macro-string graph-set-y-labels {graph-set-axis-labels y}",
633 "bind-key graph-y-axis-commands graph-set-y-labels l",
634 "name-macro-string graph-default-y-labels {graph-default-axis-labels y}",
635 "bind-key graph-y-axis-commands graph-default-y-labels L",
636 "",
637 # endif /* WITH_GNUPLOT */
638 #endif /* ~ HAVE_LIBPLOT */
639 "# printing",
640 "",
641 "create-keymap print-commands universal",
642 "bind-key meta print-commands ^p",
643 "set-map-prompt print-commands \\",
644 "[A]scii or [P]ostscript printing? ",
645 "",
646 "bind-key print-commands print-region a",
647 "bind-key print-commands print-region A",
648 "",
649 "create-keymap psprint-commands universal",
650 "bind-key print-commands psprint-commands p",
651 "bind-key print-commands psprint-commands P",
652 "set-map-prompt psprint-commands \\",
653 "set default [F]ont set page [S]ize [P]rint",
654 "",
655 "bind-key psprint-commands set-page-size s",
656 "bind-key psprint-commands set-page-size S",
657 "bind-key psprint-commands set-default-ps-font f",
658 "bind-key psprint-commands set-default-ps-font F",
659 "bind-key psprint-commands psprint-region p",
660 "bind-key psprint-commands psprint-region P",
661 "",
662 "",
663 "# Other init commands:",
664 "define-font times *times-medium-r-* Times-Roman",
665 "define-font times-italic *times-medium-i-* Times-Italic",
666 "define-font times-oblique *times-medium-o-* Times-Italic",
667 "define-font times-bold *times-bold-r-* Times-Bold",
668 "define-font times-oblique-bold *times-bold-o-* Times-BoldItalic",
669 "define-font times-italic-bold *times-bold-i-* Times-BoldItalic",
670 "define-font courier *courier-medium-r-* Courier",
671 "define-font courier-oblique *courier-medium-o-* Courier-Italic",
672 "define-font courier-bold *courier-bold-r-* Courier-Bold",
673 "define-font courier-bold-oblique *courier-bold-o-* Courier-BoldItalic",
674 "define-font helvetica *helvetica-medium-r-* Helvetica",
675 "define-font helvetica-oblique *helvetica-medium-o-* Helvetica-Italic",
676 "define-font helvetica-bold *helvetica-bold-r-* Helvetica-Bold",
677 "define-font helvetica-bold-oblique *helvetica-bold-o-* Helvetica-BoldItalic",
678 "define-font fixed *fixed-medium-r-* Times-Roman",
679
680 0
681
682 };
683
684 void
run_init_cmds(void)685 run_init_cmds (void)
686 {
687 char **p = init_cmds;
688 while (*p)
689 {
690 char * cmd = strdup (*p++);
691 int len = strlen (cmd);
692 while (len && *p && (cmd [len - 1] == '\\')
693 && ((len == 1) || cmd[len - 2] != '\\'))
694 {
695 cmd [len - 1] = '\0';
696 len += strlen (*p);
697 cmd = ck_realloc (cmd, len + 1);
698 strcat (cmd, *p);
699 ++p;
700 }
701 execute_command (cmd);
702 free (cmd);
703 }
704 }
705