changeset 15377:e4ecc18a24cc

Merge in Daniel's and Torsten's changes
author Jordi Gutiérrez Hermoso <jordigh@octave.org>
date Thu, 13 Sep 2012 12:32:51 -0400
parents 860b4edb0bea (current diff) b5f28cc401b9 (diff)
children 027898e1d21c
files libgui/src/Makefile.am libgui/src/link-deps.mk libgui/src/m-editor/file-editor-tab.cc libgui/src/octave-gui.cc
diffstat 62 files changed, 1436 insertions(+), 1347 deletions(-) [+]
line wrap: on
line diff
--- a/build-aux/common.mk	Thu Sep 13 12:32:17 2012 -0400
+++ b/build-aux/common.mk	Thu Sep 13 12:32:51 2012 -0400
@@ -114,13 +114,10 @@
 ## FIXME: CC_VERSION is deprecated and should be removed in version 3.12
 CC_VERSION = @CC_VERSION@
 GCC_VERSION = @GCC_VERSION@
-CONFIGURE_CFLAGS = @CFLAGS@
 CPICFLAG = @CPICFLAG@
 XTRA_CFLAGS = @XTRA_CFLAGS@
 WARN_CFLAGS = @WARN_CFLAGS@
-AM_CFLAGS = $(CONFIGURE_CFLAGS) \
-  $(XTRA_CFLAGS) $(WARN_CFLAGS)
-BUG_CFLAGS = $(XTRA_CFLAGS) $(WARN_CFLAGS) $(CFLAGS)
+AM_CFLAGS = $(XTRA_CFLAGS)
 
 BUILD_CC = @BUILD_CC@
 BUILD_CFLAGS = @BUILD_CFLAGS@
@@ -139,13 +136,10 @@
 CXX_VERSION = @CXX_VERSION@
 GXX_VERSION = @GXX_VERSION@
 CXXCPP = @CXXCPP@
-CONFIGURE_CXXFLAGS = @CXXFLAGS@
 CXXPICFLAG = @CXXPICFLAG@
 XTRA_CXXFLAGS = @XTRA_CXXFLAGS@
 WARN_CXXFLAGS = @WARN_CXXFLAGS@
-AM_CXXFLAGS = $(CONFIGURE_CXXFLAGS) \
-  $(XTRA_CXXFLAGS) $(WARN_CXXFLAGS)
-BUG_CXXFLAGS = $(XTRA_CXXFLAGS) $(WARN_CXXFLAGS) $(CXXFLAGS)
+AM_CXXFLAGS = $(XTRA_CXXFLAGS)
 
 BUILD_CXX = @BUILD_CXX@
 BUILD_CXXFLAGS = @BUILD_CXXFLAGS@
--- a/configure.ac	Thu Sep 13 12:32:17 2012 -0400
+++ b/configure.ac	Thu Sep 13 12:32:51 2012 -0400
@@ -702,8 +702,6 @@
 
     save_CPPFLAGS="$CPPFLAGS"
     save_CXXFLAGS="$CXXFLAGS"
-    save_LIBS="$LIBS"
-    save_LDFLAGS="$LDFLAGS"
 
     ## Use -isystem if available because we don't want to see warnings in LLVM
     LLVM_INCLUDE_FLAG=-I
@@ -724,29 +722,13 @@
     dnl
     CPPFLAGS="-D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS $LLVM_CPPFLAGS $CPPFLAGS"
     CXXFLAGS="$LLVM_CXXFLAGS $CXXFLAGS"
-    LIBS="$LLVM_LIBS $LIBS"
-    LDFLAGS="$LLVM_LDFLAGS $LDFLAGS"
-
     AC_LANG_PUSH(C++)
-    AC_CHECK_HEADERS([llvm/LLVMContext.h llvm/Support/TargetSelect.h], [
-      AC_MSG_CHECKING([for llvm::getGlobalContext in llvm/LLVMContext.h])
-        AC_COMPILE_IFELSE(
-          [AC_LANG_PROGRAM([[
-            #include <llvm/LLVMContext.h>
-            ]], [[
-            llvm::LLVMContext& ctx = llvm::getGlobalContext ();
-            ]])],
-          [AC_MSG_RESULT([yes])
-           warn_llvm=
-           XTRA_CXXFLAGS="$XTRA_CXXFLAGS $LLVM_CXXFLAGS $LLVM_CPPFLAGS"],
-          [AC_MSG_RESULT([no])
-      ])
-    ])
+    AC_CHECK_HEADER([llvm/Support/TargetSelect.h], [
+      warn_llvm=
+      XTRA_CXXFLAGS="$XTRA_CXXFLAGS $LLVM_CXXFLAGS $LLVM_CPPFLAGS"])
     AC_LANG_POP(C++)
     CPPFLAGS="$save_CPPFLAGS"
     CXXFLAGS="$save_CXXFLAGS"
-    LIBS="$save_LIBS"
-    LDFLAGS="$save_LDFLAGS"
   fi
 
   if test -z "$warn_llvm"; then
