1d=getenv("TEXMACS_PATH");
2if (length(d) > 0)
3    # Add the following directories to Octave's ``load path'':
4    #   - ${TEXMACS_PATH}/plugins/octave/octave/tm
5    #   - ${TEXMACS_PATH}/plugins/octave/octave/plot
6    #   - ${TEXMACS_PATH}/plugins/octave/octave/polynomial
7    if (exist ("OCTAVE_VERSION") == 5)
8        # As of Octave version 3, "instead of setting the built-in variable
9        # LOADPATH, you must use addpath [...] to manipulate the function
10        # search path." [1]
11        fsep=filesep();
12        prefix=[d,fsep,"plugins",fsep,"octave",fsep,"octave",fsep];
13        addpath ([prefix,"tm"],         "-end");
14        addpath ([prefix,"plot"],       "-end");
15        addpath ([prefix,"polynomial"], "-end");
16        # NB: filesep() is used above for portability.
17    else
18        LOADPATH=[LOADPATH,                              \
19                  [d,"/plugins/octave/octave/tm:"],      \
20                  [d,"/plugins/octave/octave/plot:"],    \
21                  [d,"/plugins/octave/octave/polynomial:"]];
22    endif
23
24    # Customize the command-line prompt.
25    if (exist ("OCTAVE_VERSION") == 5)
26        # As of Octave version 3, "all built-in variables have been converted
27        # to functions." [1]
28        PS1("\\002channel:prompt\\005octave> \\005");
29        PS2("\\002channel:prompt\\005> \\005");
30    else
31        PS1="\\002channel:prompt\\005octave> \\005";
32        PS2="\\002channel:prompt\\005> \\005";
33    endif
34
35    # Define some global variables.
36    global TMSTRUCT=0;
37    global TMCOLORS=["black"; "red"; "magenta"; "orange"; "green"; "blue";];
38    global TMCOLIDX=rows(TMCOLORS);
39endif
40
41# [1] <http://www.gnu.org/software/octave/NEWS-3.html>
42