Mercurial > emacs
diff lisp/progmodes/octave-inf.el @ 88155:d7ddb3e565de
sync with trunk
author | Henrik Enberg <henrik.enberg@telia.com> |
---|---|
date | Mon, 16 Jan 2006 00:03:54 +0000 |
parents | 0d8b17d428b5 |
children |
line wrap: on
line diff
--- a/lisp/progmodes/octave-inf.el Sun Jan 15 23:02:10 2006 +0000 +++ b/lisp/progmodes/octave-inf.el Mon Jan 16 00:03:54 2006 +0000 @@ -1,10 +1,11 @@ ;;; octave-inf.el --- running Octave as an inferior Emacs process -;; Copyright (C) 1997 Free Software Foundation, Inc. +;; Copyright (C) 1997, 2001, 2002, 2003, 2004, 2005 +;; Free Software Foundation, Inc. -;; Author: Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at> +;; Author: Kurt Hornik <Kurt.Hornik@wu-wien.ac.at> ;; Author: John Eaton <jwe@bevo.che.wisc.edu> -;; Maintainer: Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at> +;; Maintainer: Kurt Hornik <Kurt.Hornik@wu-wien.ac.at> ;; Keywords: languages ;; This file is part of GNU Emacs. @@ -21,8 +22,8 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. ;;; Commentary: @@ -41,7 +42,7 @@ :group 'octave-inferior) (defcustom inferior-octave-prompt - "\\(^octave\\(\\|.bin\\)\\(:[0-9]+\\)?\\|^debug\\|^\\)>+ " + "\\(^octave\\(\\|.bin\\)\\(-[.0-9]+\\)?\\(:[0-9]+\\)?\\|^debug\\|^\\)>+ " "*Regexp to match prompts for the inferior Octave process." :type 'regexp :group 'octave-inferior) @@ -129,7 +130,7 @@ Entry to this mode successively runs the hooks `comint-mode-hook' and `inferior-octave-mode-hook'." (interactive) - (comint-mode) + (delay-mode-hooks (comint-mode)) (setq comint-prompt-regexp inferior-octave-prompt major-mode 'inferior-octave-mode mode-name "Inferior Octave" @@ -158,7 +159,7 @@ inferior-octave-dynamic-complete-functions) (comint-read-input-ring t) - (run-hooks 'inferior-octave-mode-hook)) + (run-mode-hooks 'inferior-octave-mode-hook)) ;;;###autoload (defun inferior-octave (&optional arg) @@ -219,6 +220,13 @@ (concat (mapconcat 'identity inferior-octave-output-list "\n") "\n")))) + + ;; An empty secondary prompt, as e.g. obtained by '--braindead', + ;; means trouble. + (inferior-octave-send-list-and-digest (list "PS2\n")) + (if (string-match "^PS2 = *$" (car inferior-octave-output-list)) + (inferior-octave-send-list-and-digest (list "PS2 = \"> \"\n"))) + ;; O.k., now we are ready for the Inferior Octave startup commands. (let* (commands (program (file-name-nondirectory inferior-octave-program)) @@ -247,7 +255,11 @@ ;; And finally, everything is back to normal. (set-process-filter proc 'inferior-octave-output-filter) - (run-hooks 'inferior-octave-startup-hook))) + (run-hooks 'inferior-octave-startup-hook) + (run-hooks 'inferior-octave-startup-hook) + ;; Just in case, to be sure a cd in the startup file + ;; won't have detrimental effects. + (inferior-octave-resync-dirs))) (defun inferior-octave-complete () @@ -382,4 +394,5 @@ (provide 'octave-inf) +;;; arch-tag: bdce0395-24d1-4bb4-bfba-6fb1eeb1a660 ;;; octave-inf.el ends here