@@ -1231,16 +1213,17 @@
   [Fortran 77], [don't use qrupdate, disable QR & Cholesky updating functions])
 
 if test "$octave_cv_lib_qrupdate" = yes; then
-  LIBS="$LIBS $QRUPDATE_LIBS"
-  AC_LANG_PUSH([Fortran 77])
-  AC_MSG_CHECKING([for slup1up in $QRUPDATE_LIBS])
-  octave_qrupdate_luu=no
-  AC_LINK_IFELSE([AC_LANG_CALL([], [slup1up])], [octave_qrupdate_luu=yes])
-  AC_MSG_RESULT([$octave_qrupdate_luu])
-  if test "$octave_qrupdate_luu" = yes; then
+  AC_CACHE_CHECK([for slup1up in $QRUPDATE_LIBS],
+    [octave_cv_func_slup1up],
+    [LIBS="$LIBS $QRUPDATE_LIBS"
+    AC_LANG_PUSH([Fortran 77])
+    AC_LINK_IFELSE([AC_LANG_CALL([], [slup1up])],
+      octave_cv_func_slup1up=yes, octave_cv_func_slup1up=no)
+    AC_LANG_POP([Fortran 77])
+  ])
+  if test $octave_cv_func_slup1up = yes; then
     AC_DEFINE(HAVE_QRUPDATE_LUU, 1, [Define to 1 if qrupdate supports LU updates.])
   fi
-  AC_LANG_POP([Fortran 77])
 fi
 LIBS="$save_LIBS"
 
@@ -2519,7 +2502,6 @@
   examples/Makefile
   libgnu/Makefile
   libgui/Makefile
-  libgui/src/Makefile
   libinterp/Makefile
   liboctave/Makefile
   liboctave/cruft/Makefile
--- a/libgui/Makefile.am	Thu Sep 13 12:32:17 2012 -0400
+++ b/libgui/Makefile.am	Thu Sep 13 12:32:51 2012 -0400
@@ -20,8 +20,63 @@
 
 include $(top_srcdir)/build-aux/common.mk
 
-SUBDIRS = src
+AUTOMAKE_OPTIONS = subdir-objects
+
+QT_INCDIR = @QT_INCDIR@
+
+QT_LIBDIR = @QT_LIBDIR@
+
+QT_LIBS = -lQtCore -lQtGui -lQtNetwork -lqscintilla2
+
+QT_LDFLAGS = -L$(QT_LIBDIR)
+
+MOC_CPPFLAGS =
+
+octlib_LTLIBRARIES = liboctgui.la
+
+EXTRA_DIST = default-qt-settings
+
+BUILT_SOURCES =
+
+CLEANFILES =
+
+noinst_HEADERS =
+
+noinst_LTLIBRARIES =
+
+include src/module.mk
+include qterminal-module.mk
+
+include link-deps.mk
+
+liboctgui_la_LIBADD = \
+  qterminal/libqterminal.la \
+  src/libgui-src.la \
+  $(top_builddir)/libinterp/liboctinterp.la \
+  $(top_builddir)/liboctave/liboctave.la \
+  $(LIBOCTGUI_LINK_DEPS)
+
+# Increment these as needed and according to the rules in the libtool manual:
+liboctgui_current = 0
+liboctgui_revision = 0
+liboctgui_age = 0
+
+liboctgui_version_info = $(liboctgui_current):$(liboctgui_revision):$(liboctgui_age)
+
+liboctgui_la_LDFLAGS = \
+  -version-info $(liboctgui_version_info) \
+  $(NO_UNDEFINED_LDFLAG) \
+  -bindir $(bindir) \
+  $(LIBOCTGUI_LINK_OPTS)
 
 octetc_DATA = default-qt-settings
 
-EXTRA_DIST = default-qt-settings
+moc-%.cc: %.h
+	@MOC@ -o$@ $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(MOC_CPPFLAGS) $(liboctgui_la_CPPFLAGS) $<
+
+ui-%.h: %.ui
+	@UIC@ -o $@ $<
+
+qrc-%.cc: %.qrc
+	@RCC@ -o $@ $<
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libgui/link-deps.mk	Thu Sep 13 12:32:51 2012 -0400
@@ -0,0 +1,21 @@
+include $(top_srcdir)/libinterp/link-deps.mk
+
+if AMCOND_ENABLE_DYNAMIC_LINKING
+  LIBOCTGUI_LINK_DEPS =
+else
+  LIBOCTGUI_LINK_DEPS = $(DLDFCN_LIBS)
+endif
+
+LIBOCTGUI_LINK_DEPS += \
+  $(QT_LIBS)
+
+LIBOCTGUI_LINK_OPTS = \
+  $(QT_LDFLAGS)
+
+if AMCOND_LINK_ALL_DEPS
+  LIBOCTGUI_LINK_DEPS += $(LIBOCTINTERP_LINK_DEPS)
+  LIBOCTGUI_LINK_OPTS += $(LIBOCTINTERP_LINK_OPTS)
+
+  OCTAVE_GUI_LINK_DEPS = $(LIBOCTGUI_LINK_DEPS)
+  OCTAVE_GUI_LINK_OPTS = $(LIBOCTGUI_LINK_OPTS)
+endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libgui/qterminal-module.mk	Thu Sep 13 12:32:51 2012 -0400
@@ -0,0 +1,92 @@
+EXTRA_DIST += \
+  qterminal-module.mk
+
+noinst_HEADERS += \
+  qterminal/libqterminal/QTerminal.h \
+  qterminal/libqterminal/QTerminalInterface.h \
+  qterminal/libqterminal/win32/QTerminalColors.h \
+  qterminal/libqterminal/win32/QWinTerminalImpl.h \
+  qterminal/libqterminal/unix/BlockArray.h \
+  qterminal/libqterminal/unix/Character.h \
+  qterminal/libqterminal/unix/CharacterColor.h \
+  qterminal/libqterminal/unix/Emulation.h \
+  qterminal/libqterminal/unix/ExtendedDefaultTranslator.h \
+  qterminal/libqterminal/unix/Filter.h \
+  qterminal/libqterminal/unix/History.h \
+  qterminal/libqterminal/unix/KeyboardTranslator.h \
+  qterminal/libqterminal/unix/konsole_wcwidth.h \
+  qterminal/libqterminal/unix/kpty.h \
+  qterminal/libqterminal/unix/kpty_p.h \
+  qterminal/libqterminal/unix/LineFont.h \
+  qterminal/libqterminal/unix/QUnixTerminalImpl.h \
+  qterminal/libqterminal/unix/Screen.h \
+  qterminal/libqterminal/unix/ScreenWindow.h \
+  qterminal/libqterminal/unix/TerminalCharacterDecoder.h \
+  qterminal/libqterminal/unix/Vt102Emulation.h \
+  qterminal/libqterminal/unix/SelfListener.h \
+  qterminal/libqterminal/unix/TerminalModel.h \
+  qterminal/libqterminal/unix/TerminalView.h
+
+qterminal_libqterminal_la_MOC = \
+  qterminal/libqterminal/moc-QTerminal.cc \
+  qterminal/libqterminal/moc-QTerminalInterface.cc
+
+nodist_qterminal_libqterminal_la_SOURCES = $(qterminal_libqterminal_la_MOC)
+
+qterminal_libqterminal_la_CPPFLAGS = \
+  $(AM_CPPFLAGS) \
+  -I$(QT_INCDIR) \
+  -I$(QT_INCDIR)/QtCore \
+  -I$(QT_INCDIR)/QtGui \
+  -I$(srcdir)/qterminal/libqterminal
+
+qterminal_libqterminal_la_CFLAGS = $(AM_CFLAGS)
+
+qterminal_libqterminal_la_CXXFLAGS = $(AM_CXXFLAGS)
+
+if WIN32_TERMINAL
+
+qterminal_libqterminal_la_SOURCES = \
+  qterminal/libqterminal/win32/QTerminalColors.cpp \
+  qterminal/libqterminal/win32/QWinTerminalImpl.cpp
+
+qterminal_libqterminal_la_MOC += qterminal/libqterminal/win32/moc-QWinTerminalImpl.cc
+qterminal_libqterminal_la_CPPFLAGS += -DUNICODE
+
+# This flag is required to let MOC know about Q_OS_WIN32.
+MOC_CPPFLAGS += -DWIN32
+
+else
+
+qterminal_libqterminal_la_SOURCES = \
+  qterminal/libqterminal/unix/BlockArray.cpp \
+  qterminal/libqterminal/unix/Emulation.cpp \
+  qterminal/libqterminal/unix/Filter.cpp \
+  qterminal/libqterminal/unix/History.cpp \
+  qterminal/libqterminal/unix/KeyboardTranslator.cpp \
+  qterminal/libqterminal/unix/konsole_wcwidth.cpp \
+  qterminal/libqterminal/unix/kpty.cpp \
+  qterminal/libqterminal/unix/QUnixTerminalImpl.cpp \
+  qterminal/libqterminal/unix/Screen.cpp \
+  qterminal/libqterminal/unix/ScreenWindow.cpp \
+  qterminal/libqterminal/unix/TerminalCharacterDecoder.cpp \
+  qterminal/libqterminal/unix/Vt102Emulation.cpp \
+  qterminal/libqterminal/unix/SelfListener.cpp \
+  qterminal/libqterminal/unix/TerminalModel.cpp \
+  qterminal/libqterminal/unix/TerminalView.cpp
+
+qterminal_libqterminal_la_MOC += \
+  qterminal/libqterminal/unix/moc-Emulation.cc \
+  qterminal/libqterminal/unix/moc-Filter.cc \
+  qterminal/libqterminal/unix/moc-QUnixTerminalImpl.cc \
+  qterminal/libqterminal/unix/moc-ScreenWindow.cc \
+  qterminal/libqterminal/unix/moc-SelfListener.cc \
+  qterminal/libqterminal/unix/moc-TerminalModel.cc \
+  qterminal/libqterminal/unix/moc-TerminalView.cc \
+  qterminal/libqterminal/unix/moc-Vt102Emulation.cc
+
+endif
+
+noinst_LTLIBRARIES += qterminal/libqterminal.la
+
+CLEANFILES += $(qterminal_libqterminal_la_MOC)
--- a/libgui/src/Makefile.am	Thu Sep 13 12:32:17 2012 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,316 +0,0 @@
-# Copyright (C) 2012 John W. Eaton
-#
-# This file is part of Octave.
-#
-# Octave is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-#
-# Octave is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with Octave; see the file COPYING.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-include $(top_srcdir)/build-aux/common.mk
-
-QT_INCDIR = @QT_INCDIR@
-
-QT_LIBDIR = @QT_LIBDIR@
-
-QT_LIBS = -lQtCore -lQtGui -lQtNetwork -lqscintilla2
-
-QT_LDFLAGS = -L$(QT_LIBDIR)
-
-MOC_CPPFLAGS =
-
-SRCDIRS = \
-  m-editor \
-  qtinfo \
-  octave-adapter \
-  ../qterminal/libqterminal/unix \
-  ../qterminal/libqterminal/win32 \
-  ../qterminal/libqterminal \
-  ../qterminal
-
-octave_gui_MOC = \
-  m-editor/moc-file-editor-interface.cc \
-  m-editor/moc-file-editor-tab.cc \
-  m-editor/moc-file-editor.cc \
-  m-editor/moc-find-dialog.cc \
-  m-editor/moc-lexer-octave-gui.cc \
-  moc-documentation-dockwidget.cc \
-  moc-files-dockwidget.cc \
-  moc-history-dockwidget.cc \
-  moc-main-window.cc \
-  moc-octave-qt-event-listener.cc \
-  moc-settings-dialog.cc \
-  moc-terminal-dockwidget.cc \
-  moc-welcome-wizard.cc \
-  moc-workspace-model.cc \
-  moc-workspace-view.cc \
-  octave-adapter/moc-octave-main-thread.cc \
-  qtinfo/moc-parser.cc \
-  qtinfo/moc-webinfo.cc
-
-octave_gui_UI = \
-  settings-dialog.ui \
-  welcome-wizard.ui
-
-octave_gui_UI_H = $(patsubst %.ui, ui-%.h, $(octave_gui_UI))
-
-octave_gui_RC = qrc-resource.cc
-
-octlib_LTLIBRARIES = liboctgui.la
-
-liboctgui_la_SOURCES = \
-  documentation-dockwidget.cc \
-  files-dockwidget.cc \
-  history-dockwidget.cc \
-  m-editor/file-editor-tab.cc \
-  m-editor/file-editor.cc \
-  m-editor/find-dialog.cc \
-  m-editor/lexer-octave-gui.cc \
-  main-window.cc \
-  octave-adapter/octave-event.cc \
-  octave-adapter/octave-link.cc \
-  octave-adapter/octave-main-thread.cc \
-  octave-gui.cc \
-  octave-qt-event-listener.cc \
-  qtinfo/parser.cc \
-  qtinfo/webinfo.cc \
-  resource-manager.cc \
-  settings-dialog.cc \
-  symbol-information.cc \
-  terminal-dockwidget.cc \
-  welcome-wizard.cc \
-  workspace-model.cc \
-  workspace-view.cc
-
-nodist_liboctgui_la_SOURCES = $(octave_gui_MOC) $(octave_gui_RC)
-
-liboctgui_la_CPPFLAGS = \
-  @OCTGUI_DLL_DEFS@ \
-  -I$(QT_INCDIR) \
-  -I$(QT_INCDIR)/QtCore \
-  -I$(QT_INCDIR)/QtGui \
-  -I$(QT_INCDIR)/QtNetwork \
-  -I$(srcdir)/../qterminal/libqterminal \
-  -I$(srcdir)/m-editor \
-  -I$(srcdir)/octave-adapter \
-  -I$(srcdir)/qtinfo \
-  -I$(top_srcdir)/liboctave/cruft/misc \
-  -I$(top_srcdir)/liboctave/array \
-  -I$(top_builddir)/liboctave/numeric -I$(top_srcdir)/liboctave/numeric \
-  -I$(top_builddir)/liboctave/operators -I$(top_srcdir)/liboctave/operators \
-  -I$(top_srcdir)/liboctave/system \
-  -I$(top_srcdir)/liboctave/util \
-  -I$(top_srcdir)/libinterp \
-  -I$(top_builddir)/libinterp/parse-tree -I$(top_srcdir)/libinterp/parse-tree \
-  -I$(top_builddir)/libinterp/interp-core -I$(top_srcdir)/libinterp/interp-core \
-  -I$(top_builddir)/libinterp/interpfcn -I$(top_srcdir)/libinterp/interpfcn \
-  -I$(top_srcdir)/libinterp/octave-value
-
-include link-deps.mk
-
-liboctgui_la_LIBADD = \
-  libqterminal.la \
-  $(top_builddir)/libinterp/liboctinterp.la \
-  $(top_builddir)/liboctave/liboctave.la \
-  $(LIBOCTGUI_LINK_DEPS)
-
-# Increment these as needed and according to the rules in the libtool manual:
-liboctgui_current = 0
-liboctgui_revision = 0
-liboctgui_age = 0
-
-liboctgui_version_info = $(liboctgui_current):$(liboctgui_revision):$(liboctgui_age)
-
-liboctgui_la_LDFLAGS = \
-  -version-info $(liboctgui_version_info) \
-  $(NO_UNDEFINED_LDFLAG) \
-  -bindir $(bindir) \
-  $(LIBOCTGUI_LINK_OPTS)
-
-noinst_HEADERS = \
-  documentation-dockwidget.h \
-  files-dockwidget.h \
-  history-dockwidget.h \
-  m-editor/file-editor-interface.h \
-  m-editor/file-editor-tab.h \
-  m-editor/file-editor.h \
-  m-editor/find-dialog.h \
-  m-editor/lexer-octave-gui.h \
-  main-window.h \
-  octave-adapter/octave-event-listener.h \
-  octave-adapter/octave-event-observer.h \
-  octave-adapter/octave-event.h \
-  octave-adapter/octave-link.h \
-  octave-adapter/octave-main-thread.h \
-  octave-gui.h \
-  octave-qt-event-listener.h \
-  qtinfo/parser.h \
-  qtinfo/webinfo.h \
-  resource-manager.h \
-  settings-dialog.h \
-  symbol-information.h \
-  terminal-dockwidget.h \
-  welcome-wizard.h \
-  workspace-model.h \
-  workspace-view.h
-
-CLEANFILES = \
-  $(octave_gui_MOC) \
-  $(octave_gui_UI_H) \
-  $(octave_gui_RC)
-
-clean-local:
-	-if test "$(srcdir)" != "."; then \
-	   for d in $(SRCDIRS); do test -d $$d && rmdir $$d; done \
-	 fi
-
-BUILT_SOURCES = $(octave_gui_UI_H)
-
-octave_gui_ICONS = \
-  icons/arrow_right.png \
-  icons/artsbuilderexecute.png \
-  icons/bookmark.png \
-  icons/bp_next.png \
-  icons/bp_prev.png \
-  icons/bp_rm_all.png \
-  icons/bp_toggle.png \
-  icons/chat.png \
-  icons/configure.png \
-  icons/db_cont.png \
-  icons/db_step_in.png \
-  icons/db_step_out.png \
-  icons/db_step.png \
-  icons/db_stop.png \
-  icons/editcopy.png \
-  icons/editcut.png \
-  icons/editpaste.png \
-  icons/filenew.png \
-  icons/fileopen.png \
-  icons/filesaveas.png \
-  icons/filesave.png \
-  icons/find.png \
-  icons/help_index.png \
-  icons/icons_license \
-  icons/jabber_protocol.png \
-  icons/logo.png \
-  icons/question.png \
-  icons/redled.png \
-  icons/redo.png \
-  icons/search.png \
-  icons/star.png \
-  icons/stop.png \
-  icons/terminal.png \
-  icons/undo.png \
-  icons/up.png \
-  icons/zoom-in.png \
-  icons/zoom-out.png
-
-EXTRA_DIST = \
-  $(octave_gui_UI) \
-  $(octave_gui_ICONS) \
-  resource.qrc
-
-noinst_LTLIBRARIES = libqterminal.la
-
-noinst_HEADERS += \
-  ../qterminal/libqterminal/QTerminal.h \
-  ../qterminal/libqterminal/QTerminalInterface.h \
-  ../qterminal/libqterminal/win32/QTerminalColors.h \
-  ../qterminal/libqterminal/win32/QWinTerminalImpl.h \
-  ../qterminal/libqterminal/unix/BlockArray.h \
-  ../qterminal/libqterminal/unix/Character.h \
-  ../qterminal/libqterminal/unix/CharacterColor.h \
-  ../qterminal/libqterminal/unix/Emulation.h \
-  ../qterminal/libqterminal/unix/ExtendedDefaultTranslator.h \
-  ../qterminal/libqterminal/unix/Filter.h \
-  ../qterminal/libqterminal/unix/History.h \
-  ../qterminal/libqterminal/unix/KeyboardTranslator.h \
-  ../qterminal/libqterminal/unix/konsole_wcwidth.h \
-  ../qterminal/libqterminal/unix/kpty.h \
-  ../qterminal/libqterminal/unix/kpty_p.h \
-  ../qterminal/libqterminal/unix/LineFont.h \
-  ../qterminal/libqterminal/unix/QUnixTerminalImpl.h \
-  ../qterminal/libqterminal/unix/Screen.h \
-  ../qterminal/libqterminal/unix/ScreenWindow.h \
-  ../qterminal/libqterminal/unix/TerminalCharacterDecoder.h \
-  ../qterminal/libqterminal/unix/Vt102Emulation.h \
-  ../qterminal/libqterminal/unix/SelfListener.h \
-  ../qterminal/libqterminal/unix/TerminalModel.h \
-  ../qterminal/libqterminal/unix/TerminalView.h
-
-libqterminal_la_CPPFLAGS = \
-  -I$(QT_INCDIR) \
-  -I$(QT_INCDIR)/QtCore \
-  -I$(QT_INCDIR)/QtGui \
-  -I$(srcdir)/../qterminal/libqterminal
-
-libqterminal_la_MOC = \
-  ../qterminal/libqterminal/moc-QTerminal.cc \
-  ../qterminal/libqterminal/moc-QTerminalInterface.cc
-
-nodist_libqterminal_la_SOURCES = $(libqterminal_la_MOC)
-
-if WIN32_TERMINAL
-
-libqterminal_la_SOURCES = \
-  ../qterminal/libqterminal/win32/QTerminalColors.cpp \
-  ../qterminal/libqterminal/win32/QWinTerminalImpl.cpp
-
-libqterminal_la_MOC += ../qterminal/libqterminal/win32/moc-QWinTerminalImpl.cc
-libqterminal_la_CPPFLAGS += -DUNICODE
-
-# This flag is required to let MOC know about Q_OS_WIN32.
-MOC_CPPFLAGS += -DWIN32
-
-else
-
-libqterminal_la_SOURCES = \
-  ../qterminal/libqterminal/unix/BlockArray.cpp \
-  ../qterminal/libqterminal/unix/Emulation.cpp \
-  ../qterminal/libqterminal/unix/Filter.cpp \
-  ../qterminal/libqterminal/unix/History.cpp \
-  ../qterminal/libqterminal/unix/KeyboardTranslator.cpp \
-  ../qterminal/libqterminal/unix/konsole_wcwidth.cpp \
-  ../qterminal/libqterminal/unix/kpty.cpp \
-  ../qterminal/libqterminal/unix/QUnixTerminalImpl.cpp \
-  ../qterminal/libqterminal/unix/Screen.cpp \
-  ../qterminal/libqterminal/unix/ScreenWindow.cpp \
-  ../qterminal/libqterminal/unix/TerminalCharacterDecoder.cpp \
-  ../qterminal/libqterminal/unix/Vt102Emulation.cpp \
-  ../qterminal/libqterminal/unix/SelfListener.cpp \
-  ../qterminal/libqterminal/unix/TerminalModel.cpp \
-  ../qterminal/libqterminal/unix/TerminalView.cpp
-
-libqterminal_la_MOC += \
-  ../qterminal/libqterminal/unix/moc-Emulation.cc \
-  ../qterminal/libqterminal/unix/moc-Filter.cc \
-  ../qterminal/libqterminal/unix/moc-QUnixTerminalImpl.cc \
-  ../qterminal/libqterminal/unix/moc-ScreenWindow.cc \
-  ../qterminal/libqterminal/unix/moc-SelfListener.cc \
-  ../qterminal/libqterminal/unix/moc-TerminalModel.cc \
-  ../qterminal/libqterminal/unix/moc-TerminalView.cc \
-  ../qterminal/libqterminal/unix/moc-Vt102Emulation.cc
-
-endif
-
-moc-%.cc: %.h
-	test -d $(@D) || mkdir -p $(@D)
-	@MOC@ -o$@ $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(MOC_CPPFLAGS) $(liboctgui_la_CPPFLAGS) $<
-
-ui-%.h: %.ui
-	@UIC@ -o $@ $<
-
-qrc-%.cc: %.qrc
-	@RCC@ -o $@ $<
-
-CLEANFILES += $(libqterminal_la_MOC)
-
--- a/libgui/src/documentation-dockwidget.cc	Thu Sep 13 12:32:17 2012 -0400
+++ b/libgui/src/documentation-dockwidget.cc	Thu Sep 13 12:32:51 2012 -0400
@@ -26,8 +26,8 @@
 
 #include "documentation-dockwidget.h"
 
-documentation_dock_widget::documentation_dock_widget (QWidget *parent)
-  : QDockWidget (parent)
+documentation_dock_widget::documentation_dock_widget (QWidget *p)
+  : QDockWidget (p)
 {
   setObjectName ("DocumentationDockWidget");
   setWindowTitle (tr ("Documentation"));
@@ -47,8 +47,8 @@
 }
 
 void
-documentation_dock_widget::closeEvent (QCloseEvent *event)
+documentation_dock_widget::closeEvent (QCloseEvent *e)
 {
   emit active_changed (false);
-  QDockWidget::closeEvent (event);
+  QDockWidget::closeEvent (e);
 }
--- a/libgui/src/documentation-dockwidget.h	Thu Sep 13 12:32:17 2012 -0400
+++ b/libgui/src/documentation-dockwidget.h	Thu Sep 13 12:32:51 2012 -0400
@@ -30,7 +30,7 @@
 class documentation_dock_widget : public QDockWidget
 {
   Q_OBJECT
-public:
+  public:
   documentation_dock_widget (QWidget *parent = 0);
 
 public slots:
--- a/libgui/src/files-dockwidget.cc	Thu Sep 13 12:32:17 2012 -0400
+++ b/libgui/src/files-dockwidget.cc	Thu Sep 13 12:32:51 2012 -0400
@@ -34,8 +34,8 @@
 #include <QProcess>
 #include <QDebug>
 
-files_dock_widget::files_dock_widget (QWidget *parent)
-  : QDockWidget (parent)
+files_dock_widget::files_dock_widget (QWidget *p)
+  : QDockWidget (p)
 {
   setObjectName ("FilesDockWidget");
   setWindowTitle (tr ("Current Directory"));
@@ -82,19 +82,18 @@
   _file_tree_view->setStatusTip (tr ("Doubleclick a file to open it."));
 
   _current_directory->setText(_file_system_model->fileInfo (rootPathIndex).
-                       absoluteFilePath ());
+                              absoluteFilePath ());
 
   connect (_file_tree_view, SIGNAL (doubleClicked (const QModelIndex &)), this,
            SLOT (item_double_clicked (const QModelIndex &)));
 
   // Layout the widgets vertically with the toolbar on top
-  QVBoxLayout *
-    layout = new QVBoxLayout ();
-  layout->setSpacing (0);
-  layout->addWidget (_navigation_tool_bar);
-  layout->addWidget (_file_tree_view);
-  layout->setMargin (1);
-  widget ()->setLayout (layout);
+  QVBoxLayout *vbox_layout = new QVBoxLayout ();
+  vbox_layout->setSpacing (0);
+  vbox_layout->addWidget (_navigation_tool_bar);
+  vbox_layout->addWidget (_file_tree_view);
+  vbox_layout->setMargin (1);
+  widget ()->setLayout (vbox_layout);
   // TODO: Add right-click contextual menus for copying, pasting, deleting files (and others)
 
   connect (_current_directory, SIGNAL (returnPressed ()),
@@ -147,7 +146,7 @@
       if (fileInfo.isDir ())
         {
           _file_tree_view->setRootIndex (_file_system_model->
-                                        index (fileInfo.absoluteFilePath ()));
+                                         index (fileInfo.absoluteFilePath ()));
           _file_system_model->setRootPath (fileInfo.absoluteFilePath ());
           _current_directory->setText (fileInfo.absoluteFilePath ());
 
@@ -190,8 +189,8 @@
 }
 
 void
-files_dock_widget::closeEvent (QCloseEvent *event)
+files_dock_widget::closeEvent (QCloseEvent *e)
 {
   emit active_changed (false);
-  QDockWidget::closeEvent (event);
+  QDockWidget::closeEvent (e);
 }
--- a/libgui/src/files-dockwidget.h	Thu Sep 13 12:32:17 2012 -0400
+++ b/libgui/src/files-dockwidget.h	Thu Sep 13 12:32:51 2012 -0400
@@ -39,13 +39,13 @@
 #include <QLineEdit>
 
 /**
-  \class files_dock_widget
-  \brief Dock widget to display files in the current directory.
-  */
+   \class files_dock_widget
+   \brief Dock widget to display files in the current directory.
+*/
 class files_dock_widget : public QDockWidget
 {
   Q_OBJECT
-public:
+  public:
   /** Constructs a new files_dock_widget. */
   files_dock_widget (QWidget *parent = 0);
 
--- a/libgui/src/history-dockwidget.cc	Thu Sep 13 12:32:17 2012 -0400
+++ b/libgui/src/history-dockwidget.cc	Thu Sep 13 12:32:51 2012 -0400
@@ -32,8 +32,8 @@
 
 #include "history-dockwidget.h"
 
-history_dock_widget::history_dock_widget (QWidget * parent)
-  : QDockWidget (parent), octave_event_observer ()
+history_dock_widget::history_dock_widget (QWidget * p)
+  : QDockWidget (p), octave_event_observer ()
 {
   setObjectName ("HistoryDockWidget");
   construct ();
@@ -106,16 +106,16 @@
   _history_list_view->setStatusTip (tr ("Doubleclick a command to transfer it to the terminal."));
   _filter_line_edit = new QLineEdit (this);
   _filter_line_edit->setStatusTip (tr ("Enter text to filter the command history."));
-  QVBoxLayout *layout = new QVBoxLayout ();
+  QVBoxLayout *vbox_layout = new QVBoxLayout ();
 
   setWindowTitle (tr ("Command History"));
   setWidget (new QWidget ());
 
-  layout->addWidget (_history_list_view);
-  layout->addWidget (_filter_line_edit);
-  layout->setMargin (2);
+  vbox_layout->addWidget (_history_list_view);
+  vbox_layout->addWidget (_filter_line_edit);
+  vbox_layout->setMargin (2);
 
-  widget ()->setLayout (layout);
+  widget ()->setLayout (vbox_layout);
 
   connect (_filter_line_edit,
            SIGNAL (textEdited (QString)),
@@ -161,8 +161,7 @@
 void
 history_dock_widget::request_history_model_update ()
 {
-  octave_link::instance ()
-      ->post_event (new octave_update_history_event (*this));
+  octave_link::post_event (new octave_update_history_event (*this));
 }
 
 void
@@ -172,8 +171,8 @@
 }
 
 void
-history_dock_widget::closeEvent (QCloseEvent *event)
+history_dock_widget::closeEvent (QCloseEvent *e)
 {
   emit active_changed (false);
-  QDockWidget::closeEvent (event);
+  QDockWidget::closeEvent (e);
 }
--- a/libgui/src/history-dockwidget.h	Thu Sep 13 12:32:17 2012 -0400
+++ b/libgui/src/history-dockwidget.h	Thu Sep 13 12:32:51 2012 -0400
@@ -35,8 +35,8 @@
 
 class history_dock_widget : public QDockWidget, public octave_event_observer
 {
-Q_OBJECT
-public:
+  Q_OBJECT
+  public:
   history_dock_widget (QWidget *parent = 0);
 
   void event_accepted (octave_event *e);
--- a/libgui/src/link-deps.mk	Thu Sep 13 12:32:17 2012 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-include $(top_srcdir)/libinterp/link-deps.mk
-
-if AMCOND_ENABLE_DYNAMIC_LINKING
-  LIBOCTGUI_LINK_DEPS =
-else
-  LIBOCTGUI_LINK_DEPS = $(DLDFCN_LIBS)
-endif
-
-LIBOCTGUI_LINK_DEPS += \
-  $(QT_LIBS)
-
-LIBOCTGUI_LINK_OPTS = \
-  $(QT_LDFLAGS)
-
-if AMCOND_LINK_ALL_DEPS
-  LIBOCTGUI_LINK_DEPS += $(LIBOCTINTERP_LINK_DEPS)
-  LIBOCTGUI_LINK_OPTS += $(LIBOCTINTERP_LINK_OPTS)
-
-  OCTAVE_GUI_LINK_DEPS = $(LIBOCTGUI_LINK_DEPS)
-  OCTAVE_GUI_LINK_OPTS = $(LIBOCTGUI_LINK_OPTS)
-endif
--- a/libgui/src/m-editor/file-editor-interface.h	Thu Sep 13 12:32:17 2012 -0400
+++ b/libgui/src/m-editor/file-editor-interface.h	Thu Sep 13 12:32:51 2012 -0400
@@ -35,49 +35,49 @@
   Q_OBJECT
 
   public:
-    file_editor_interface (QTerminal *terminal, main_window *mainWindow)
-      : QDockWidget ((QWidget*)mainWindow) // QDockWidget constructor is explicit, hence the cast.
-    {
-      setObjectName ("FileEditor");
-      _terminal = terminal;
-      _main_window = mainWindow;
+  file_editor_interface (QTerminal *terminal, main_window *mainWindow)
+    : QDockWidget ((QWidget*)mainWindow) // QDockWidget constructor is explicit, hence the cast.
+  {
+    setObjectName ("FileEditor");
+    _terminal = terminal;
+    _main_window = mainWindow;
 
-      connect (this, SIGNAL (visibilityChanged (bool)), this,
-               SLOT (handle_visibility_changed (bool)));
-    }
+    connect (this, SIGNAL (visibilityChanged (bool)), this,
+             SLOT (handle_visibility_changed (bool)));
+  }
 
-    virtual ~file_editor_interface () { }
+  virtual ~file_editor_interface () { }
 
-    virtual QMenu *debug_menu () = 0;
-    virtual QToolBar *toolbar () = 0;
+  virtual QMenu *debug_menu () = 0;
+  virtual QToolBar *toolbar () = 0;
 
-    virtual void handle_entered_debug_mode () = 0;
-    virtual void handle_quit_debug_mode () = 0;
+  virtual void handle_entered_debug_mode () = 0;
+  virtual void handle_quit_debug_mode () = 0;
 
-  public slots:
-    virtual void request_new_file () = 0;
-    virtual void request_open_file () = 0;
-    virtual void request_open_file (const QString& fileName, bool silent = false) = 0;
+public slots:
+  virtual void request_new_file () = 0;
+  virtual void request_open_file () = 0;
+  virtual void request_open_file (const QString& fileName, bool silent = false) = 0;
 
-  signals:
-      void active_changed (bool active);
+signals:
+  void active_changed (bool active);
 
-  protected:
-    QTerminal* _terminal;
-    main_window* _main_window;
+protected:
+  QTerminal* _terminal;
+  main_window* _main_window;
 
-    void closeEvent (QCloseEvent *event)
-    {
-      emit active_changed (false);
-      QDockWidget::closeEvent (event);
-    }
+  void closeEvent (QCloseEvent *e)
+  {
+    emit active_changed (false);
+    QDockWidget::closeEvent (e);
+  }
 
-  protected slots:
-    void handle_visibility_changed (bool visible)
-    {
-      if (visible)
-        emit active_changed (true);
-    }
+protected slots:
+  void handle_visibility_changed (bool visible)
+  {
+    if (visible)
+      emit active_changed (true);
+  }
 };
 
 #endif // FILEEDITORINTERFACE_H
--- a/libgui/src/m-editor/file-editor-tab.cc	Thu Sep 13 12:32:17 2012 -0400
+++ b/libgui/src/m-editor/file-editor-tab.cc	Thu Sep 13 12:32:51 2012 -0400
@@ -49,10 +49,6 @@
 file_editor_tab::file_editor_tab(file_editor *fileEditor)
   : QWidget ((QWidget*)fileEditor), octave_event_observer ()
 {
-  QSettings *settings = resource_manager::get_settings ();
-
-  // FIXME -- what should happen if settings is 0?
-
   _file_editor = fileEditor;
   _file_name = "";
   _edit_area = new QsciScintilla (this);
@@ -74,43 +70,31 @@
   // line numbers
   _edit_area->setMarginsForegroundColor(QColor(96,96,96));
   _edit_area->setMarginsBackgroundColor(QColor(232,232,220));
-  if (settings->value ("editor/showLineNumbers",true).toBool ())
-    {
-      QFont marginFont( settings->value ("editor/fontName","Courier").toString () ,
-                        settings->value ("editor/fontSize",10).toInt () );
-      _edit_area->setMarginsFont( marginFont );
-      QFontMetrics metrics(marginFont);
-      _edit_area->setMarginType (2, QsciScintilla::TextMargin);
-      _edit_area->setMarginWidth(2, metrics.width("9999"));
-      _edit_area->setMarginLineNumbers (2, true);
-    }
+  _edit_area->setMarginType (2, QsciScintilla::TextMargin);
 
   // code folding
   _edit_area->setMarginType (3, QsciScintilla::SymbolMargin);
   _edit_area->setFolding (QsciScintilla::BoxedTreeFoldStyle , 3);
 
+  //highlight current line color
+  _edit_area->setCaretLineBackgroundColor(QColor(245,245,245));
+
   // other features
-  if (settings->value ("editor/highlightCurrentLine",true).toBool ())
-    {
-      _edit_area->setCaretLineVisible(true);
-      _edit_area->setCaretLineBackgroundColor(QColor(245,245,245));
-    }
   _edit_area->setBraceMatching (QsciScintilla::StrictBraceMatch);
   _edit_area->setAutoIndent (true);
   _edit_area->setIndentationWidth (2);
   _edit_area->setIndentationsUseTabs (false);
-  if (settings->value ("editor/codeCompletion",true).toBool ())
-    {
-      _edit_area->autoCompleteFromAll ();
-      _edit_area->setAutoCompletionSource(QsciScintilla::AcsAll);
-      _edit_area->setAutoCompletionThreshold (1);
-    }
+
   _edit_area->setUtf8 (true);
 
-  QVBoxLayout *layout = new QVBoxLayout ();
-  layout->addWidget (_edit_area);
-  layout->setMargin (0);
-  setLayout (layout);
+  // auto completion
+  _edit_area->autoCompleteFromAll ();
+  _edit_area->setAutoCompletionSource(QsciScintilla::AcsAll);
+
+  QVBoxLayout *edit_area_layout = new QVBoxLayout ();
+  edit_area_layout->addWidget (_edit_area);
+  edit_area_layout->setMargin (0);
+  setLayout (edit_area_layout);
 
   // connect modified signal
   connect (_edit_area, SIGNAL (modificationChanged (bool)),
@@ -121,8 +105,8 @@
            this, SLOT (file_has_changed (QString)));
 
   _file_name = "";
-  _long_title = settings->value ("editor/longWindowTitle",false).toBool ();
-  update_window_title (false);
+
+  notice_settings ();
 }
 
 bool
@@ -174,13 +158,13 @@
 }
 
 void
-file_editor_tab::closeEvent (QCloseEvent *event)
+file_editor_tab::closeEvent (QCloseEvent *e)
 {
   if (_file_editor->get_main_window ()->is_closing ())
     {
       // close whole application: save file or not if modified
       check_file_modified ("Closing Octave", 0); // no cancel possible
-      event->accept ();
+      e->accept ();
     }
   else
     {
@@ -189,11 +173,11 @@
       if (check_file_modified ("Close File",
                                QMessageBox::Cancel) == QMessageBox::Cancel)
         {
-          event->ignore ();
+          e->ignore ();
         }
       else
         {
-          event->accept();
+          e->accept();
         }
     }
 }
@@ -213,18 +197,18 @@
   Q_UNUSED (state);
   if (margin == 1)
     {
-      unsigned int mask = _edit_area->markersAtLine (line);
+      unsigned int markers_mask = _edit_area->markersAtLine (line);
 
       if (state & Qt::ControlModifier)
         {
-          if (mask && (1 << bookmark))
+          if (markers_mask && (1 << bookmark))
             _edit_area->markerDelete(line,bookmark);
           else
             _edit_area->markerAdd(line,bookmark);
         }
       else
         {
-          if (mask && (1 << breakpoint))
+          if (markers_mask && (1 << breakpoint))
             {
               request_remove_breakpoint (line);
             }
@@ -257,7 +241,7 @@
       QString keyword;
       QStringList keywordList;
 
-       // get whole string with all keywords
+      // get whole string with all keywords
       keyword = lexer->keywords (1);
       // split into single strings
       keywordList = keyword.split (QRegExp ("\\s+"));
@@ -265,21 +249,21 @@
       int i;
       for (i = 0; i < keywordList.size (); i++)
         {
-           // add single strings to the API
+          // add single strings to the API
           lexer_api->add (keywordList.at (i));
         }
       // prepare API info ... this make take some time
       lexer_api->prepare ();
     }
   else if (_file_name.endsWith (".c")
-        || _file_name.endsWith (".cc")
-        || _file_name.endsWith (".cpp")
-        || _file_name.endsWith (".cxx")
-        || _file_name.endsWith (".c++")
-        || _file_name.endsWith (".h")
-        || _file_name.endsWith (".hh")
-        || _file_name.endsWith (".hpp")
-        || _file_name.endsWith (".h++"))
+           || _file_name.endsWith (".cc")
+           || _file_name.endsWith (".cpp")
+           || _file_name.endsWith (".cxx")
+           || _file_name.endsWith (".c++")
+           || _file_name.endsWith (".h")
+           || _file_name.endsWith (".hh")
+           || _file_name.endsWith (".hpp")
+           || _file_name.endsWith (".h++"))
     {
       lexer = new QsciLexerCPP ();
     }
@@ -302,14 +286,13 @@
 
   QSettings *settings = resource_manager::get_settings ();
 
-  // FIXME -- what should happen if settings is 0?
-
   // Editor font (default or from settings)
-  lexer->setDefaultFont (QFont (
-                                settings->value ("editor/fontName",
-                                                 "Courier").toString (),
-                                settings->value ("editor/fontSize",
-                                                 10).toInt ()));
+  if (settings)
+    lexer->setDefaultFont (QFont (
+                                  settings->value ("editor/fontName",
+                                                   "Courier").toString (),
+                                  settings->value ("editor/fontSize",
+                                                   10).toInt ()));
 
   // TODO: Autoindent not working as it should
   lexer->setAutoIndentStyle (QsciScintilla::AiMaintain ||
@@ -329,11 +312,9 @@
   // We have to cut off the suffix, because octave appends it.
   function_name.chop (file_info.suffix ().length () + 1);
 
-  octave_link::instance ()->post_event
-      (new octave_add_breakpoint_event (*this,
-                                        path.toStdString (),
-                                        function_name.toStdString (),
-                                        line));
+  octave_link::post_event (new octave_add_breakpoint_event
+                           (*this, path.toStdString (),
+                            function_name.toStdString (), line));
 }
 
 void
@@ -346,11 +327,9 @@
   // We have to cut off the suffix, because octave appends it.
   function_name.chop (file_info.suffix ().length () + 1);
 
-  octave_link::instance ()->post_event
-      (new octave_remove_breakpoint_event (*this,
-                                           path.toStdString (),
-                                           function_name.toStdString (),
-                                           line));
+  octave_link::post_event (new octave_remove_breakpoint_event
+                           (*this, path.toStdString (),
+                            function_name.toStdString (), line));
 }
 
 void
@@ -518,10 +497,9 @@
   // We have to cut off the suffix, because octave appends it.
   function_name.chop (file_info.suffix ().length () + 1);
 
-  octave_link::instance ()->post_event
-      (new octave_remove_all_breakpoints_event (*this,
-                                                path.toStdString (),
-                                                function_name.toStdString ()));
+  octave_link::post_event (new octave_remove_all_breakpoints_event
+                           (*this, path.toStdString (),
+                            function_name.toStdString ()));
 }
 
 void
@@ -712,7 +690,7 @@
   _file_name = saveFileName;
   // set the window title to actual file name (not modified)
   update_window_title (false);
-   // files is save -> not modified
+  // files is save -> not modified
   _edit_area->setModified (false);
   file.close();
 
@@ -729,7 +707,7 @@
   if (saveFileName == UNNAMED_FILE || saveFileName.isEmpty ())
     {
       QString directory = QString::fromStdString
-          (octave_link::instance ()->get_last_working_directory ());
+        (octave_link::last_working_directory ());
 
       if (directory.isEmpty ())
         {
@@ -767,17 +745,17 @@
 
   QFileInfo file_info (_file_name);
   QString path = file_info.absolutePath ();
-  //QString current_path = QString::fromStdString
-      (octave_link::instance ()->get_last_working_directory ());
+  QString current_path
+    = QString::fromStdString (octave_link::last_working_directory ());
   QString function_name = file_info.fileName ();
 
   // We have to cut off the suffix, because octave appends it.
   function_name.chop (file_info.suffix ().length () + 1);
   _file_editor->terminal ()->sendText (QString ("cd \'%1\'\n%2\n")
-    .arg(path).arg (function_name));
+                                       .arg(path).arg (function_name));
   // TODO: Sending a run event crashes for long scripts. Find out why.
-  //  octave_link::instance ()
-  //      ->post_event (new octave_run_file_event (*this, _file_name.toStdString ()));
+  //  octave_link::post_event (new octave_run_file_event
+  //                           (*this, _file_name.toStdString ()));
 }
 
 void
@@ -794,10 +772,10 @@
           alreadyAsking = true;
 
           int decision =
-          QMessageBox::warning (this, tr ("Octave Editor"),
-                                tr ("It seems that \'%1\' has been modified by another application. Do you want to reload it?").
-                                arg (_file_name), QMessageBox::Yes,
-                                QMessageBox::No);
+            QMessageBox::warning (this, tr ("Octave Editor"),
+                                  tr ("It seems that \'%1\' has been modified by another application. Do you want to reload it?").
+                                  arg (_file_name), QMessageBox::Yes,
+                                  QMessageBox::No);
 
           if (decision == QMessageBox::Yes)
             {
@@ -810,10 +788,10 @@
   else
     {
       int decision =
-      QMessageBox::warning (this, tr ("Octave Editor"),
-                            tr ("It seems that \'%1\' has been deleted or renamed. Do you want to save it now?").
-                            arg (_file_name), QMessageBox::Save,
-                            QMessageBox::Close);
+        QMessageBox::warning (this, tr ("Octave Editor"),
+                              tr ("It seems that \'%1\' has been deleted or renamed. Do you want to save it now?").
+                              arg (_file_name), QMessageBox::Save,
+                              QMessageBox::Close);
       if (decision == QMessageBox::Save)
         {
           if (!save_file_as ())
@@ -830,3 +808,40 @@
         }
     }
 }
+
+void
+file_editor_tab::notice_settings ()
+{
+  QSettings *settings = resource_manager::get_settings ();
+
+  if (settings==NULL)
+    return; // this shouldn't happen!
+
+  _edit_area->setCaretLineVisible(settings->value ("editor/highlightCurrentLine",true).toBool ());
+
+  if (settings->value ("editor/codeCompletion",true).toBool ())
+    _edit_area->setAutoCompletionThreshold (1);
+  else
+    _edit_area->setAutoCompletionThreshold (-1);
+
+  QFont font( settings->value ("editor/fontName","Courier").toString () ,
+              settings->value ("editor/fontSize",10).toInt () );
+  if (settings->value ("editor/showLineNumbers",true).toBool ())
+    {
+      _edit_area->setMarginLineNumbers (2, true);
+      _edit_area->setMarginsFont( font );
+      QFontMetrics metrics( font );
+      _edit_area->setMarginWidth(2, metrics.width("9999"));
+    }
+  else
+    {
+      _edit_area->setMarginLineNumbers (2, false);
+      _edit_area->setMarginWidth(2, 0);
+    }
+
+  update_lexer ();
+
+  _long_title = settings->value ("editor/longWindowTitle",false).toBool ();
+
+  update_window_title (false);
+}
--- a/libgui/src/m-editor/file-editor-tab.h	Thu Sep 13 12:32:17 2012 -0400
+++ b/libgui/src/m-editor/file-editor-tab.h	Thu Sep 13 12:32:51 2012 -0400
@@ -33,7 +33,7 @@
 class file_editor_tab : public QWidget, public octave_event_observer
 {
   Q_OBJECT
-public:
+  public:
   file_editor_tab (file_editor *fileEditor);
   bool copy_available ();
 
@@ -73,7 +73,10 @@
   void run_file ();
 
   void file_has_changed (const QString& fileName);
-  QString get_file_name () const {return _file_name;} 
+  QString get_file_name () const {return _file_name;}
+
+  /** Tells the editor tab to react on changed settings. */
+  void notice_settings ();
 
 signals:
   void file_name_changed (const QString& fileName);
--- a/libgui/src/m-editor/file-editor.cc	Thu Sep 13 12:32:17 2012 -0400
+++ b/libgui/src/m-editor/file-editor.cc	Thu Sep 13 12:32:51 2012 -0400
@@ -35,12 +35,12 @@
 #include <QStyle>
 #include <QTextStream>
 
-file_editor::file_editor (QTerminal *terminal, main_window *m)
-  : file_editor_interface(terminal, m)
+file_editor::file_editor (QTerminal *t, main_window *m)
+  : file_editor_interface (t, m)
 {
   construct ();
 
-  _terminal = terminal;
+  _terminal = t;
   _main_window = m;
   setVisible (false);
 }
@@ -50,15 +50,15 @@
   QSettings *settings = resource_manager::get_settings ();
   QStringList sessionFileNames;
   if (settings->value ("editor/restoreSession",true).toBool ())
-  {
-    for (int n=0;n<_tab_widget->count();++n)
-      {
-        file_editor_tab* tab = dynamic_cast<file_editor_tab*> (_tab_widget->widget (n));
-        if (!tab)
-          continue;
-        sessionFileNames.append (tab->get_file_name ());
-      }
-  }
+    {
+      for (int n=0;n<_tab_widget->count();++n)
+        {
+          file_editor_tab* tab = dynamic_cast<file_editor_tab*> (_tab_widget->widget (n));
+          if (!tab)
+            continue;
+          sessionFileNames.append (tab->get_file_name ());
+        }
+    }
   settings->setValue ("editor/savedSessionTabs", sessionFileNames);
   settings->sync ();
 }
@@ -373,34 +373,46 @@
 }
 
 void
