X-Git-Url: http://git.hcoop.net/bpt/emacs.git/blobdiff_plain/08b3caa982199bd7939d9d6877203ada5d0083b5..77ab81d0545e980c57c0a35510ade29a9e43b4cd:/lisp/progmodes/octave-inf.el diff --git a/lisp/progmodes/octave-inf.el b/lisp/progmodes/octave-inf.el index cfb70b5939..efb1682688 100644 --- a/lisp/progmodes/octave-inf.el +++ b/lisp/progmodes/octave-inf.el @@ -1,12 +1,13 @@ ;;; octave-inf.el --- running Octave as an inferior Emacs process -;; Copyright (C) 1997, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 +;; Copyright (C) 1997, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 ;; Free Software Foundation, Inc. ;; Author: Kurt Hornik ;; Author: John Eaton ;; Maintainer: Kurt Hornik ;; Keywords: languages +;; Package: octave-mod ;; This file is part of GNU Emacs. @@ -120,34 +121,24 @@ the regular expression `comint-prompt-regexp', a buffer local variable." This variable is used to initialize `comint-dynamic-complete-functions' in the Inferior Octave buffer.") -(defun inferior-octave-mode () +(define-derived-mode inferior-octave-mode comint-mode "Inferior Octave" "Major mode for interacting with an inferior Octave process. Runs Octave as a subprocess of Emacs, with Octave I/O through an Emacs buffer. Entry to this mode successively runs the hooks `comint-mode-hook' and `inferior-octave-mode-hook'." - (interactive) - (delay-mode-hooks (comint-mode)) (setq comint-prompt-regexp inferior-octave-prompt - major-mode 'inferior-octave-mode - mode-name "Inferior Octave" mode-line-process '(":%s") local-abbrev-table octave-abbrev-table) - (use-local-map inferior-octave-mode-map) - (set-syntax-table inferior-octave-mode-syntax-table) - (make-local-variable 'comment-start) - (setq comment-start octave-comment-start) - (make-local-variable 'comment-end) - (setq comment-end "") - (make-local-variable 'comment-column) - (setq comment-column 32) - (make-local-variable 'comment-start-skip) - (setq comment-start-skip octave-comment-start-skip) + (set (make-local-variable 'comment-start) octave-comment-start) + (set (make-local-variable 'comment-end) "") + (set (make-local-variable 'comment-column) 32) + (set (make-local-variable 'comment-start-skip) octave-comment-start-skip) - (make-local-variable 'font-lock-defaults) - (setq font-lock-defaults '(inferior-octave-font-lock-keywords nil nil)) + (set (make-local-variable 'font-lock-defaults) + '(inferior-octave-font-lock-keywords nil nil)) (setq comint-input-ring-file-name (or (getenv "OCTAVE_HISTFILE") "~/.octave_hist") @@ -156,9 +147,7 @@ Entry to this mode successively runs the hooks `comint-mode-hook' and inferior-octave-dynamic-complete-functions) (add-hook 'comint-input-filter-functions 'inferior-octave-directory-tracker nil t) - (comint-read-input-ring t) - - (run-mode-hooks 'inferior-octave-mode-hook)) + (comint-read-input-ring t)) ;;;###autoload (defun inferior-octave (&optional arg) @@ -178,8 +167,7 @@ startup file, `~/.emacs-octave'." (get-buffer-create buffer) (if (comint-check-proc buffer) () - (save-excursion - (set-buffer buffer) + (with-current-buffer buffer (comint-mode) (inferior-octave-startup) (inferior-octave-mode)))