changelog shortlog tags changeset files revisions annotate raw

scripts/miscellaneous/dump_prefs.m

changeset 10289: 4b124317dc38
parent:93c65f2a5668
author: John W. Eaton <jwe@octave.org>
date: Tue Feb 09 20:58:55 2010 -0500 (50 minutes ago)
permissions: -rw-r--r--
description: base_properties::set_children: account for hidden children
1## Copyright (C) 1994, 1995, 1996, 1997, 1998, 2000, 2003, 2005, 2006,
2## 2007 John W. Eaton
3##
4## This file is part of Octave.
5##
6## Octave is free software; you can redistribute it and/or modify it
7## under the terms of the GNU General Public License as published by
8## the Free Software Foundation; either version 3 of the License, or (at
9## your option) any later version.
10##
11## Octave is distributed in the hope that it will be useful, but
12## WITHOUT ANY WARRANTY; without even the implied warranty of
13## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14## General Public License for more details.
15##
16## You should have received a copy of the GNU General Public License
17## along with Octave; see the file COPYING. If not, see
18## <http://www.gnu.org/licenses/>.
19
20## -*- texinfo -*-
21## @deftypefn {Function File} {} dump_prefs (@var{file})
22## Have Octave dump all the current user preference variables to
23## @var{file} in a format that can be parsed by Octave later. If
24## @var{file} is omitted, the listing is printed to stdout.
25## @end deftypefn
26
27## Author: jwe
28
29function dump_prefs (file)
30
31 if (nargin == 0)
32 file = stdout;
33 endif
34
35 ## FIXME -- it would be nice to be able to get the list of
36 ## built-in variables directly from Octave so that we wouldn't have to
37 ## remember to update it each time the list of preference variables
38 ## changes
39
40 ## Note that these are no longer variables.
41
42 sym_list = ["EDITOR";
43 "EXEC_PATH";
44 "IMAGE_PATH";
45 "PAGER";
46 "PS1";
47 "PS2";
48 "PS4";
49 "beep_on_error";
50 "completion_append_char";
51 "crash_dumps_octave_core";
52 "echo_executing_commands";
53 "fixed_point_format";
54 "gnuplot_binary";
55 "gnuplot_command_end";
56 "gnuplot_command_plot";
57 "gnuplot_command_replot";
58 "gnuplot_command_splot";
59 "gnuplot_command_title";
60 "gnuplot_command_using";
61 "gnuplot_command_with";
62 "history_file";
63 "history_size";
64 "ignore_function_time_stamp";
65 "info_file";
66 "info_program";
67 "makeinfo_program";
68 "max_recursion_depth";
69 "output_max_field_width";
70 "output_precision";
71 "page_output_immediately";
72 "page_screen_output";
73 "print_answer_id_name";
74 "print_empty_dimensions";
75 "save_precision";
76 "saving_history";
77 "sighup_dumps_octave_core";
78 "sigterm_dumps_octave_core";
79 "silent_functions";
80 "split_long_rows";
81 "string_fill_char";
82 "struct_levels_to_print";
83 "suppress_verbose_help_message"];
84
85 for i = 1:rows(sym_list)
86 sym = deblank (sym_list(i,:));
87 try
88 val = feval (sym);
89 if (isnumeric (val))
90 val = sprintf ("%g", val);
91 endif
92 fprintf (file, " %s = %s\n", sym, val);
93 catch
94 fprintf (file, "# %s = <no value or error in displaying it>\n", sym);
95 end_try_catch
96 endfor
97
98endfunction