+file_editor::notice_settings ()
+{
+  for(int i = 0; i < _tab_widget->count (); i++)
+    {
+      file_editor_tab *fileEditorTab
+        = dynamic_cast <file_editor_tab*> (_tab_widget->widget (i));
+      if (fileEditorTab)
+        fileEditorTab->notice_settings ();
+    }
+}
+
+void
 file_editor::construct ()
 {
-  QWidget *widget = new QWidget (this);
-  QStyle *style = QApplication::style ();
+  QWidget *editor_widget = new QWidget (this);
+  QStyle *editor_style = QApplication::style ();
 
-  _menu_bar = new QMenuBar (widget);
-  _tool_bar = new QToolBar (widget);
-  _tab_widget = new QTabWidget (widget);
+  _menu_bar = new QMenuBar (editor_widget);
+  _tool_bar = new QToolBar (editor_widget);
+  _tab_widget = new QTabWidget (editor_widget);
   _tab_widget->setTabsClosable (true);
 
   QAction *new_action = new QAction (QIcon(":/actions/icons/filenew.png"),
-        tr("&New File"), _tool_bar);
+                                     tr("&New File"), _tool_bar);
 
   QAction *open_action = new QAction (QIcon(":/actions/icons/fileopen.png"),
-        tr("&Open File"), _tool_bar);
+                                      tr("&Open File"), _tool_bar);
 
   QAction *save_action = new QAction (QIcon(":/actions/icons/filesave.png"),
-        tr("&Save File"), _tool_bar);
+                                      tr("&Save File"), _tool_bar);
 
   QAction *save_as_action
     = new QAction (QIcon(":/actions/icons/filesaveas.png"),
                    tr("Save File &As"), _tool_bar);
 
   QAction *undo_action = new QAction (QIcon(":/actions/icons/undo.png"),
-        tr("&Undo"), _tool_bar);
+                                      tr("&Undo"), _tool_bar);
 
   QAction *redo_action = new QAction (QIcon(":/actions/icons/redo.png"),
-        tr("&Redo"), _tool_bar);
+                                      tr("&Redo"), _tool_bar);
 
   _copy_action = new QAction (QIcon(":/actions/icons/editcopy.png"),
                               tr ("&Copy"), _tool_bar);
@@ -409,25 +421,25 @@
                               tr ("Cu&t"), _tool_bar);
 
   QAction *paste_action
-      = new QAction (QIcon (":/actions/icons/editpaste.png"),
-                     tr("Paste"), _tool_bar);
+    = new QAction (QIcon (":/actions/icons/editpaste.png"),
+                   tr("Paste"), _tool_bar);
   QAction *next_bookmark_action       = new QAction (tr ("&Next Bookmark"),_tool_bar);
   QAction *previous_bookmark_action   = new QAction (tr ("Pre&vious Bookmark"),_tool_bar);
   QAction *toggle_bookmark_action     = new QAction (tr ("Toggle &Bookmark"),_tool_bar);
   QAction *remove_bookmark_action     = new QAction (tr ("&Remove All Bookmarks"),_tool_bar);
 
   QAction *next_breakpoint_action
-      = new QAction (QIcon (":/actions/icons/bp_next.png"),
-                     tr ("&Next breakpoint"), _tool_bar);
+    = new QAction (QIcon (":/actions/icons/bp_next.png"),
+                   tr ("&Next breakpoint"), _tool_bar);
   QAction *previous_breakpoint_action
-      = new QAction (QIcon (":/actions/icons/bp_prev.png"),
-                     tr ("Pre&vious breakpoint"), _tool_bar);
+    = new QAction (QIcon (":/actions/icons/bp_prev.png"),
+                   tr ("Pre&vious breakpoint"), _tool_bar);
   QAction *toggle_breakpoint_action
-      = new QAction (QIcon (":/actions/icons/bp_toggle.png"),
-                     tr ("Toggle &breakpoint"), _tool_bar);
+    = new QAction (QIcon (":/actions/icons/bp_toggle.png"),
+                   tr ("Toggle &breakpoint"), _tool_bar);
   QAction *remove_all_breakpoints_action
-      = new QAction (QIcon (":/actions/icons/bp_rm_all.png"),
-                     tr ("&Remove All breakpoints"), _tool_bar);
+    = new QAction (QIcon (":/actions/icons/bp_rm_all.png"),
+                   tr ("&Remove All breakpoints"), _tool_bar);
 
   QAction *comment_selection_action   = new QAction (tr ("&Comment Selected Text"),_tool_bar);
   QAction *uncomment_selection_action = new QAction (tr ("&Uncomment Selected Text"),_tool_bar);
@@ -436,7 +448,7 @@
                                       tr ("&Find and Replace"), _tool_bar);
 
   _run_action = new QAction (QIcon(":/actions/icons/artsbuilderexecute.png"),
-        tr("Save File And Run"), _tool_bar);
+                             tr("Save File And Run"), _tool_bar);
 
   // some actions are disabled from the beginning
   _copy_action->setEnabled(false);
@@ -517,17 +529,17 @@
   _run_menu->addAction (_run_action);
   _menu_bar->addMenu (_run_menu);
 
-  QVBoxLayout *layout = new QVBoxLayout ();
-  layout->addWidget (_menu_bar);
-  layout->addWidget (_tool_bar);
-  layout->addWidget (_tab_widget);
-  layout->setMargin (0);
-  widget->setLayout (layout);
-  setWidget (widget);
+  QVBoxLayout *vbox_layout = new QVBoxLayout ();
+  vbox_layout->addWidget (_menu_bar);
+  vbox_layout->addWidget (_tool_bar);
+  vbox_layout->addWidget (_tab_widget);
+  vbox_layout->setMargin (0);
+  editor_widget->setLayout (vbox_layout);
+  setWidget (editor_widget);
 
   connect (new_action,
            SIGNAL (triggered ()), this, SLOT (request_new_file ()));
-  connect (open_action,              
+  connect (open_action,
            SIGNAL (triggered ()), this, SLOT (request_open_file ()));
   connect (undo_action,
            SIGNAL (triggered ()), this, SLOT (request_undo ()));
@@ -574,18 +586,18 @@
 
   resize (500, 400);
   setWindowIcon (QIcon::fromTheme ("accessories-text-editor",
-                                   style->standardIcon (QStyle::SP_FileIcon)));
+                                   editor_style->standardIcon (QStyle::SP_FileIcon)));
   setWindowTitle ("Octave Editor");
 
   //restore previous session
   QSettings *settings = resource_manager::get_settings ();
   if (settings->value ("editor/restoreSession",true).toBool ())
