Index: plugins/octave/octave/tm-start.oct
===================================================================
--- plugins/octave/octave/tm-start.oct	(revision 2851)
+++ plugins/octave/octave/tm-start.oct	(working copy)
@@ -1,11 +1,28 @@
 d=getenv("TEXMACS_PATH");
 if (length(d) > 0)
-	LOADPATH=[[d,"/plugins/octave/octave/tm:"],[d,"/plugins/octave/octave/plot:"],[d,"/plugins/octave/octave/polynomial:"],LOADPATH];
-        PS1="\\002channel:prompt\\005octave> \\005";
-        PS2="\\002channel:prompt\\005> \\005";
-        global TMSTRUCT=0;
-        global TMCOLORS=["black"; "red"; "magenta"; "orange"; "green"; "blue";];         global TMCOLIDX=6;
-	gset terminal postscript eps enhanced color;
-	gset size 0.5,0.5;
-	tmrepl
+#   Note: What follows is already executed by the .octaverc script (verbatim),
+#         and is therefore commented out here.
+#    if (exist ("OCTAVE_VERSION") == 5)
+#        fsep=filesep();
+#        prefix=[d,fsep,"plugins",fsep,"octave",fsep,"octave",fsep];
+#        addpath ([prefix,"tm"],         "-end");
+#        addpath ([prefix,"plot"],       "-end");
+#        addpath ([prefix,"polynomial"], "-end");
+#    else
+#        LOADPATH=[LOADPATH,                              \
+#                  [d,"/plugins/octave/octave/tm:"],      \
+#                  [d,"/plugins/octave/octave/plot:"],    \
+#                  [d,"/plugins/octave/octave/polynomial:"]];
+#    endif
+#    if (exist ("OCTAVE_VERSION") == 5)
+#        PS1("\\002channel:prompt\\005octave> \\005");
+#        PS2("\\002channel:prompt\\005> \\005");
+#    else
+#        PS1="\\002channel:prompt\\005octave> \\005";
+#        PS2="\\002channel:prompt\\005> \\005";
+#    endif
+#    global TMSTRUCT=0;
+#    global TMCOLORS=["black"; "red"; "magenta"; "orange"; "green"; "blue";];
+#    global TMCOLIDX=rows(TMCOLORS);
+    tmrepl
 endif
Index: plugins/octave/octave/.octaverc
===================================================================
--- plugins/octave/octave/.octaverc	(revision 2851)
+++ plugins/octave/octave/.octaverc	(working copy)
@@ -1,11 +1,43 @@
 d=getenv("TEXMACS_PATH");
 if (length(d) > 0)
-	LOADPATH=[[d,"/plugins/octave/octave/tm:"],[d,"/plugins/octave/octave/plot:"],[d,"/plugins/octave/octave/polynomial:"],LOADPATH];
+
+    # Add the following directories to Octave's ``load path'':
+    #   - ${TEXMACS_PATH}/plugins/octave/octave/tm
+    #   - ${TEXMACS_PATH}/plugins/octave/octave/plot
+    #   - ${TEXMACS_PATH}/plugins/octave/octave/polynomial
+    if (exist ("OCTAVE_VERSION") == 5)
+        # As of Octave version 3, "instead of setting the built-in variable
+        # LOADPATH, you must use addpath [...] to manipulate the function
+        # search path." [1]
+        fsep=filesep();
+        prefix=[d,fsep,"plugins",fsep,"octave",fsep,"octave",fsep];
+        addpath ([prefix,"tm"],         "-end");
+        addpath ([prefix,"plot"],       "-end");
+        addpath ([prefix,"polynomial"], "-end");
+        # NB: filesep() is used above for portability.
+    else
+        LOADPATH=[LOADPATH,                              \
+                  [d,"/plugins/octave/octave/tm:"],      \
+                  [d,"/plugins/octave/octave/plot:"],    \
+                  [d,"/plugins/octave/octave/polynomial:"]];
+    endif
+
+    # Customize the command-line prompt.
+    if (exist ("OCTAVE_VERSION") == 5)
+        # As of Octave version 3, "all built-in variables have been converted
+        # to functions." [1]
+        PS1("\\002channel:prompt\\005octave> \\005");
+        PS2("\\002channel:prompt\\005> \\005");
+    else
         PS1="\\002channel:prompt\\005octave> \\005";
         PS2="\\002channel:prompt\\005> \\005";
-        global TMSTRUCT=0;
-        global TMCOLORS=["black"; "red"; "magenta"; "orange"; "green"; "blue";];         global TMCOLIDX=6;
-	gset terminal postscript eps enhanced color;
-	gset size 0.5,0.5;
+    endif
+
+    # Define some global variables.
+    global TMSTRUCT=0;
+    global TMCOLORS=["black"; "red"; "magenta"; "orange"; "green"; "blue";];
+    global TMCOLIDX=rows(TMCOLORS);
+
 endif
 
+# [1] <http://www.gnu.org/software/octave/NEWS-3.html>