-  {
-    QStringList sessionFileNames = settings->value("editor/savedSessionTabs", QStringList()).toStringList ();
+    {
+      QStringList sessionFileNames = settings->value("editor/savedSessionTabs", QStringList()).toStringList ();
 
-    for (int n=0;n<sessionFileNames.count();++n)
-      request_open_file(sessionFileNames.at(n), true);
-  }
+      for (int n=0;n<sessionFileNames.count();++n)
+        request_open_file(sessionFileNames.at(n), true);
+    }
 }
 
 void
--- a/libgui/src/m-editor/file-editor.h	Thu Sep 13 12:32:17 2012 -0400
+++ b/libgui/src/m-editor/file-editor.h	Thu Sep 13 12:32:51 2012 -0400
@@ -45,9 +45,9 @@
 
 class file_editor : public file_editor_interface
 {
-Q_OBJECT
+  Q_OBJECT
 
-public:
+  public:
   file_editor (QTerminal *terminal, main_window *m);
   ~file_editor ();
   void loadFile (const QString& fileName);
@@ -94,6 +94,9 @@
   void active_tab_changed (int index);
   void handle_editor_state_changed ();
 
+  /** Tells the editor to react on changed settings. */
+  void notice_settings ();
+
 private:
   void construct ();
   void add_file_editor_tab(file_editor_tab *f);
--- a/libgui/src/m-editor/find-dialog.cc	Thu Sep 13 12:32:17 2012 -0400
+++ b/libgui/src/m-editor/find-dialog.cc	Thu Sep 13 12:32:51 2012 -0400
@@ -47,8 +47,8 @@
 #include <QIcon>
 #include "find-dialog.h"
 
-find_dialog::find_dialog (QsciScintilla* edit_area, QWidget *parent)
-  : QDialog (parent)
+find_dialog::find_dialog (QsciScintilla* edit_area, QWidget *p)
+  : QDialog (p)
 {
   setWindowTitle ("Find and Replace");
   setWindowIcon (QIcon(":/actions/icons/logo.png"));
@@ -143,17 +143,17 @@
   if (_edit_area)
     {
       _find_result_available = _edit_area->findFirst (_search_line_edit->text (),
-                                      _regex_check_box->isChecked (),
-                                      _case_check_box->isChecked (),
-                                      _whole_words_check_box->isChecked (),
-                                      _wrap_check_box->isChecked (),
-                                      !_backward_check_box->isChecked (),
-                                      line,col,
-                                      true
+                                                      _regex_check_box->isChecked (),
+                                                      _case_check_box->isChecked (),
+                                                      _whole_words_check_box->isChecked (),
+                                                      _wrap_check_box->isChecked (),
+                                                      !_backward_check_box->isChecked (),
+                                                      line,col,
+                                                      true
 #ifdef HAVE_FINDFIRST_MODERN
-                                      , true
+                                                      , true
 #endif
-                                      );
+                                                      );
     }
 }
 
--- a/libgui/src/m-editor/find-dialog.h	Thu Sep 13 12:32:17 2012 -0400
+++ b/libgui/src/m-editor/find-dialog.h	Thu Sep 13 12:32:51 2012 -0400
@@ -55,7 +55,7 @@
 class find_dialog : public QDialog
 {
   Q_OBJECT
-public:
+  public:
   find_dialog (QsciScintilla* edit_area, QWidget *parent = 0);
 
 private slots:
--- a/libgui/src/m-editor/lexer-octave-gui.cc	Thu Sep 13 12:32:17 2012 -0400
+++ b/libgui/src/m-editor/lexer-octave-gui.cc	Thu Sep 13 12:32:51 2012 -0400
@@ -31,8 +31,8 @@
 // -----------------------------------------------------
 // Some basic functions
 // -----------------------------------------------------
-lexer_octave_gui::lexer_octave_gui(QObject *parent)
-    : QsciLexer(parent)  // inherit from base lexer
+lexer_octave_gui::lexer_octave_gui (QObject *p)
+  : QsciLexer (p)
 {
 }
 
@@ -55,26 +55,26 @@
 // -----------------------------------------------------
 QColor lexer_octave_gui::defaultColor(int style) const
 {
-    switch (style)
-      {
-        case Default:  // black
-          return QColor(0x00,0x00,0x00);
-        case Operator: // red
-          return QColor(0xef,0x00,0x00);
-        case Comment:  // gray
-          return QColor(0x7f,0x7f,0x7f);
-        case Command:  // blue-green
-          return QColor(0x00,0x7f,0x7f);
-        case Number:   // orange
-          return QColor(0x7f,0x7f,0x00);
-        case Keyword:  // blue
-          return QColor(0x00,0x00,0xbf);
-        case SingleQuotedString: // green
-          return QColor(0x00,0x7f,0x00);
-        case DoubleQuotedString: // green-yellow
-          return QColor(0x4f,0x7f,0x00);
-      }
-    return QsciLexer::defaultColor(style);
+  switch (style)
+    {
+    case Default:  // black
+      return QColor(0x00,0x00,0x00);
+    case Operator: // red
+      return QColor(0xef,0x00,0x00);
+    case Comment:  // gray
+      return QColor(0x7f,0x7f,0x7f);
+    case Command:  // blue-green
+      return QColor(0x00,0x7f,0x7f);
+    case Number:   // orange
+      return QColor(0x7f,0x7f,0x00);
+    case Keyword:  // blue
+      return QColor(0x00,0x00,0xbf);
+    case SingleQuotedString: // green
+      return QColor(0x00,0x7f,0x00);
+    case DoubleQuotedString: // green-yellow
+      return QColor(0x4f,0x7f,0x00);
+    }
+  return QsciLexer::defaultColor(style);
 }
 
 
@@ -83,25 +83,25 @@
 // -----------------------------------------------------
 QFont lexer_octave_gui::defaultFont(int style) const
 {
-    QFont f;
+  QFont f;
 
-    switch (style)
-      {
-        case Comment: // default but italic
-          f = QsciLexer::defaultFont(style);
-          f.setItalic(true);
-          break;
-        case Keyword: // default
-          f = QsciLexer::defaultFont(style);
-          break;
-        case Operator:  // default
-          f = QsciLexer::defaultFont(style);
-          break;
-        default:        // default
-          f = QsciLexer::defaultFont(style);
-          break;
-      }
-    return f;   // return the selected font
+  switch (style)
+    {
+    case Comment: // default but italic
+      f = QsciLexer::defaultFont(style);
+      f.setItalic(true);
+      break;
+    case Keyword: // default
+      f = QsciLexer::defaultFont(style);
+      break;
+    case Operator:  // default
+      f = QsciLexer::defaultFont(style);
+      break;
+    default:        // default
+      f = QsciLexer::defaultFont(style);
+      break;
+    }
+  return f;   // return the selected font
 }
 
 
@@ -110,28 +110,28 @@
 // -----------------------------------------------------
 QString lexer_octave_gui::description(int style) const
 {
-    switch (style)
-      {
-        case Default:
-          return tr("Default");
-        case Comment:
-          return tr("Comment");
-        case Command:
-          return tr("Command");
-        case Number:
-          return tr("Number");
-        case Keyword:
-          return tr("Keyword");
-        case SingleQuotedString:
-          return tr("Single-quoted string");
-        case Operator:
-          return tr("Operator");
-        case Identifier:
-          return tr("Identifier");
-        case DoubleQuotedString:
-          return tr("Double-quoted string");
-      }
-    return QString();
+  switch (style)
+    {
+    case Default:
+      return tr("Default");
+    case Comment:
+      return tr("Comment");
+    case Command:
+      return tr("Command");
+    case Number:
+      return tr("Number");
+    case Keyword:
+      return tr("Keyword");
+    case SingleQuotedString:
+      return tr("Single-quoted string");
+    case Operator:
+      return tr("Operator");
+    case Identifier:
+      return tr("Identifier");
+    case DoubleQuotedString:
+      return tr("Double-quoted string");
+    }
+  return QString();
 }
 
 
@@ -141,10 +141,10 @@
 // -----------------------------------------------------
 const char *lexer_octave_gui::keywords(int set) const
 {
-    if (set == 1)
-      {
-        return resource_manager::octave_keywords ();
-      }
-    return 0;
+  if (set == 1)
+    {
+      return resource_manager::octave_keywords ();
+    }
+  return 0;
 }
 
--- a/libgui/src/m-editor/lexer-octave-gui.h	Thu Sep 13 12:32:17 2012 -0400
+++ b/libgui/src/m-editor/lexer-octave-gui.h	Thu Sep 13 12:32:51 2012 -0400
@@ -31,35 +31,35 @@
 
 class lexer_octave_gui : public QsciLexer
 {
-    Q_OBJECT
+  Q_OBJECT
 
-public:
-    // the used styles
-    enum
-      {
-        Default = 0,
-        Comment = 1,
-        Command = 2,
-        Number = 3,
-        Keyword = 4,
-        SingleQuotedString = 5,
-        Operator = 6,
-        Identifier = 7,
-        DoubleQuotedString = 8
-      };
+  public:
+  // the used styles
+  enum
+    {
+      Default = 0,
+      Comment = 1,
+      Command = 2,
+      Number = 3,
+      Keyword = 4,
+      SingleQuotedString = 5,
+      Operator = 6,
+      Identifier = 7,
+      DoubleQuotedString = 8
+    };
 
-    lexer_octave_gui (QObject *parent = 0);
-    virtual ~lexer_octave_gui ();
-    const char *language () const;
-    const char *lexer () const;
-    QColor defaultColor (int style) const;
-    QFont defaultFont (int style) const;
-    const char *keywords (int set) const;
-    QString description (int style) const;
+  lexer_octave_gui (QObject *parent = 0);
+  virtual ~lexer_octave_gui ();
+  const char *language () const;
+  const char *lexer () const;
+  QColor defaultColor (int style) const;
+  QFont defaultFont (int style) const;
+  const char *keywords (int set) const;
+  QString description (int style) const;
 
 private:
-    lexer_octave_gui (const lexer_octave_gui &);
-    lexer_octave_gui &operator= (const lexer_octave_gui &);
+  lexer_octave_gui (const lexer_octave_gui &);
+  lexer_octave_gui &operator= (const lexer_octave_gui &);
 };
 
 #endif
--- a/libgui/src/main-window.cc	Thu Sep 13 12:32:17 2012 -0400
+++ b/libgui/src/main-window.cc	Thu Sep 13 12:32:51 2012 -0400
@@ -41,12 +41,12 @@
 #include "file-editor.h"
 #include "settings-dialog.h"
 
-main_window::main_window (QWidget * parent)
-  : QMainWindow (parent), octave_event_observer ()
+main_window::main_window (QWidget *p)
+  : QMainWindow (p), octave_event_observer ()
 {
   // We have to set up all our windows, before we finally launch octave.
   construct ();
-  octave_link::instance ()->launch_octave();
+  octave_link::launch_octave ();
 }
 
 main_window::~main_window ()
@@ -101,13 +101,12 @@
 main_window::handle_save_workspace_request ()
 {
   QString selectedFile =
-      QFileDialog::getSaveFileName (this, tr ("Save Workspace"),
-                                    resource_manager::get_home_path ());
+    QFileDialog::getSaveFileName (this, tr ("Save Workspace"),
+                                  resource_manager::get_home_path ());
   if (!selectedFile.isEmpty ())
     {
-      octave_link::instance ()
-          ->post_event (new octave_save_workspace_event (*this,
-          selectedFile.toStdString()));
+      octave_link::post_event (new octave_save_workspace_event
+                               (*this, selectedFile.toStdString ()));
     }
 }
 
@@ -115,28 +114,25 @@
 main_window::handle_load_workspace_request ()
 {
   QString selectedFile =
-      QFileDialog::getOpenFileName (this, tr ("Load Workspace"),
-                                    resource_manager::get_home_path ());
+    QFileDialog::getOpenFileName (this, tr ("Load Workspace"),
+                                  resource_manager::get_home_path ());
   if (!selectedFile.isEmpty ())
     {
-      octave_link::instance ()
-          ->post_event (new octave_load_workspace_event (*this,
-            selectedFile.toStdString()));
+      octave_link::post_event (new octave_load_workspace_event
+                               (*this, selectedFile.toStdString ()));
     }
 }
 
 void
 main_window::handle_clear_workspace_request ()
 {
-  octave_link::instance ()
-      ->post_event (new octave_clear_workspace_event (*this));
+  octave_link::post_event (new octave_clear_workspace_event (*this));
 }
 
 void
 main_window::handle_clear_history_request()
 {
-  octave_link::instance ()
-      ->post_event (new octave_clear_history_event (*this));
+  octave_link::post_event (new octave_clear_history_event (*this));
 }
 
 void
@@ -185,10 +181,10 @@
 
   // FIXME -- what should happen if settings is 0?
 
-  QFont font = QFont();
-  font.setFamily(settings->value("terminal/fontName").toString());
-  font.setPointSize(settings->value("terminal/fontSize").toInt ());
-  _terminal->setTerminalFont(font);
+  QFont term_font = QFont();
+  term_font.setFamily(settings->value("terminal/fontName").toString());
+  term_font.setPointSize(settings->value("terminal/fontSize").toInt ());
+  _terminal->setTerminalFont (term_font);
 
   QString cursorType = settings->value ("terminal/cursorType").toString ();
   bool cursorBlinking = settings->value ("terminal/cursorBlinking").toBool ();
@@ -233,22 +229,20 @@
 main_window::change_current_working_directory ()
 {
   QString selectedDirectory =
-      QFileDialog::getExistingDirectory(this, tr ("Set working direcotry"));
+    QFileDialog::getExistingDirectory(this, tr ("Set working direcotry"));
 
   if (!selectedDirectory.isEmpty ())
     {
-      octave_link::instance ()
-          ->post_event (new octave_change_directory_event (*this,
-                        selectedDirectory.toStdString ()));
+      octave_link::post_event (new octave_change_directory_event
+                               (*this, selectedDirectory.toStdString ()));
     }
 }
 
 void
 main_window::set_current_working_directory (const QString& directory)
 {
-  octave_link::instance ()
-      ->post_event (new octave_change_directory_event (*this,
-                    directory.toStdString ()));
+  octave_link::post_event (new octave_change_directory_event
+                           (*this, directory.toStdString ()));
 }
 
 void
@@ -366,67 +360,62 @@
 void
 main_window::debug_continue ()
 {
-  octave_link::instance ()
-      ->post_event (new octave_debug_continue_event (*this));
+  octave_link::post_event (new octave_debug_continue_event (*this));
 }
 
 void
 main_window::debug_step_into ()
 {
-  octave_link::instance ()
-      ->post_event (new octave_debug_step_into_event (*this));
+  octave_link::post_event (new octave_debug_step_into_event (*this));
 }
 
 void
 main_window::debug_step_over ()
 {
-  octave_link::instance ()
-      ->post_event (new octave_debug_step_over_event (*this));
+  octave_link::post_event (new octave_debug_step_over_event (*this));
 }
 
 void
 main_window::debug_step_out ()
 {
-  octave_link::instance ()
-      ->post_event (new octave_debug_step_out_event (*this));
+  octave_link::post_event (new octave_debug_step_out_event (*this));
 }
 
 void
 main_window::debug_quit ()
 {
-  octave_link::instance ()
-      ->post_event (new octave_debug_quit_event (*this));
+  octave_link::post_event (new octave_debug_quit_event (*this));
 }
 
 void
 main_window::show_about_octave ()
 {
   QString message =
-      "GNU Octave\n"
-      "Copyright (C) 2009 John W. Eaton and others.\n"
-      "This is free software; see the source code for copying conditions."
-      "There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or"
-      "FITNESS FOR A PARTICULAR PURPOSE.  For details, type `warranty'.\n"
-      "\n"
-      "Additional information about Octave is available at http://www.octave.org.\n"
-      "\n"
-      "Please contribute if you find this software useful."
-      "For more information, visit http://www.octave.org/help-wanted.html\n"
-      "\n"
-      "Report bugs to <bug@octave.org> (but first, please read"
-      "http://www.octave.org/bugs.html to learn how to write a helpful report).\n"
-      "\n"
-      "For information about changes from previous versions, type `news'.\n";
+    "GNU Octave\n"
+    "Copyright (C) 2009 John W. Eaton and others.\n"
+    "This is free software; see the source code for copying conditions."
+    "There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or"
+    "FITNESS FOR A PARTICULAR PURPOSE.  For details, type `warranty'.\n"
+    "\n"
+    "Additional information about Octave is available at http://www.octave.org.\n"
+    "\n"
+    "Please contribute if you find this software useful."
+    "For more information, visit http://www.octave.org/help-wanted.html\n"
+    "\n"
+    "Report bugs to <bug@octave.org> (but first, please read"
+    "http://www.octave.org/bugs.html to learn how to write a helpful report).\n"
+    "\n"
+    "For information about changes from previous versions, type `news'.\n";
 
   QMessageBox::about (this, tr ("About Octave"), message);
 }
 
 void
-main_window::closeEvent (QCloseEvent * closeEvent)
+main_window::closeEvent (QCloseEvent *e)
 {
-  closeEvent->ignore ();
-  octave_link::instance ()->post_event (new octave_exit_event (*this));
- }
+  e->ignore ();
+  octave_link::post_event (new octave_exit_event (*this));
+}
 
 void
 main_window::read_settings ()
@@ -447,7 +436,7 @@
           QVariant val = settings->value (name);
           widget->restoreGeometry (val.toByteArray ());
         }
-      }
+    }
   settings->endGroup();
   restoreGeometry (settings->value ("MainWindow/geometry").toByteArray ());
   emit settings_changed ();
@@ -528,7 +517,7 @@
   QMenu *new_menu = file_menu->addMenu(tr ("New"));
 
   QAction *new_script_action
-      = new_menu->addAction (QIcon(":/actions/icons/filenew.png"), tr ("Script"));
+    = new_menu->addAction (QIcon(":/actions/icons/filenew.png"), tr ("Script"));
   new_script_action->setShortcut (Qt::ControlModifier + Qt::Key_N);
 
   QAction *new_function_action = new_menu->addAction (tr ("Function"));
@@ -547,37 +536,37 @@
   new_gui_action->setEnabled (false); // TODO: Make this work.
 
   QAction *open_action
-      = file_menu->addAction (QIcon(":/actions/icons/fileopen.png"), tr ("Open..."));
+    = file_menu->addAction (QIcon(":/actions/icons/fileopen.png"), tr ("Open..."));
   open_action->setShortcut (Qt::ControlModifier + Qt::Key_O);
 
   QAction *close_command_window_action
-      = file_menu->addAction (tr ("Close Command Window"));
+    = file_menu->addAction (tr ("Close Command Window"));
   close_command_window_action->setShortcut (Qt::ControlModifier + Qt::Key_W);
   close_command_window_action->setEnabled (false); // TODO: Make this work.
 
   file_menu->addSeparator ();
   QAction *import_data_action
-      = file_menu->addAction (tr ("Import Data..."));
+    = file_menu->addAction (tr ("Import Data..."));
   import_data_action->setEnabled (false); // TODO: Make this work.
 
   QAction *save_workspace_action
-      = file_menu->addAction (tr ("Save Workspace..."));
+    = file_menu->addAction (tr ("Save Workspace..."));
   save_workspace_action->setShortcut (Qt::ControlModifier + Qt::Key_S);
   file_menu->addSeparator ();
 
   QAction *preferences_action
-      = file_menu->addAction (QIcon(":/actions/icons/configure.png"),
-                              tr ("Preferences..."));
+    = file_menu->addAction (QIcon(":/actions/icons/configure.png"),
+                            tr ("Preferences..."));
   file_menu->addSeparator ();
   QAction *page_setup_action
-      = file_menu->addAction (tr ("Page Setup..."));
+    = file_menu->addAction (tr ("Page Setup..."));
   page_setup_action->setEnabled (false); // TODO: Make this work.
   QAction *print_action
-      = file_menu->addAction (tr ("Print"));
+    = file_menu->addAction (tr ("Print"));
   print_action->setShortcut (Qt::ControlModifier + Qt::Key_P);
   print_action->setEnabled (false); // TODO: Make this work.
   QAction *print_selection_action
-      = file_menu->addAction (tr ("Print Selection..."));
+    = file_menu->addAction (tr ("Print Selection..."));
   print_selection_action->setEnabled (false); // TODO: Make this work.
 
   file_menu->addSeparator ();
@@ -587,57 +576,57 @@
 
   QMenu *edit_menu = menuBar ()->addMenu (tr ("&Edit"));
   QAction *undo_action
-      = edit_menu->addAction (QIcon(":/actions/icons/undo.png"), tr ("Undo"));
+    = edit_menu->addAction (QIcon(":/actions/icons/undo.png"), tr ("Undo"));
   undo_action->setShortcut (QKeySequence::Undo);
 
   QAction *redo_action
-      = edit_menu->addAction (QIcon(":/actions/icons/redo.png"), tr ("Redo"));
+    = edit_menu->addAction (QIcon(":/actions/icons/redo.png"), tr ("Redo"));
   redo_action->setShortcut (QKeySequence::Redo);
   edit_menu->addSeparator ();
 
   QAction *cut_action
-      = edit_menu->addAction (QIcon(":/actions/icons/editcut.png"), tr ("Cut"));
+    = edit_menu->addAction (QIcon(":/actions/icons/editcut.png"), tr ("Cut"));
   cut_action->setShortcut (Qt::ControlModifier + Qt::ShiftModifier + Qt::Key_X);
 
   QAction *copy_action
-      = edit_menu->addAction (QIcon(":/actions/icons/editcopy.png"), tr ("Copy"));
+    = edit_menu->addAction (QIcon(":/actions/icons/editcopy.png"), tr ("Copy"));
   copy_action->setShortcut (Qt::ControlModifier + Qt::ShiftModifier + Qt::Key_C);
 
   QAction *paste_action
-      = edit_menu->addAction (QIcon(":/actions/icons/editpaste.png"), tr ("Paste"));
+    = edit_menu->addAction (QIcon(":/actions/icons/editpaste.png"), tr ("Paste"));
   paste_action->setShortcut (Qt::ControlModifier + Qt::ShiftModifier + Qt::Key_V);
 
   QAction *paste_to_workspace_action
-      = edit_menu->addAction (tr ("Paste To Workspace..."));
+    = edit_menu->addAction (tr ("Paste To Workspace..."));
   paste_to_workspace_action->setEnabled (false); // TODO: Make this work.
   edit_menu->addSeparator ();
 
   QAction *select_all_action
-      = edit_menu->addAction (tr ("Select All"));
+    = edit_menu->addAction (tr ("Select All"));
   select_all_action->setEnabled (false); // TODO: Make this work.
   QAction *delete_action
-      = edit_menu->addAction (tr ("Delete"));
+    = edit_menu->addAction (tr ("Delete"));
   delete_action->setShortcut (Qt::Key_Delete);
   delete_action->setEnabled (false); // TODO: Make this work.
   edit_menu->addSeparator ();
 
   QAction *find_action
-      = edit_menu->addAction (tr ("Find..."));
+    = edit_menu->addAction (tr ("Find..."));
   find_action->setEnabled (false); // TODO: Make this work.
   QAction *find_files_action
-      = edit_menu->addAction (tr ("Find Files..."));
+    = edit_menu->addAction (tr ("Find Files..."));
   find_files_action->setShortcut (Qt::ControlModifier + Qt::ShiftModifier
                                   + Qt::Key_F);
   find_files_action->setEnabled (false); // TODO: Make this work.
   edit_menu->addSeparator ();
 
   QAction *clear_command_window_action
-      = edit_menu->addAction (tr ("Clear Command Window"));
+    = edit_menu->addAction (tr ("Clear Command Window"));
   clear_command_window_action->setEnabled (false); // TODO: Make this work.
   QAction *clear_command_history
-      = edit_menu->addAction(tr ("Clear Command History"));
+    = edit_menu->addAction(tr ("Clear Command History"));
   QAction * clear_workspace_action
-      = edit_menu->addAction (tr ("Clear Workspace"));
+    = edit_menu->addAction (tr ("Clear Workspace"));
 
   _debug_menu = menuBar ()->addMenu (tr ("De&bug"));
 
@@ -713,7 +702,7 @@
   QAction * show_documentation_action = window_menu->addAction (tr ("Show Documentation"));
   show_documentation_action->setCheckable (true);
   show_documentation_action->setShortcut (Qt::ControlModifier + Qt::ShiftModifier
-                                   + Qt::Key_5);
+                                          + Qt::Key_5);
   window_menu->addSeparator ();
 
   QAction * command_window_action
@@ -760,19 +749,19 @@
 
   // Toolbars
   QToolBar *main_tool_bar = addToolBar ("Main");
-            main_tool_bar->addAction (new_script_action);
-            main_tool_bar->addAction (open_action);
-            main_tool_bar->addSeparator ();
-            main_tool_bar->addAction (cut_action);
-            main_tool_bar->addAction (copy_action);
-            main_tool_bar->addAction (paste_action);
-            main_tool_bar->addAction (undo_action);
-            main_tool_bar->addAction (redo_action);
-            main_tool_bar->addSeparator ();
-            main_tool_bar->addWidget (new QLabel (tr ("Current Directory:")));
-            main_tool_bar->addWidget (_current_directory_combo_box);
-            main_tool_bar->addWidget (_current_directory_tool_button);
-            main_tool_bar->addWidget (_current_directory_up_tool_button);
+  main_tool_bar->addAction (new_script_action);
+  main_tool_bar->addAction (open_action);
+  main_tool_bar->addSeparator ();
+  main_tool_bar->addAction (cut_action);
+  main_tool_bar->addAction (copy_action);
+  main_tool_bar->addAction (paste_action);
+  main_tool_bar->addAction (undo_action);
+  main_tool_bar->addAction (redo_action);
+  main_tool_bar->addSeparator ();
+  main_tool_bar->addWidget (new QLabel (tr ("Current Directory:")));
+  main_tool_bar->addWidget (_current_directory_combo_box);
+  main_tool_bar->addWidget (_current_directory_tool_button);
+  main_tool_bar->addWidget (_current_directory_up_tool_button);
 
   connect (qApp,                        SIGNAL (aboutToQuit ()),
            this,                        SLOT   (prepare_for_quit ()));
@@ -833,6 +822,8 @@
   connect (reset_windows_action,        SIGNAL (triggered ()),
            this,                        SLOT   (reset_windows ()));
   connect (this,                        SIGNAL (settings_changed ()),
+           _file_editor,                SLOT   (notice_settings ()));
+  connect (this,                        SIGNAL (settings_changed ()),
            _files_dock_widget,          SLOT   (notice_settings ()));
   connect (this,                        SIGNAL (settings_changed ()),
            this,                        SLOT   (notice_settings ()));
@@ -886,7 +877,7 @@
   read_settings ();
 
   _octave_qt_event_listener = new octave_qt_event_listener ();
-  octave_link::instance ()->register_event_listener (_octave_qt_event_listener);
+  octave_link::register_event_listener (_octave_qt_event_listener);
 
   connect (_octave_qt_event_listener,
            SIGNAL (current_directory_has_changed_signal (QString)),
--- a/libgui/src/main-window.h	Thu Sep 13 12:32:17 2012 -0400
+++ b/libgui/src/main-window.h	Thu Sep 13 12:32:51 2012 -0400
@@ -54,14 +54,14 @@
 #include "octave-event-observer.h"
 
 /**
-  * \class MainWindow
-  *
-  * Represents the main window.
-  */
+ * \class MainWindow
+ *
+ * Represents the main window.
+ */
 class main_window
-    : public QMainWindow, public octave_event_observer
+  : public QMainWindow, public octave_event_observer
 {
-Q_OBJECT public:
+  Q_OBJECT public:
   main_window (QWidget * parent = 0);
   ~main_window ();
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libgui/src/module.mk	Thu Sep 13 12:32:51 2012 -0400
@@ -0,0 +1,165 @@
+EXTRA_DIST += \
+  src/module.mk \
+  src/resource.qrc \
+  $(octave_gui_UI) \
+  $(octave_gui_ICONS)
+
+octave_gui_MOC = \
+  src/m-editor/moc-file-editor-interface.cc \
+  src/m-editor/moc-file-editor-tab.cc \
+  src/m-editor/moc-file-editor.cc \
+  src/m-editor/moc-find-dialog.cc \
+  src/m-editor/moc-lexer-octave-gui.cc \
+  src/moc-documentation-dockwidget.cc \
+  src/moc-files-dockwidget.cc \
+  src/moc-history-dockwidget.cc \
+  src/moc-main-window.cc \
+  src/moc-octave-qt-event-listener.cc \
+  src/moc-settings-dialog.cc \
+  src/moc-terminal-dockwidget.cc \
+  src/moc-welcome-wizard.cc \
+  src/moc-workspace-model.cc \
+  src/moc-workspace-view.cc \
+  src/octave-adapter/moc-octave-main-thread.cc \
+  src/qtinfo/moc-parser.cc \
+  src/qtinfo/moc-webinfo.cc
+
+octave_gui_UI = \
+  src/settings-dialog.ui \
+  src/welcome-wizard.ui
+
+octave_gui_UI_H = $(patsubst src/%.ui, src/ui-%.h, $(octave_gui_UI))
+
+octave_gui_RC = src/qrc-resource.cc
+
+liboctgui_la_SOURCES = \
+  src/documentation-dockwidget.cc \
+  src/files-dockwidget.cc \
+  src/history-dockwidget.cc \
+  src/m-editor/file-editor-tab.cc \
+  src/m-editor/file-editor.cc \
+  src/m-editor/find-dialog.cc \
+  src/m-editor/lexer-octave-gui.cc \
+  src/main-window.cc \
+  src/octave-adapter/octave-event.cc \
+  src/octave-adapter/octave-link.cc \
+  src/octave-adapter/octave-main-thread.cc \
+  src/octave-gui.cc \
+  src/octave-qt-event-listener.cc \
+  src/qtinfo/parser.cc \
+  src/qtinfo/webinfo.cc \
+  src/resource-manager.cc \
+  src/settings-dialog.cc \
+  src/symbol-information.cc \
+  src/terminal-dockwidget.cc \
+  src/welcome-wizard.cc \
+  src/workspace-model.cc \
+  src/workspace-view.cc
+
+nodist_liboctgui_la_SOURCES = $(octave_gui_MOC) $(octave_gui_RC)
+
+noinst_HEADERS += \
+  src/documentation-dockwidget.h \
+  src/files-dockwidget.h \
+  src/history-dockwidget.h \
+  src/m-editor/file-editor-interface.h \
+  src/m-editor/file-editor-tab.h \
+  src/m-editor/file-editor.h \
+  src/m-editor/find-dialog.h \
+  src/m-editor/lexer-octave-gui.h \
+  src/main-window.h \
+  src/octave-adapter/octave-event-listener.h \
+  src/octave-adapter/octave-event-observer.h \
+  src/octave-adapter/octave-event.h \
+  src/octave-adapter/octave-link.h \
+  src/octave-adapter/octave-main-thread.h \
+  src/octave-gui.h \
+  src/octave-qt-event-listener.h \
+  src/qtinfo/parser.h \
+  src/qtinfo/webinfo.h \
+  src/resource-manager.h \
+  src/settings-dialog.h \
+  src/symbol-information.h \
+  src/terminal-dockwidget.h \
+  src/welcome-wizard.h \
+  src/workspace-model.h \
+  src/workspace-view.h
+
+CLEANFILES += \
+  $(octave_gui_MOC) \
+  $(octave_gui_UI_H) \
+  $(octave_gui_RC)
+
+BUILT_SOURCES += $(octave_gui_UI_H)
+
+octave_gui_ICONS = \
+  src/icons/arrow_right.png \
+  src/icons/artsbuilderexecute.png \
+  src/icons/bookmark.png \
+  src/icons/bp_next.png \
+  src/icons/bp_prev.png \
+  src/icons/bp_rm_all.png \
+  src/icons/bp_toggle.png \
+  src/icons/chat.png \
+  src/icons/configure.png \
+  src/icons/db_cont.png \
+  src/icons/db_step_in.png \
+  src/icons/db_step_out.png \
+  src/icons/db_step.png \
+  src/icons/db_stop.png \
+  src/icons/editcopy.png \
+  src/icons/editcut.png \
+  src/icons/editpaste.png \
+  src/icons/filenew.png \
+  src/icons/fileopen.png \
+  src/icons/filesaveas.png \
+  src/icons/filesave.png \
+  src/icons/find.png \
+  src/icons/help_index.png \
+  src/icons/icons_license \
+  src/icons/jabber_protocol.png \
+  src/icons/logo.png \
+  src/icons/question.png \
+  src/icons/redled.png \
+  src/icons/redo.png \
+  src/icons/search.png \
+  src/icons/star.png \
+  src/icons/stop.png \
+  src/icons/terminal.png \
+  src/icons/undo.png \
+  src/icons/up.png \
+  src/icons/zoom-in.png \
+  src/icons/zoom-out.png
+
+liboctgui_la_CPPFLAGS = \
+  $(AM_CPPFLAGS) \
+  @OCTGUI_DLL_DEFS@ \
+  -I$(QT_INCDIR) \
+  -I$(QT_INCDIR)/QtCore \
+  -I$(QT_INCDIR)/QtGui \
+  -I$(QT_INCDIR)/QtNetwork \
+  -I$(srcdir)/qterminal/libqterminal \
+  -Isrc -I$(srcdir)/src \
+  -I$(srcdir)/src/m-editor \
+  -I$(srcdir)/src/octave-adapter \
+  -I$(srcdir)/src/qtinfo \
+  -I$(top_srcdir)/liboctave/cruft/misc \
+  -I$(top_srcdir)/liboctave/array \
+  -I$(top_builddir)/liboctave/numeric -I$(top_srcdir)/liboctave/numeric \
+  -I$(top_builddir)/liboctave/operators -I$(top_srcdir)/liboctave/operators \
+  -I$(top_srcdir)/liboctave/system \
+  -I$(top_srcdir)/liboctave/util \
+  -I$(top_srcdir)/libinterp \
+  -I$(top_builddir)/libinterp/parse-tree -I$(top_srcdir)/libinterp/parse-tree \
+  -I$(top_builddir)/libinterp/interp-core -I$(top_srcdir)/libinterp/interp-core \
+  -I$(top_builddir)/libinterp/interpfcn -I$(top_srcdir)/libinterp/interpfcn \
+  -I$(top_srcdir)/libinterp/octave-value
+
+liboctgui_la_CFLAGS = $(AM_CFLAGS) $(WARN_CFLAGS)
+
+liboctgui_la_CXXFLAGS = $(AM_CXXFLAGS) $(WARN_CXXFLAGS)
+
+noinst_LTLIBRARIES += src/libgui-src.la
+
+src_libgui_src_la_SOURCES = $(GUI_SRC_SRC)
+src_libgui_src_la_CPPFLAGS = $(liboctgui_la_CPPFLAGS)
--- a/libgui/src/octave-adapter/octave-link.cc	Thu Sep 13 12:32:17 2012 -0400
+++ b/libgui/src/octave-adapter/octave-link.cc	Thu Sep 13 12:32:51 2012 -0400
@@ -28,140 +28,165 @@
 #include "cmd-edit.h"
 #include "oct-env.h"
 #include "oct-mutex.h"
+#include "singleton-cleanup.h"
 #include "symtab.h"
 #include "toplev.h"
 
 #include "octave-link.h"
 
-int octave_readline_hook ()
+static int
+octave_readline_hook (void)
 {
-  octave_link::instance ()->entered_readline_hook ();
-  octave_link::instance ()->generate_events ();
-  octave_link::instance ()->process_events ();
-  octave_link::instance ()->finished_readline_hook ();
+  octave_link::entered_readline_hook ();
+  octave_link::generate_events ();
+  octave_link::process_events ();
+  octave_link::finished_readline_hook ();
+
   return 0;
 }
 
-void octave_exit_hook (int status)
+static void
+octave_exit_hook (int)
 {
-  (void) status;
-  octave_link::instance ()->about_to_exit ();
+  octave_link::about_to_exit ();
 }
 
-octave_link octave_link::_singleton;
+octave_link *octave_link::instance = 0;
 
-octave_link::octave_link ()
+octave_link::octave_link (void)
+  : event_listener (0), event_queue_mutex (new octave_mutex ()),
+    event_queue (), last_cwd (), debugging (false)
+{ }
+
+void
+octave_link::do_launch_octave (void)
 {
-  _event_queue_mutex = new octave_mutex ();
-  _last_working_directory = "";
-  _debugging_mode_active = false;
-}
+  // Create both threads.
+  main_thread = new octave_main_thread ();
+
+  command_editor::add_event_hook (octave_readline_hook);
 
-octave_link::~octave_link ()
-{
+  octave_exit = octave_exit_hook;
+
+  // Start the first one.
+  main_thread->start ();
 }
 
 void
-octave_link::launch_octave ()
+octave_link::do_register_event_listener (octave_event_listener *el)
 {
-  // Create both threads.
-  _octave_main_thread = new octave_main_thread ();
-  command_editor::add_event_hook (octave_readline_hook);
-  octave_exit = octave_exit_hook;
-
-  // Start the first one.
-  _octave_main_thread->start ();
+  event_listener = el;
 }
 
 void
-octave_link::register_event_listener (octave_event_listener *oel)
-{ _octave_event_listener = oel; }
-
-void
-octave_link::generate_events ()
+octave_link::do_generate_events (void)
 {
   std::string current_working_directory = octave_env::get_current_directory ();
-  if (current_working_directory != _last_working_directory)
+
+  if (current_working_directory != last_cwd)
     {
-      _last_working_directory = current_working_directory;
-      if (_octave_event_listener)
-        _octave_event_listener
-            ->current_directory_has_changed (_last_working_directory);
+      last_cwd = current_working_directory;
+
+      if (event_listener)
+        event_listener->current_directory_has_changed (last_cwd);
     }
 
-  if (_debugging_mode_active != Vdebugging)
+  if (debugging != Vdebugging)
     {
-      _debugging_mode_active = Vdebugging;
-      if (_octave_event_listener)
+      debugging = Vdebugging;
+
+      if (event_listener)
         {
-          if (_debugging_mode_active)
-            _octave_event_listener->entered_debug_mode ();
+          if (debugging)
+            event_listener->entered_debug_mode ();
           else
-            _octave_event_listener->quit_debug_mode ();
+            event_listener->quit_debug_mode ();
         }
     }
 }
 
 void
-octave_link::process_events ()
+octave_link::do_process_events (void)
 {
-  _event_queue_mutex->lock ();
+  event_queue_mutex->lock ();
 
-  while (_event_queue.size () > 0)
+  while (event_queue.size () > 0)
     {
-      octave_event * e = _event_queue.front ();
-      _event_queue.pop ();
+      octave_event *e = event_queue.front ();
+
+      event_queue.pop ();
+
       if (e->perform ())
         e->accept ();
       else
         e->reject ();
     }
-  _event_queue_mutex->unlock ();
+
+  event_queue_mutex->unlock ();
+}
+
+void
+octave_link::do_post_event (octave_event *e)
+{
+  if (e)
+    {
+      event_queue_mutex->lock ();
+      event_queue.push (e);
+      event_queue_mutex->unlock ();
+    }
 }
 
 void
-octave_link::post_event (octave_event *e)
+octave_link::do_about_to_exit (void)
 {
-  if (e)
-    {
-      _event_queue_mutex->lock ();
-      _event_queue.push (e);
-      _event_queue_mutex->unlock ();
-    }
+  event_queue_mutex->lock ();
+
+  while (! event_queue.empty ())
+    event_queue.pop ();
+
+  event_queue_mutex->unlock ();
+
+  if (event_listener)
+    event_listener->about_to_exit ();
+}
+
+std::string
+octave_link::do_last_working_directory (void)
+{
+  return last_cwd;
 }
 
 void
 octave_link::event_accepted (octave_event *e)
-{ delete e; }
+{
+  delete e;
+}
 
 void
 octave_link::event_reject (octave_event *e)
-{ delete e; }
-
-void
-octave_link::about_to_exit ()
 {
-  _event_queue_mutex->lock ();
-  while (!_event_queue.empty ())
-    _event_queue.pop ();
-
-  _event_queue_mutex->unlock ();
-
-  if (_octave_event_listener)
-    _octave_event_listener->about_to_exit ();
+  delete e;
 }
 
-void
-octave_link::entered_readline_hook ()
-{ }
-
-void
-octave_link::finished_readline_hook ()
+bool
+octave_link::instance_ok (void)
 {
-}
+  bool retval = true;
+
+  if (! instance)
+    {
+      instance = new octave_link ();
+
+      if (instance)
+        singleton_cleanup_list::add (cleanup_instance);
+    }
 
-std::string
-octave_link::get_last_working_directory ()
-{
-  return _last_working_directory;
+  if (! instance)
+    {
+      ::error ("unable to create octave_link object!");
+
+      retval = false;
+    }
+
+  return retval;
 }
--- a/libgui/src/octave-adapter/octave-link.h	Thu Sep 13 12:32:17 2012 -0400
+++ b/libgui/src/octave-adapter/octave-link.h	Thu Sep 13 12:32:51 2012 -0400
@@ -34,61 +34,124 @@
 #include "octave-event-observer.h"
 #include "octave-event-listener.h"
 
-/**
-  * \class OctaveLink
-  * \brief Provides threadsafe access to octave.
-  * \author Jacob Dawid
-  * This class is a wrapper around octave and provides threadsafety by
-  * buffering access operations to octave and executing them in the readline
-  * event hook, which lives in the octave thread.
-  */
+// \class OctaveLink
+// \brief Provides threadsafe access to octave.
+// \author Jacob Dawid
+//
+// This class is a wrapper around octave and provides thread safety by
+// buffering access operations to octave and executing them in the
+// readline event hook, which lives in the octave thread.
+
 class octave_link : public octave_event_observer
 {
+protected:
+
+  octave_link (void);
+
 public:
-  /** Provides a way to access the unique octave_link object. */
-  static octave_link * instance () { return &_singleton; }
+
+  ~octave_link (void) { }
+
+  static void launch_octave (void)
+  {
+    if (instance_ok ())
+      instance->do_launch_octave ();
+  }
+
+  static void register_event_listener (octave_event_listener *el)
+  {
+    if (instance_ok ())
+      instance->do_register_event_listener (el);
+  }
+
+  static void generate_events (void)
+  {
+    if (instance_ok ())
+      instance->do_generate_events ();
+  }
+
+  static void process_events (void)
+  {
+    if (instance_ok ())
+      instance->do_process_events ();
+  }
+
+  static void post_event (octave_event *e)
+  {
+    if (instance_ok ())
+      instance->do_post_event (e);
+  }
+
+  static void about_to_exit (void)
+  {
+    if (instance_ok ())
+      instance->do_about_to_exit ();
+  }
+
+  static void entered_readline_hook (void)
+  {
+    if (instance_ok ())
+      instance->do_entered_readline_hook ();
+  }
 
-  /** Starts octave. */
-  void launch_octave ();
-  void register_event_listener (octave_event_listener *oel);
+  static void finished_readline_hook (void)
+  {
+    if (instance_ok ())
+      instance->do_finished_readline_hook ();
+  }
+
+  static std::string last_working_directory (void)
+  {
+    return instance_ok ()
+      ? instance->do_last_working_directory () : std::string ();
+  }
+
+private:
+
+  static octave_link *instance;
+
+  static void cleanup_instance (void) { delete instance; instance = 0; }
+
+  // No copying!
+
+  octave_link (const octave_link&);
+
+  octave_link& operator = (const octave_link&);
+
+  static bool instance_ok (void);
+
+  octave_event_listener *event_listener;
 
-  void generate_events ();
-  void process_events ();
-  void post_event (octave_event *e);
+  // Thread running octave_main.
+  octave_main_thread *main_thread;
+
+  // Semaphore to lock access to the event queue.
+  octave_mutex *event_queue_mutex;
+
+  // Buffer for queueing events until they will be processed.
+  std::queue <octave_event *> event_queue;
+
+  // Stores the last known current working directory of octave.
+  std::string last_cwd;
+
+  bool debugging;
+
+  void do_launch_octave (void);
+  void do_register_event_listener (octave_event_listener *oel);
+
+  void do_generate_events (void);
+  void do_process_events (void);
+  void do_post_event (octave_event *e);
+
+  void do_about_to_exit (void);
+
+  void do_entered_readline_hook (void) { }
+  void do_finished_readline_hook (void) { }
+
+  std::string do_last_working_directory (void);
+
   void event_accepted (octave_event *e);
   void event_reject (octave_event *e);
-
-  void about_to_exit ();
-
-  void entered_readline_hook ();
-  void finished_readline_hook ();
-
-  std::string get_last_working_directory ();
-
-private:
-  /** Singleton. */
-  octave_link ();
-  ~octave_link ();
-
-  octave_event_listener *_octave_event_listener;
-
-  /** Thread running octave_main. */
-  octave_main_thread *_octave_main_thread;
+};
 
-  /** Semaphore to lock access to the event queue. */
-  octave_mutex *_event_queue_mutex;
-
-  /** Buffer for queueing events until they will be processed. */
-  std::queue <octave_event *> _event_queue;
-
-  /** Stores the last known current working directory of octave. */
-  std::string _last_working_directory;
-  bool _debugging_mode_active;
-
-  /** Semaphore to lock access to the performance information. */
-  octave_mutex *_performance_information_mutex;
-
-  /** Unique instance. Singelton! */
-  static octave_link _singleton;
-};
 #endif // OCTAVELINK_H
--- a/libgui/src/octave-gui.cc	Thu Sep 13 12:32:17 2012 -0400
+++ b/libgui/src/octave-gui.cc	Thu Sep 13 12:32:51 2012 -0400
@@ -30,7 +30,8 @@
 
 #include <iostream>
 
-#include <syswait.h>
+#include "lo-utils.h"
+#include "syswait.h"
 
 #include "welcome-wizard.h"
 #include "resource-manager.h"
@@ -69,7 +70,8 @@
 
       waitpid (pid, &status, 0);
 
-      exit (WIFEXITED (status) ? WEXITSTATUS (status) : 127);
+      exit (octave_wait::ifexited (status)
+            ? octave_wait::exitstatus (status) : 127);
     }
 
 #endif
--- a/libgui/src/octave-qt-event-listener.cc	Thu Sep 13 12:32:17 2012 -0400
+++ b/libgui/src/octave-qt-event-listener.cc	Thu Sep 13 12:32:51 2012 -0400
@@ -27,8 +27,8 @@
 #include "octave-qt-event-listener.h"
 #include <QApplication>
 
-octave_qt_event_listener::octave_qt_event_listener (QObject *parent)
-  : QObject (parent), octave_event_listener ()
+octave_qt_event_listener::octave_qt_event_listener (QObject *p)
+  : QObject (p), octave_event_listener ()
 {
 }
 
@@ -36,7 +36,7 @@
 octave_qt_event_listener::current_directory_has_changed (const std::string& directory)
 {
   emit current_directory_has_changed_signal
-      (QString::fromStdString (directory));
+    (QString::fromStdString (directory));
 }
 
 void
--- a/libgui/src/octave-qt-event-listener.h	Thu Sep 13 12:32:17 2012 -0400
+++ b/libgui/src/octave-qt-event-listener.h	Thu Sep 13 12:32:51 2012 -0400
@@ -28,22 +28,22 @@
 #include "octave-event-listener.h"
 
 class octave_qt_event_listener
-    : public QObject, public octave_event_listener
+  : public QObject, public octave_event_listener
 {
-    Q_OBJECT
+  Q_OBJECT
   public:
-    octave_qt_event_listener (QObject *parent = 0);
+  octave_qt_event_listener (QObject *parent = 0);
 
-    void current_directory_has_changed (const std::string& directory);
-    void about_to_exit ();
+  void current_directory_has_changed (const std::string& directory);
+  void about_to_exit ();
 
-    void entered_debug_mode ();
-    void quit_debug_mode ();
+  void entered_debug_mode ();
+  void quit_debug_mode ();
 
-  signals:
-    void current_directory_has_changed_signal (const QString& directory);
-    void entered_debug_mode_signal ();
-    void quit_debug_mode_signal ();
+signals:
+  void current_directory_has_changed_signal (const QString& directory);
+  void entered_debug_mode_signal ();
+  void quit_debug_mode_signal ();
 };
 
 #endif // OCTAVEQTEVENTLISTENER_H
--- a/libgui/src/qtinfo/parser.cc	Thu Sep 13 12:32:17 2012 -0400
+++ b/libgui/src/qtinfo/parser.cc	Thu Sep 13 12:32:51 2012 -0400
@@ -30,8 +30,8 @@
 #include <QProcess>
 #include <QBuffer>
 
-parser::parser(QObject *parent)
-  : QObject(parent)
+parser::parser(QObject *p)
+  : QObject(p)
 {
   _compressors_map.insert ("bz2",  "bzip2 -dc \"%1\"");
   _compressors_map.insert ("gz",   "gzip -dc \"%1\"");
--- a/libgui/src/qtinfo/webinfo.cc	Thu Sep 13 12:32:17 2012 -0400
+++ b/libgui/src/qtinfo/webinfo.cc	Thu Sep 13 12:32:51 2012 -0400
@@ -30,53 +30,53 @@
 #include "defaults.h"
 
 
-webinfo::webinfo (QWidget *parent)
-  : QWidget (parent)
+webinfo::webinfo (QWidget *p)
+  : QWidget (p)
 {
   _font_web = font ();
 
-  QVBoxLayout *layout = new QVBoxLayout ();
-  layout->setMargin (0);
-  setLayout (layout);
+  QVBoxLayout *vbox_layout = new QVBoxLayout ();
+  vbox_layout->setMargin (0);
+  setLayout (vbox_layout);
 
-  QHBoxLayout *hboxLayout = new QHBoxLayout ();
-  hboxLayout->setMargin (2);
-  layout->addLayout (hboxLayout);
+  QHBoxLayout *hbox_layout = new QHBoxLayout ();
+  hbox_layout->setMargin (2);
+  vbox_layout->addLayout (hbox_layout);
 
   _close_tab_button = new QPushButton (this);
   _close_tab_button->setSizePolicy (QSizePolicy::Fixed,QSizePolicy::Preferred);
   _close_tab_button->setIcon (QIcon (":/actions/icons/stop.png"));
-  hboxLayout->addWidget (_close_tab_button);
+  hbox_layout->addWidget (_close_tab_button);
 
   _tab_bar = new QTabBar (this);
   _tab_bar->setSizePolicy (QSizePolicy::Preferred,QSizePolicy::Preferred);
   _tab_bar->setExpanding (false);
-  hboxLayout->addWidget (_tab_bar);
+  hbox_layout->addWidget (_tab_bar);
 
   _zoom_in_button = new QToolButton (this);
   _zoom_in_button->setSizePolicy (QSizePolicy::Fixed,QSizePolicy::Preferred);
   _zoom_in_button->setIcon (QIcon (":/actions/icons/zoom-in.png"));
-  hboxLayout->addWidget (_zoom_in_button);
+  hbox_layout->addWidget (_zoom_in_button);
 
   _zoom_out_button = new QToolButton (this);
   _zoom_out_button->setSizePolicy (QSizePolicy::Fixed,QSizePolicy::Preferred);
   _zoom_out_button->setIcon (QIcon (":/actions/icons/zoom-out.png"));
-  hboxLayout->addWidget (_zoom_out_button);
+  hbox_layout->addWidget (_zoom_out_button);
 
   _stacked_widget = new QStackedWidget (this);
-  layout->addWidget (_stacked_widget);
+  vbox_layout->addWidget (_stacked_widget);
 
-  hboxLayout = new QHBoxLayout ();
-  layout->addLayout (hboxLayout);
+  hbox_layout = new QHBoxLayout ();
+  vbox_layout->addLayout (hbox_layout);
 
   _search_line_edit = new QLineEdit(this);
 #ifdef HAVE_SETPLACEHOLDERTEXT
   _search_line_edit->setPlaceholderText (tr ("Type here and press \'Return\' to search"));
 #endif
-  hboxLayout->addWidget (_search_line_edit);
+  hbox_layout->addWidget (_search_line_edit);
 
   _search_check_box = new QCheckBox (tr ("Global search"));
-  hboxLayout->addWidget (_search_check_box);
+  hbox_layout->addWidget (_search_check_box);
 
   connect (_close_tab_button, SIGNAL (clicked ()), this, SLOT (close_tab ()));
   connect (_tab_bar, SIGNAL (currentChanged (int)), this, SLOT (current_tab_changed (int)));
@@ -130,8 +130,8 @@
 void
 webinfo::current_tab_changed (int index)
 {
-  QVariant data = _tab_bar->tabData (index);
-  _text_browser = (QTextBrowser*) (data.value<void*> ());
+  QVariant tab_data = _tab_bar->tabData (index);
+  _text_browser = (QTextBrowser*) (tab_data.value<void*> ());
 
   _stacked_widget->setCurrentIndex (_stacked_widget->indexOf (_text_browser));
 
@@ -156,9 +156,9 @@
 
   int nt = _tab_bar->addTab (name);
   _tab_bar->setCurrentIndex (nt);
-  QVariant data;
-  data.setValue ( (void*)_text_browser);
-  _tab_bar->setTabData (nt, data);
+  QVariant tab_data;
+  tab_data.setValue ( (void*)_text_browser);
+  _tab_bar->setTabData (nt, tab_data);
 
   connect (_tab_bar, SIGNAL (currentChanged (int)), this, SLOT (current_tab_changed (int)));
 
@@ -180,8 +180,8 @@
 void
 webinfo::closeTab (int index)
 {
-  QVariant data = _tab_bar->tabData (index);
-  QWidget *w = (QWidget*) (data.value<void*> ());
+  QVariant tab_data = _tab_bar->tabData (index);
+  QWidget *w = (QWidget*) (tab_data.value<void*> ());
   _stacked_widget->removeWidget (w);
   delete w;
 
--- a/libgui/src/resource-manager.cc	Thu Sep 13 12:32:17 2012 -0400
+++ b/libgui/src/resource-manager.cc	Thu Sep 13 12:32:51 2012 -0400
@@ -114,14 +114,14 @@
   QString settings_file = settings_path + "qt-settings";
 
   if (!QFile::exists (settings_file))
-   {
-     QDir("/").mkpath (settings_path);
-     QFile::copy (QString::fromStdString (default_qt_settings_file ()),
-                  settings_file);
-     first_run = true;
-   }
+    {
+      QDir("/").mkpath (settings_path);
+      QFile::copy (QString::fromStdString (default_qt_settings_file ()),
+                   settings_file);
+      first_run = true;
+    }
   else
-     first_run = false;
+    first_run = false;
 
   do_set_settings (settings_file);
 }
--- a/libgui/src/settings-dialog.cc	Thu Sep 13 12:32:17 2012 -0400
+++ b/libgui/src/settings-dialog.cc	Thu Sep 13 12:32:51 2012 -0400
@@ -29,8 +29,8 @@
 #include "ui-settings-dialog.h"
 #include <QSettings>
 
-settings_dialog::settings_dialog (QWidget * parent):
-QDialog (parent), ui (new Ui::settings_dialog)
+settings_dialog::settings_dialog (QWidget *p):
+  QDialog (p), ui (new Ui::settings_dialog)
 {
   ui->setupUi (this);
 
--- a/libgui/src/settings-dialog.h	Thu Sep 13 12:32:17 2012 -0400
+++ b/libgui/src/settings-dialog.h	Thu Sep 13 12:32:51 2012 -0400
@@ -32,7 +32,7 @@
 
 class settings_dialog:public QDialog
 {
-Q_OBJECT public:
+  Q_OBJECT public:
   explicit settings_dialog (QWidget * parent);
   ~settings_dialog ();
   void write_changed_settings ();
--- a/libgui/src/settings-dialog.ui	Thu Sep 13 12:32:17 2012 -0400
+++ b/libgui/src/settings-dialog.ui	Thu Sep 13 12:32:51 2012 -0400
@@ -103,9 +103,6 @@
            <property name="text">
             <string>Show line numbers</string>
            </property>
-           <property name="checked">
-            <bool>false</bool>
-           </property>
           </widget>
          </item>
          <item>
@@ -116,9 +113,6 @@
            <property name="text">
             <string>Highlight current line</string>
            </property>
-           <property name="checked">
-            <bool>false</bool>
-           </property>
           </widget>
          </item>
          <item>
@@ -634,38 +628,6 @@
    </hints>
   </connection>
   <connection>
-   <sender>editor_showLineNumbers</sender>
-   <signal>toggled(bool)</signal>
-   <receiver>editor_showLineNumbers</receiver>
-   <slot>setEnabled(bool)</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>249</x>
-     <y>87</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>249</x>
-     <y>87</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>editor_highlightCurrentLine</sender>
-   <signal>toggled(bool)</signal>
-   <receiver>editor_highlightCurrentLine</receiver>
-   <slot>setEnabled(bool)</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>249</x>
-     <y>112</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>249</x>
-     <y>112</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
    <sender>useProxyServer</sender>
    <signal>toggled(bool)</signal>
    <receiver>proxyUserName</receiver>
@@ -714,22 +676,6 @@
    </hints>
   </connection>
   <connection>
-   <sender>editor_codeCompletion</sender>
-   <signal>toggled(bool)</signal>
-   <receiver>editor_codeCompletion</receiver>
-   <slot>setEnabled(bool)</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>249</x>
-     <y>137</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>249</x>
-     <y>137</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
    <sender>buttonBox</sender>
    <signal>accepted()</signal>
    <receiver>settings_dialog</receiver>
--- a/libgui/src/symbol-information.cc	Thu Sep 13 12:32:17 2012 -0400
+++ b/libgui/src/symbol-information.cc	Thu Sep 13 12:32:51 2012 -0400
@@ -67,7 +67,7 @@
       if (increment != 1 )
         buffer << increment << ":";
       buffer << limit;
-      
+
       short_value_string = QString::fromStdString (buffer.str ());
     }
   else if (ov.is_matrix_type () || ov.is_cell ())
--- a/libgui/src/symbol-information.h	Thu Sep 13 12:32:17 2012 -0400
+++ b/libgui/src/symbol-information.h	Thu Sep 13 12:32:51 2012 -0400
@@ -35,25 +35,25 @@
 #include "symtab.h"
 
 /**
-  * \struct symbol_information
-  * \brief Meta-information over a symbol-table entry.
-  * \author Jacob Dawid
-  * This struct is used to store meta information over a symbol entry.
-  * It reduces memory consumption, since it only stores relevant data
-  * about a symbol-table entry that will be used in the model for the
-  * graphical user interface.
-  */
+ * \struct symbol_information
+ * \brief Meta-information over a symbol-table entry.
+ * \author Jacob Dawid
+ * This struct is used to store meta information over a symbol entry.
+ * It reduces memory consumption, since it only stores relevant data
+ * about a symbol-table entry that will be used in the model for the
+ * graphical user interface.
+ */
 class symbol_information
 {
 public:
 
   enum Scope
-  {
-    unknown     = 0,
-    local       = 1,
-    global      = 2,
-    persistent  = 3
-  };
+    {
+      unknown     = 0,
+      local       = 1,
+      global      = 2,
+      persistent  = 3
+    };
 
   symbol_information (const symbol_table::symbol_record& symbol_record);
 
--- a/libgui/src/terminal-dockwidget.cc	Thu Sep 13 12:32:17 2012 -0400
+++ b/libgui/src/terminal-dockwidget.cc	Thu Sep 13 12:32:51 2012 -0400
@@ -26,8 +26,8 @@
 
 #include "terminal-dockwidget.h"
 
-terminal_dock_widget::terminal_dock_widget (QTerminal *terminal, QWidget *parent)
-  : QDockWidget (parent)
+terminal_dock_widget::terminal_dock_widget (QTerminal *terminal, QWidget *p)
+  : QDockWidget (p)
 {
   setObjectName ("TerminalDockWidget");
   setWindowTitle (tr ("Command Window"));
--- a/libgui/src/terminal-dockwidget.h	Thu Sep 13 12:32:17 2012 -0400
+++ b/libgui/src/terminal-dockwidget.h	Thu Sep 13 12:32:51 2012 -0400
@@ -29,18 +29,18 @@
 class terminal_dock_widget : public QDockWidget
 {
   Q_OBJECT
-public:
+  public:
   terminal_dock_widget (QTerminal *terminal, QWidget *parent = 0);
 
 signals:
-    void active_changed (bool active);
+  void active_changed (bool active);
 
 public slots:
-    void handle_visibility_changed (bool visible)
-    {
-      if (visible)
-        emit active_changed (true);
-    }
+  void handle_visibility_changed (bool visible)
+  {
+    if (visible)
+      emit active_changed (true);
+  }
 };
 
 #endif // TERMINALDOCKWIDGET_H
--- a/libgui/src/welcome-wizard.cc	Thu Sep 13 12:32:17 2012 -0400
+++ b/libgui/src/welcome-wizard.cc	Thu Sep 13 12:32:51 2012 -0400
@@ -27,9 +27,8 @@
 #include "welcome-wizard.h"
 #include "ui-welcome-wizard.h"
 
-welcome_wizard::welcome_wizard (QWidget *parent) :
-  QDialog (parent),
-  _ui (new Ui::welcome_wizard)
+welcome_wizard::welcome_wizard (QWidget *p)
+  : QDialog (p), _ui (new Ui::welcome_wizard)
 {
   _ui->setupUi (this);
   connect (_ui->nextButton1, SIGNAL (clicked ()), this, SLOT (next ()));
--- a/libgui/src/welcome-wizard.h	Thu Sep 13 12:32:17 2012 -0400
+++ b/libgui/src/welcome-wizard.h	Thu Sep 13 12:32:51 2012 -0400
@@ -26,14 +26,14 @@
 #include <QDialog>
 
 namespace Ui {
-    class welcome_wizard;
+  class welcome_wizard;
 }
 
 class welcome_wizard : public QDialog
 {
   Q_OBJECT
 
-public:
+  public:
   explicit welcome_wizard (QWidget *parent = 0);
   ~welcome_wizard ();
 
--- a/libgui/src/workspace-model.cc	Thu Sep 13 12:32:17 2012 -0400
+++ b/libgui/src/workspace-model.cc	Thu Sep 13 12:32:51 2012 -0400
@@ -34,8 +34,8 @@
 #include "workspace-model.h"
 #include "octave-link.h"
 
-workspace_model::workspace_model(QObject *parent)
-  : QAbstractItemModel(parent), octave_event_observer ()
+workspace_model::workspace_model(QObject *p)
+  : QAbstractItemModel (p), octave_event_observer ()
 {
   QList<QVariant> rootData;
   rootData << tr ("Name") << tr ("Class") << tr("Dimension") << tr ("Value");
@@ -63,8 +63,7 @@
 void
 workspace_model::request_update_workspace ()
 {
-  octave_link::instance ()
-      ->post_event (new octave_update_workspace_event (*this));
+  octave_link::post_event (new octave_update_workspace_event (*this));
 }
 
 void
@@ -95,9 +94,20 @@
 
           switch (s.scope ())
             {
-              case symbol_information::local:       top_level_item (0)->add_child (child); break;
-              case symbol_information::global:      top_level_item (1)->add_child (child); break;
-              case symbol_information::persistent:  top_level_item (2)->add_child (child); break;
+            case symbol_information::local:
+              top_level_item (0)->add_child (child);
+              break;
+
+            case symbol_information::global:
+              top_level_item (1)->add_child (child);
+              break;
+
+            case symbol_information::persistent:
+              top_level_item (2)->add_child (child);
+              break;
+
+            default:
+              break;
             }
         }
 
@@ -118,17 +128,17 @@
 }
 
 QModelIndex
-workspace_model::index(int row, int column, const QModelIndex &parent) const
+workspace_model::index(int row, int column, const QModelIndex &p) const
 {
-  if (!hasIndex(row, column, parent))
+  if (!hasIndex(row, column, p))
     return QModelIndex();
 
   tree_item *parentItem;
 
-  if (!parent.isValid())
+  if (!p.isValid())
     parentItem = _rootItem;
   else
-    parentItem = static_cast<tree_item*>(parent.internalPointer());
+    parentItem = static_cast<tree_item*>(p.internalPointer());
 
   tree_item *childItem = parentItem->child(row);
   if (childItem)
@@ -138,12 +148,12 @@
 }
 
 QModelIndex
-workspace_model::parent(const QModelIndex &index) const
+workspace_model::parent(const QModelIndex &idx) const
 {
-  if (!index.isValid())
+  if (!idx.isValid())
     return QModelIndex();
 
-  tree_item *childItem = static_cast<tree_item*>(index.internalPointer());
+  tree_item *childItem = static_cast<tree_item*>(idx.internalPointer());
 
   if (childItem)
     {
@@ -159,25 +169,25 @@
 }
 
 int
-workspace_model::rowCount(const QModelIndex &parent) const
+workspace_model::rowCount(const QModelIndex &p) const
 {
   tree_item *parentItem;
-  if (parent.column() > 0)
+  if (p.column() > 0)
     return 0;
 
-  if (!parent.isValid())
+  if (!p.isValid())
     parentItem = _rootItem;
   else
-    parentItem = static_cast<tree_item*>(parent.internalPointer());
+    parentItem = static_cast<tree_item*>(p.internalPointer());
 
   return parentItem->child_count();
 }
 
 int
-workspace_model::columnCount(const QModelIndex &parent) const
+workspace_model::columnCount(const QModelIndex &p) const
 {
-  if (parent.isValid())
-    return static_cast<tree_item*>(parent.internalPointer())->column_count();
+  if (p.isValid())
+    return static_cast<tree_item*>(p.internalPointer())->column_count();
   else
     return _rootItem->column_count();
 }
@@ -195,9 +205,9 @@
 }
 
 Qt::ItemFlags
-workspace_model::flags(const QModelIndex &index) const
+workspace_model::flags(const QModelIndex &idx) const
 {
-  if (!index.isValid())
+  if (!idx.isValid())
     return 0;
 
   return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
@@ -213,16 +223,16 @@
 }
 
 QVariant
-workspace_model::data(const QModelIndex &index, int role) const
+workspace_model::data(const QModelIndex &idx, int role) const
 {
-  if (!index.isValid())
+  if (!idx.isValid())
     return QVariant();
 
   if (role != Qt::DisplayRole)
     return QVariant();
 
-  tree_item *item = static_cast<tree_item*>(index.internalPointer());
+  tree_item *item = static_cast<tree_item*>(idx.internalPointer());
 
-  return item->data(index.column());
+  return item->data(idx.column());
 }
 
--- a/libgui/src/workspace-model.h	Thu Sep 13 12:32:17 2012 -0400
+++ b/libgui/src/workspace-model.h	Thu Sep 13 12:32:51 2012 -0400
@@ -35,20 +35,20 @@
 class tree_item
 {
 public:
-  tree_item (const QList<QVariant> &data, tree_item *parent = 0) {
-    _parent_item = parent;
-    _item_data = data;
+  tree_item (const QList<QVariant> &d, tree_item *p = 0) {
+    _parent_item = p;
+    _item_data = d;
   }
 
-  tree_item (QVariant data = QVariant(), tree_item *parent = 0) {
+  tree_item (QVariant d = QVariant(), tree_item *p = 0) {
     QList<QVariant> variantList;
-    variantList << data << QVariant () << QVariant () << QVariant ();
-    _parent_item = parent;
+    variantList << d << QVariant () << QVariant () << QVariant ();
+    _parent_item = p;
     _item_data = variantList;
   }
 
   ~tree_item () {
-     qDeleteAll (_child_items);
+    qDeleteAll (_child_items);
   }
 
   void insert_child_item (int at, tree_item *item) {
@@ -62,8 +62,8 @@
   }
 
   void delete_child_items () {
-      qDeleteAll (_child_items);
-      _child_items.clear ();
+    qDeleteAll (_child_items);
+    _child_items.clear ();
   }
 
   void remove_child (tree_item *item) {
@@ -75,13 +75,13 @@
     return _item_data[column];
   }
 
-  void set_data (int column, QVariant data)
+  void set_data (int column, QVariant d)
   {
-    _item_data[column] = data;
+    _item_data[column] = d;
   }
 
-  tree_item *child (int row) {
-    return _child_items[row];
+  tree_item *child (int r) {
+    return _child_items[r];
   }
 
   int child_count () const {
@@ -112,11 +112,11 @@
 };
 
 class workspace_model
-    : public QAbstractItemModel, public octave_event_observer
+  : public QAbstractItemModel, public octave_event_observer
 {
   Q_OBJECT
 
-public:
+  public:
   workspace_model (QObject *parent = 0);
   ~workspace_model ();
 
@@ -128,7 +128,7 @@
   QVariant headerData (int section, Qt::Orientation orientation,
                        int role = Qt::DisplayRole) const;
   QModelIndex index (int row, int column,
-                    const QModelIndex &parent = QModelIndex ()) const;
+                     const QModelIndex &parent = QModelIndex ()) const;
   QModelIndex parent (const QModelIndex &index) const;
   int rowCount (const QModelIndex &parent = QModelIndex ()) const;
   int columnCount (const QModelIndex &parent = QModelIndex ()) const;
@@ -144,7 +144,7 @@
 
 private:
   /** Timer for periodically updating the workspace model from the current
-    * symbol information. */
+   * symbol information. */
   QTimer _update_workspace_model_timer;
 
   /** Stores the current symbol information. */
--- a/libgui/src/workspace-view.cc	Thu Sep 13 12:32:17 2012 -0400
+++ b/libgui/src/workspace-view.cc	Thu Sep 13 12:32:51 2012 -0400
@@ -30,8 +30,8 @@
 #include <QVBoxLayout>
 #include <QPushButton>
 
-workspace_view::workspace_view (QWidget * parent) : QDockWidget
-  (parent)
+workspace_view::workspace_view (QWidget *p)
+  : QDockWidget (p)
 {
   setObjectName ("WorkspaceView");
   setWindowTitle (tr ("Workspace"));
@@ -51,12 +51,12 @@
   setWidget (new QWidget (this));
 
   // Create a new layout and add widgets to it.
-  QVBoxLayout *layout = new QVBoxLayout ();
-  layout->addWidget (_workspace_tree_view);
-  layout->setMargin (2);
+  QVBoxLayout *vbox_layout = new QVBoxLayout ();
+  vbox_layout->addWidget (_workspace_tree_view);
+  vbox_layout->setMargin (2);
 
   // Set the empty widget to have our layout.
-  widget ()->setLayout (layout);
+  widget ()->setLayout (vbox_layout);
 
   // Initialize collapse/expand state of the workspace subcategories.
 
@@ -160,7 +160,7 @@
   // In order to make collapsing/expanding work again, we need to set
   // flags ourselves here.
   QMap<int, QVariant> item_data
-      = _workspace_model->itemData (index);
+    = _workspace_model->itemData (index);
 
   if (item_data[0] == "Local")
     _explicit_collapse.local = true;
@@ -187,7 +187,7 @@
   // In order to make collapsing/expanding work again, we need to do set
   // flags ourselves here.
   QMap<int, QVariant> item_data
-      = _workspace_model->itemData (index);
+    = _workspace_model->itemData (index);
 
   if (item_data[0] == "Local")
     _explicit_collapse.local = false;
@@ -205,8 +205,8 @@
 }
 
 void
-workspace_view::closeEvent (QCloseEvent *event)
+workspace_view::closeEvent (QCloseEvent *e)
 {
   emit active_changed (false);
-  QDockWidget::closeEvent (event);
+  QDockWidget::closeEvent (e);
 }
--- a/libgui/src/workspace-view.h	Thu Sep 13 12:32:17 2012 -0400
+++ b/libgui/src/workspace-view.h	Thu Sep 13 12:32:51 2012 -0400
@@ -32,7 +32,7 @@
 class workspace_view : public QDockWidget
 {
   Q_OBJECT
-public:
+  public:
   workspace_view (QWidget * parent = 0);
   ~workspace_view ();
 
--- a/libinterp/Makefile.am	Thu Sep 13 12:32:17 2012 -0400
+++ b/libinterp/Makefile.am	Thu Sep 13 12:32:51 2012 -0400
@@ -38,6 +38,10 @@
   -Icorefcn \
   -I$(top_builddir)/libgnu -I$(top_srcdir)/libgnu
 
+AM_CFLAGS += $(WARN_CFLAGS)
+
+AM_CXXFLAGS += $(WARN_CXXFLAGS)
+
 octlib_LTLIBRARIES = liboctinterp.la
 
 ## Order matters here.  Leave builtins.cc last, because it depends on
--- a/libinterp/interp-core/jit-typeinfo.cc	Thu Sep 13 12:32:17 2012 -0400
+++ b/libinterp/interp-core/jit-typeinfo.cc	Thu Sep 13 12:32:51 2012 -0400
@@ -113,10 +113,10 @@
   return obv;
 }
 
-extern "C" void
-octave_jit_grab_matrix (jit_matrix *result, jit_matrix *m)
+extern "C" jit_matrix
+octave_jit_grab_matrix (jit_matrix *m)
 {
-  *result = *m->array;
+  return *m->array;
 }
 
 extern "C" octave_base_value *
@@ -130,12 +130,12 @@
   return rep;
 }
 
-extern "C" void
-octave_jit_cast_matrix_any (jit_matrix *ret, octave_base_value *obv)
+extern "C" jit_matrix
+octave_jit_cast_matrix_any (octave_base_value *obv)
 {
   NDArray m = obv->array_value ();
-  *ret = m;
   obv->release ();
+  return m;
 }
 
 extern "C" octave_base_value *
@@ -148,13 +148,13 @@
 
   return rep;
 }
-extern "C" void
-octave_jit_cast_range_any (jit_range *ret, octave_base_value *obv)
+extern "C" jit_range
+octave_jit_cast_range_any (octave_base_value *obv)
 {
 
   jit_range r (obv->range_value ());
-  *ret = r;
   obv->release ();
+  return r;
 }
 
 extern "C" double
@@ -228,9 +228,9 @@
     }
 }
 
-extern "C" void
-octave_jit_paren_subsasgn_impl (jit_matrix *ret, jit_matrix *mat,
-                                octave_idx_type index, double value)
+extern "C" jit_matrix
+octave_jit_paren_subsasgn_impl (jit_matrix *mat, octave_idx_type index,
+                                double value)
 {
   NDArray *array = mat->array;
   if (array->nelem () < index)
@@ -240,7 +240,7 @@
   data[index - 1] = value;
 
   mat->update ();
-  *ret = *mat;
+  return *mat;
 }
 
 static void
@@ -272,12 +272,12 @@
     }
 }
 
-extern "C" void
-octave_jit_paren_scalar_subsasgn (jit_matrix *ret, jit_matrix *mat,
-                                  double *indices, octave_idx_type idx_count,
-                                  double value)
+extern "C" jit_matrix
+octave_jit_paren_scalar_subsasgn (jit_matrix *mat, double *indices,
+                                  octave_idx_type idx_count, double value)
 {
   // FIXME: Replace this with a more optimal version
+  jit_matrix ret;
   try
     {
       Array<idx_vector> idx;
@@ -286,17 +286,19 @@
       Matrix temp (1, 1);
       temp.xelem(0) = value;
       mat->array->assign (idx, temp);
-      ret->update (mat->array);
+      ret.update (mat->array);
     }
   catch (const octave_execution_exception&)
     {
       gripe_library_execution_error ();
     }
+
+  return ret;
 }
 
-extern "C" void
-octave_jit_paren_subsasgn_matrix_range (jit_matrix *result, jit_matrix *mat,
-                                        jit_range *index, double value)
+extern "C" jit_matrix
+octave_jit_paren_subsasgn_matrix_range (jit_matrix *mat, jit_range *index,
+                                        double value)
 {
   NDArray *array = mat->array;
   bool done = false;
@@ -340,7 +342,9 @@
       array->assign (idx, avalue);
     }
 
-  result->update (array);
+  jit_matrix ret;
+  ret.update (array);
+  return ret;
 }
 
 extern "C" double
@@ -562,6 +566,10 @@
   llvm::FunctionType *ft = llvm::FunctionType::get (rtype, llvm_args, false);
   llvm_function = llvm::Function::Create (ft, llvm::Function::ExternalLinkage,
                                           aname, module);
+
+  if (sret ())
+    llvm_function->addAttribute (1, llvm::Attribute::StructRet);
+
   if (call_conv == jit_convention::internal)
     llvm_function->addFnAttr (llvm::Attribute::AlwaysInline);
 }
@@ -620,12 +628,18 @@
   llvm::SmallVector<llvm::Value *, 10> llvm_args;
   llvm_args.reserve (in_args.size () + sret ());
 
-  llvm::Value *sret_mem = 0;
-  llvm::Value *saved_stack = 0;
+  llvm::BasicBlock *insert_block = builder.GetInsertBlock ();
+  llvm::Function *parent = insert_block->getParent ();
+  assert (parent);
+
+  // we insert allocas inside the prelude block to prevent stack overflows
+  llvm::BasicBlock& prelude = parent->getEntryBlock ();
+  llvm::IRBuilder<> pre_builder (&prelude, prelude.begin ());
+
+  llvm::AllocaInst *sret_mem = 0;
   if (sret ())
     {
-      saved_stack = builder.CreateCall (stacksave);
-      sret_mem = builder.CreateAlloca (mresult->packed_type (call_conv));
+      sret_mem = pre_builder.CreateAlloca (mresult->packed_type (call_conv));
       llvm_args.push_back (sret_mem);
     }
 
@@ -638,19 +652,23 @@
 
       if (args[i]->pointer_arg (call_conv))
         {
-          if (! saved_stack)
-            saved_stack = builder.CreateCall (stacksave);
-
-          arg = builder.CreateAlloca (args[i]->to_llvm ());
-          builder.CreateStore (in_args[i], arg);
+          llvm::Type *ty = args[i]->packed_type (call_conv);
+          llvm::Value *alloca = pre_builder.CreateAlloca (ty);
+          builder.CreateStore (arg, alloca);
+          arg = alloca;
         }
 
       llvm_args.push_back (arg);
     }
 
-  llvm::Value *ret = builder.CreateCall (llvm_function, llvm_args);
-  if (sret_mem)
-    ret = builder.CreateLoad (sret_mem);
+  llvm::CallInst *callinst = builder.CreateCall (llvm_function, llvm_args);
+  llvm::Value *ret = callinst;
+
+  if (sret ())
+    {
+      callinst->addAttribute (1, llvm::Attribute::StructRet);
+      ret = builder.CreateLoad (sret_mem);
+    }
 
   if (mresult)
     {
@@ -659,14 +677,6 @@
         ret = unpack (builder, ret);
     }
 
-  if (saved_stack)
-    {
-      llvm::Function *stackrestore
-        = llvm::Intrinsic::getDeclaration (module,
-                                           llvm::Intrinsic::stackrestore);
-      builder.CreateCall (stackrestore, saved_stack);
-    }
-
   return ret;
 }
 
@@ -691,7 +701,8 @@
 }
 
 void
-jit_function::do_return (llvm::IRBuilderD& builder, llvm::Value *rval)
+jit_function::do_return (llvm::IRBuilderD& builder, llvm::Value *rval,
+                         bool verify)
 {
   assert (! rval == ! mresult);
 
@@ -702,14 +713,18 @@
         rval = convert (builder, rval);
 
       if (sret ())
-        builder.CreateStore (rval, llvm_function->arg_begin ());
+        {
+          builder.CreateStore (rval, llvm_function->arg_begin ());
+          builder.CreateRetVoid ();
+        }
       else
         builder.CreateRet (rval);
     }
   else
     builder.CreateRetVoid ();
 
-  llvm::verifyFunction (*llvm_function);
+  if (verify)
+    llvm::verifyFunction (*llvm_function);
 }
 
 void
@@ -1032,9 +1047,14 @@
 
   // complex_ret is what is passed to C functions in order to get calling
   // convention right
+  llvm::Type *cmplx_inner_cont[] = {scalar_t, scalar_t};
+  llvm::StructType *cmplx_inner = llvm::StructType::create (cmplx_inner_cont);
+
   complex_ret = llvm::StructType::create (context, "complex_ret");
-  llvm::Type *complex_ret_contents[] = {scalar_t, scalar_t};
-  complex_ret->setBody (complex_ret_contents);
+  {
+    llvm::Type *contents[] = {cmplx_inner};
+    complex_ret->setBody (contents);
+  }
 
   // create types
   any = new_type ("any", 0, any_t);
@@ -1059,18 +1079,18 @@
   // specify calling conventions
   // FIXME: We should detect architecture and do something sane based on that
   // here we assume x86 or x86_64
-  matrix->mark_sret ();
-  matrix->mark_pointer_arg ();
+  matrix->mark_sret (jit_convention::external);
+  matrix->mark_pointer_arg (jit_convention::external);
 
-  range->mark_sret ();
-  range->mark_pointer_arg ();
+  range->mark_sret (jit_convention::external);
+  range->mark_pointer_arg (jit_convention::external);
 
   complex->set_pack (jit_convention::external, &jit_typeinfo::pack_complex);
   complex->set_unpack (jit_convention::external, &jit_typeinfo::unpack_complex);
   complex->set_packed_type (jit_convention::external, complex_ret);
 
   if (sizeof (void *) == 4)
-    complex->mark_sret ();
+    complex->mark_sret (jit_convention::external);
 
   paren_subsref_fn.initialize (module, engine);
   paren_subsasgn_fn.initialize (module, engine);
@@ -1333,9 +1353,9 @@
   binary_ops[octave_value::op_div].add_overload (fn);
   binary_ops[octave_value::op_ldiv].add_overload (fn);
 
-  fn = mirror_binary (complex_div);
-  binary_ops[octave_value::op_ldiv].add_overload (fn);
-  binary_ops[octave_value::op_el_ldiv].add_overload (fn);
+  // fn = mirror_binary (complex_div);
+  // binary_ops[octave_value::op_ldiv].add_overload (fn);
+  // binary_ops[octave_value::op_el_ldiv].add_overload (fn);
 
   fn = create_function (jit_convention::external,
                         "octave_jit_pow_complex_complex", complex, complex,
@@ -1990,8 +2010,11 @@
 
   if (! identities[id].valid ())
     {
-      jit_function fn = create_function (jit_convention::internal, "id", type,
-                                         type);
+      std::stringstream name;
+      name << "id_" << type->name ();
+      jit_function fn = create_function (jit_convention::internal, name.str (),
+                                         type, type);
+
       llvm::BasicBlock *body = fn.new_block ();
       builder.SetInsertPoint (body);
       fn.do_return (builder, fn.argument (builder, 0));
@@ -2141,17 +2164,24 @@
   llvm::Value *real = bld.CreateExtractElement (cplx, bld.getInt32 (0));
   llvm::Value *imag = bld.CreateExtractElement (cplx, bld.getInt32 (1));
   llvm::Value *ret = llvm::UndefValue::get (complex_ret);
-  ret = bld.CreateInsertValue (ret, real, 0);
-  return bld.CreateInsertValue (ret, imag, 1);
+
+  unsigned int re_idx[] = {0, 0};
+  unsigned int im_idx[] = {0, 1};
+  ret = bld.CreateInsertValue (ret, real, re_idx);
+  return bld.CreateInsertValue (ret, imag, im_idx);
 }
 
 llvm::Value *
 jit_typeinfo::unpack_complex (llvm::IRBuilderD& bld, llvm::Value *result)
 {
+  unsigned int re_idx[] = {0, 0};
+  unsigned int im_idx[] = {0, 1};
+
   llvm::Type *complex_t = get_complex ()->to_llvm ();
-  llvm::Value *real = bld.CreateExtractValue (result, 0);
-  llvm::Value *imag = bld.CreateExtractValue (result, 1);
+  llvm::Value *real = bld.CreateExtractValue (result, re_idx);
+  llvm::Value *imag = bld.CreateExtractValue (result, im_idx);
   llvm::Value *ret = llvm::UndefValue::get (complex_t);
+
   ret = bld.CreateInsertElement (ret, real, bld.getInt32 (0));
   return bld.CreateInsertElement (ret, imag, bld.getInt32 (1));
 }
--- a/libinterp/interp-core/jit-typeinfo.h	Thu Sep 13 12:32:17 2012 -0400
+++ b/libinterp/interp-core/jit-typeinfo.h	Thu Sep 13 12:32:51 2012 -0400
@@ -66,6 +66,8 @@
 struct
 jit_array
 {
+  jit_array () : array (0) {}
+
   jit_array (T& from) : array (new T (from))
   {
     update ();
@@ -161,7 +163,7 @@
   // retval. (on the stack)
   bool sret (jit_convention::type cc) const { return msret[cc]; }
 
-  void mark_sret (jit_convention::type cc = jit_convention::external)
+  void mark_sret (jit_convention::type cc)
   { msret[cc] = true; }
 
   // A function like: void foo (mytype arg0)
@@ -169,7 +171,7 @@
   // Basically just pass by reference.
   bool pointer_arg (jit_convention::type cc) const { return mpointer_arg[cc]; }
 
-  void mark_pointer_arg (jit_convention::type cc = jit_convention::external)
+  void mark_pointer_arg (jit_convention::type cc)
   { mpointer_arg[cc] = true; }
 
   // Convert into an equivalent form before calling. For example, complex is
@@ -278,7 +280,8 @@
 
   llvm::Value *argument (llvm::IRBuilderD& builder, size_t idx) const;
 
-  void do_return (llvm::IRBuilderD& builder, llvm::Value *rval = 0);
+  void do_return (llvm::IRBuilderD& builder, llvm::Value *rval = 0,
+                  bool verify = true);
 
   llvm::Function *to_llvm (void) const { return llvm_function; }
 
--- a/libinterp/interp-core/mex.cc	Thu Sep 13 12:32:17 2012 -0400
+++ b/libinterp/interp-core/mex.cc	Thu Sep 13 12:32:51 2012 -0400
@@ -3010,7 +3010,7 @@
 
 int
 mexCallMATLAB (int nargout, mxArray *argout[], int nargin,
-               const mxArray *argin[], const char *fname)
+               mxArray *argin[], const char *fname)
 {
   octave_value_list args;
 
--- a/libinterp/interp-core/pt-jit.cc	Thu Sep 13 12:32:17 2012 -0400
+++ b/libinterp/interp-core/pt-jit.cc	Thu Sep 13 12:32:51 2012 -0400
@@ -1075,8 +1075,8 @@
   jit_return *ret = dynamic_cast<jit_return *> (final_block->back ());
   assert (ret);
 
-  jit_function creating = jit_function (module, jit_convention::internal,
-                                        "foobar", ret->result_type (), args);
+  creating = jit_function (module, jit_convention::internal,
+                           "foobar", ret->result_type (), args);
   function = creating.to_llvm ();
 
   try
@@ -1280,10 +1280,16 @@
 jit_convert_llvm::visit (jit_return& ret)
 {
   jit_value *res = ret.result ();
-  if (res)
-    builder.CreateRet (res->to_llvm ());
+
+  if (converting_function)
+    creating.do_return (builder, res->to_llvm (), false);
   else
-    builder.CreateRetVoid ();
+    {
+      if (res)
+        builder.CreateRet (res->to_llvm ());
+      else
+        builder.CreateRetVoid ();
+    }
 }
 
 void
--- a/libinterp/interp-core/pt-jit.h	Thu Sep 13 12:32:17 2012 -0400
+++ b/libinterp/interp-core/pt-jit.h	Thu Sep 13 12:32:51 2012 -0400
@@ -276,6 +276,9 @@
 
   bool converting_function;
 
+  // only used if we are converting a function
+  jit_function creating;
+
   llvm::Function *function;
   llvm::BasicBlock *prelude;
 
--- a/liboctave/Makefile.am	Thu Sep 13 12:32:17 2012 -0400
+++ b/liboctave/Makefile.am	Thu Sep 13 12:32:51 2012 -0400
@@ -36,6 +36,10 @@
   -I$(srcdir)/util \
   -I$(top_builddir)/libgnu -I$(top_srcdir)/libgnu
 
+AM_CFLAGS += $(WARN_CFLAGS)
+
+AM_CXXFLAGS += $(WARN_CXXFLAGS)
+
 octlib_LTLIBRARIES = liboctave.la
 
 EXTRA_DIST =
--- a/liboctave/numeric/CmplxLU.cc	Thu Sep 13 12:32:17 2012 -0400
+++ b/liboctave/numeric/CmplxLU.cc	Thu Sep 13 12:32:51 2012 -0400
@@ -33,8 +33,8 @@
 
 // Instantiate the base LU class for the types we need.
 
-#include <base-lu.h>
-#include <base-lu.cc>
+#include "base-lu.h"
+#include "base-lu.cc"
 
 template class base_lu <ComplexMatrix>;
 
--- a/liboctave/numeric/dbleLU.cc	Thu Sep 13 12:32:17 2012 -0400
+++ b/liboctave/numeric/dbleLU.cc	Thu Sep 13 12:32:51 2012 -0400
@@ -33,8 +33,8 @@
 
 // Instantiate the base LU class for the types we need.
 
-#include <base-lu.h>
-#include <base-lu.cc>
+#include "base-lu.h"
+#include "base-lu.cc"
 
 template class base_lu <Matrix>;
 
--- a/liboctave/numeric/fCmplxLU.cc	Thu Sep 13 12:32:17 2012 -0400
+++ b/liboctave/numeric/fCmplxLU.cc	Thu Sep 13 12:32:51 2012 -0400
@@ -33,8 +33,8 @@
 
 // Instantiate the base LU class for the types we need.
 
-#include <base-lu.h>
-#include <base-lu.cc>
+#include "base-lu.h"
+#include "base-lu.cc"
 
 template class base_lu <FloatComplexMatrix>;
 
--- a/liboctave/numeric/floatLU.cc	Thu Sep 13 12:32:17 2012 -0400
+++ b/liboctave/numeric/floatLU.cc	Thu Sep 13 12:32:51 2012 -0400
@@ -33,8 +33,8 @@
 
 // Instantiate the base LU class for the types we need.
 
-#include <base-lu.h>
-#include <base-lu.cc>
+#include "base-lu.h"
+#include "base-lu.cc"
 
 template class base_lu <FloatMatrix>;
 
--- a/liboctave/util/module.mk	Thu Sep 13 12:32:17 2012 -0400
+++ b/liboctave/util/module.mk	Thu Sep 13 12:32:51 2012 -0400
@@ -54,7 +54,6 @@
   util/cmd-hist.cc \
   util/data-conv.cc \
   util/glob-match.cc \
-  util/kpse.cc \
   util/lo-array-gripes.cc \
   util/lo-ieee.cc \
   util/lo-utils.cc \
@@ -73,7 +72,7 @@
   util/sparse-sort.cc \
   util/sparse-util.cc \
   util/str-vec.cc \
-	$(UTIL_C_SRC)
+  $(UTIL_C_SRC)
 
 TEMPLATE_SRC += \
   util/oct-sort.cc
--- a/m4/acinclude.m4	Thu Sep 13 12:32:17 2012 -0400
+++ b/m4/acinclude.m4	Thu Sep 13 12:32:51 2012 -0400
@@ -1965,164 +1965,3 @@
 
 
 ##############################################################################
-##############################################################################
-
-# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
-# 
-# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# PKG_PROG_PKG_CONFIG([MIN-VERSION])
-# ----------------------------------
-AC_DEFUN([PKG_PROG_PKG_CONFIG],
-[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
-m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
-AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
-if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
-	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
-fi
-if test -n "$PKG_CONFIG"; then
-	_pkg_min_version=m4_default([$1], [0.9.0])
-	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
-	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
-		AC_MSG_RESULT([yes])
-	else
-		AC_MSG_RESULT([no])
-		PKG_CONFIG=""
-	fi
-		
-fi[]dnl
-])# PKG_PROG_PKG_CONFIG
-
-# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
-#
-# Check to see whether a particular set of modules exists.  Similar
-# to PKG_CHECK_MODULES(), but does not set variables or print errors.
-#
-#
-# Similar to PKG_CHECK_MODULES, make sure that the first instance of
-# this or PKG_CHECK_MODULES is called, or make sure to call
-# PKG_CHECK_EXISTS manually
-# --------------------------------------------------------------
-AC_DEFUN([PKG_CHECK_EXISTS],
-[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
-if test -n "$PKG_CONFIG" && \
-    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
-  m4_ifval([$2], [$2], [:])
-m4_ifvaln([$3], [else
-  $3])dnl
-fi])
-
-
-# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
-# ---------------------------------------------
-m4_define([_PKG_CONFIG],
-[if test -n "$PKG_CONFIG"; then
-    if test -n "$$1"; then
-        pkg_cv_[]$1="$$1"
-    else
-        PKG_CHECK_EXISTS([$3],
-                         [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
-			 [pkg_failed=yes])
-    fi
-else
-	pkg_failed=untried
-fi[]dnl
-])# _PKG_CONFIG
-
-# _PKG_SHORT_ERRORS_SUPPORTED
-# -----------------------------
-AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
-[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
-if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
-        _pkg_short_errors_supported=yes
-else
-        _pkg_short_errors_supported=no
-fi[]dnl
-])# _PKG_SHORT_ERRORS_SUPPORTED
-
-
-# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
-# [ACTION-IF-NOT-FOUND])
-#
-#
-# Note that if there is a possibility the first call to
-# PKG_CHECK_MODULES might not happen, you should be sure to include an
-# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
-#
-#
-# --------------------------------------------------------------
-AC_DEFUN([PKG_CHECK_MODULES],
-[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
-AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
-AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
-
-pkg_failed=no
-AC_MSG_CHECKING([for $1])
-
-_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
-_PKG_CONFIG([$1][_LIBS], [libs], [$2])
-
-m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
-and $1[]_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details.])
-
-if test $pkg_failed = yes; then
-        _PKG_SHORT_ERRORS_SUPPORTED
-        if test $_pkg_short_errors_supported = yes; then
-	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"`
-        else 
-	        $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
-        fi
-	# Put the nasty error message in config.log where it belongs
-	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
-
-	ifelse([$4], , [AC_MSG_ERROR(dnl
-[Package requirements ($2) were not met:
-
-$$1_PKG_ERRORS
-
-Consider adjusting the PKG_CONFIG_PATH environment variable if you
-installed software in a non-standard prefix.
-
-_PKG_TEXT
-])],
-		[AC_MSG_RESULT([no])
-                $4])
-elif test $pkg_failed = untried; then
-	ifelse([$4], , [AC_MSG_FAILURE(dnl
-[The pkg-config script could not be found or is too old.  Make sure it
-is in your PATH or set the PKG_CONFIG environment variable to the full
-path to pkg-config.
-
-_PKG_TEXT
-
-To get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
-		[$4])
-else
-	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
-	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
-        AC_MSG_RESULT([yes])
-	ifelse([$3], , :, [$3])
-fi[]dnl
-])# PKG_CHECK_MODULES
-dnl end of pkg.m4
-
--- a/m4/module.mk	Thu Sep 13 12:32:17 2012 -0400
+++ b/m4/module.mk	Thu Sep 13 12:32:51 2012 -0400
@@ -10,4 +10,5 @@
   m4/ltoptions.m4 \
   m4/ltsugar.m4 \
   m4/ltversion.m4 \
-  m4/lt~obsolete.m4
+  m4/lt~obsolete.m4 \
+  m4/pkg.m4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m4/pkg.m4	Thu Sep 13 12:32:51 2012 -0400
@@ -0,0 +1,157 @@
+# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
+# 
+# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# PKG_PROG_PKG_CONFIG([MIN-VERSION])
+# ----------------------------------
+AC_DEFUN([PKG_PROG_PKG_CONFIG],
+[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
+m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
+AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
+fi
+if test -n "$PKG_CONFIG"; then
+	_pkg_min_version=m4_default([$1], [0.9.0])
+	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
+	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+		AC_MSG_RESULT([yes])
+	else
+		AC_MSG_RESULT([no])
+		PKG_CONFIG=""
+	fi
+		
+fi[]dnl
+])# PKG_PROG_PKG_CONFIG
+
+# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+#
+# Check to see whether a particular set of modules exists.  Similar
+# to PKG_CHECK_MODULES(), but does not set variables or print errors.
+#
+#
+# Similar to PKG_CHECK_MODULES, make sure that the first instance of
+# this or PKG_CHECK_MODULES is called, or make sure to call
+# PKG_CHECK_EXISTS manually
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_EXISTS],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+if test -n "$PKG_CONFIG" && \
+    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
+  m4_ifval([$2], [$2], [:])
+m4_ifvaln([$3], [else
+  $3])dnl
+fi])
+
+
+# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
+# ---------------------------------------------
+m4_define([_PKG_CONFIG],
+[if test -n "$PKG_CONFIG"; then
+    if test -n "$$1"; then
+        pkg_cv_[]$1="$$1"
+    else
+        PKG_CHECK_EXISTS([$3],
+                         [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
+			 [pkg_failed=yes])
+    fi
+else
+	pkg_failed=untried
+fi[]dnl
+])# _PKG_CONFIG
+
+# _PKG_SHORT_ERRORS_SUPPORTED
+# -----------------------------
+AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi[]dnl
+])# _PKG_SHORT_ERRORS_SUPPORTED
+
+
+# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+# [ACTION-IF-NOT-FOUND])
+#
+#
+# Note that if there is a possibility the first call to
+# PKG_CHECK_MODULES might not happen, you should be sure to include an
+# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
+#
+#
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_MODULES],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
+AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
+
+pkg_failed=no
+AC_MSG_CHECKING([for $1])
+
+_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
+_PKG_CONFIG([$1][_LIBS], [libs], [$2])
+
+m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
+and $1[]_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.])
+
+if test $pkg_failed = yes; then
+        _PKG_SHORT_ERRORS_SUPPORTED
+        if test $_pkg_short_errors_supported = yes; then
+	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"`
+        else 
+	        $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
+        fi
+	# Put the nasty error message in config.log where it belongs
+	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
+
+	ifelse([$4], , [AC_MSG_ERROR(dnl
+[Package requirements ($2) were not met:
+
+$$1_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+_PKG_TEXT
+])],
+		[AC_MSG_RESULT([no])
+                $4])
+elif test $pkg_failed = untried; then
+	ifelse([$4], , [AC_MSG_FAILURE(dnl
+[The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+_PKG_TEXT
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
+		[$4])
+else
+	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
+	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
+        AC_MSG_RESULT([yes])
+	ifelse([$3], , :, [$3])
+fi[]dnl
+])# PKG_CHECK_MODULES
--- a/src/Makefile.am	Thu Sep 13 12:32:17 2012 -0400
+++ b/src/Makefile.am	Thu Sep 13 12:32:51 2012 -0400
@@ -30,6 +30,10 @@
   -I$(top_builddir)/libinterp/interpfcn \
   -I$(top_builddir)/libgnu -I$(top_srcdir)/libgnu
 
+AM_CFLAGS += $(WARN_CFLAGS)
+
+AM_CXXFLAGS += $(WARN_CXXFLAGS)
+
 OCTAVE_BINARIES = \
   octave \
   octave-cli
@@ -73,7 +77,7 @@
   $(top_builddir)/libinterp/liboctinterp.la \
   $(top_builddir)/liboctave/liboctave.la
 
-include ../libgui/src/link-deps.mk
+include ../libgui/link-deps.mk
 
 octave_cli_SOURCES = main-cli.cc
 
@@ -87,7 +91,7 @@
 
 if AMCOND_BUILD_GUI
   octave_SOURCES = main.cc
-  OCTAVE_GUI_LIBS = $(top_builddir)/libgui/src/liboctgui.la
+  OCTAVE_GUI_LIBS = $(top_builddir)/libgui/liboctgui.la
   OCTAVE_GUI_CPPFLAGS = -I$(top_srcdir)/libgui/src
 else
   octave_SOURCES = main-cli.cc