diff options
| author | Joakim Verona | 2013-05-02 08:30:51 +0200 |
|---|---|---|
| committer | Joakim Verona | 2013-05-02 08:30:51 +0200 |
| commit | 8d5d86c8d2f660bc35d0a97142ca24a18aa9a6d4 (patch) | |
| tree | 8a2b21c1a6c3a8a8a930b51702af5a663e3808d3 /lisp/progmodes | |
| parent | f100923315d807801cf7e4411a387ad68ead1f0f (diff) | |
| parent | 0922c475915b41089fffab68f7012a530fe456e1 (diff) | |
| download | emacs-8d5d86c8d2f660bc35d0a97142ca24a18aa9a6d4.tar.gz emacs-8d5d86c8d2f660bc35d0a97142ca24a18aa9a6d4.zip | |
auto upstream
Diffstat (limited to 'lisp/progmodes')
| -rw-r--r-- | lisp/progmodes/octave.el | 37 |
1 files changed, 10 insertions, 27 deletions
diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el index 9e4de4c207f..4b02645e463 100644 --- a/lisp/progmodes/octave.el +++ b/lisp/progmodes/octave.el | |||
| @@ -34,6 +34,14 @@ | |||
| 34 | ;;; Code: | 34 | ;;; Code: |
| 35 | (require 'comint) | 35 | (require 'comint) |
| 36 | 36 | ||
| 37 | ;;; For emacs < 24.3. | ||
| 38 | (require 'newcomment) | ||
| 39 | (eval-when-compile | ||
| 40 | (unless (fboundp 'setq-local) | ||
| 41 | (defmacro setq-local (var val) | ||
| 42 | "Set variable VAR to value VAL in current buffer." | ||
| 43 | (list 'set (list 'make-local-variable (list 'quote var)) val)))) | ||
| 44 | |||
| 37 | (defgroup octave nil | 45 | (defgroup octave nil |
| 38 | "Editing Octave code." | 46 | "Editing Octave code." |
| 39 | :link '(custom-group-link :tag "Font Lock Faces group" font-lock-faces) | 47 | :link '(custom-group-link :tag "Font Lock Faces group" font-lock-faces) |
| @@ -589,17 +597,6 @@ mode, set this to (\"-q\" \"--traditional\")." | |||
| 589 | ;; Could certainly do more font locking in inferior Octave ... | 597 | ;; Could certainly do more font locking in inferior Octave ... |
| 590 | "Additional expressions to highlight in Inferior Octave mode.") | 598 | "Additional expressions to highlight in Inferior Octave mode.") |
| 591 | 599 | ||
| 592 | |||
| 593 | ;;; Compatibility functions | ||
| 594 | (if (not (fboundp 'comint-line-beginning-position)) | ||
| 595 | ;; comint-line-beginning-position is defined in Emacs 21 | ||
| 596 | (defun comint-line-beginning-position () | ||
| 597 | "Returns the buffer position of the beginning of the line, after any prompt. | ||
| 598 | The prompt is assumed to be any text at the beginning of the line matching | ||
| 599 | the regular expression `comint-prompt-regexp', a buffer local variable." | ||
| 600 | (save-excursion (comint-bol nil) (point)))) | ||
| 601 | |||
| 602 | |||
| 603 | (defvar inferior-octave-output-list nil) | 600 | (defvar inferior-octave-output-list nil) |
| 604 | (defvar inferior-octave-output-string nil) | 601 | (defvar inferior-octave-output-string nil) |
| 605 | (defvar inferior-octave-receive-in-progress nil) | 602 | (defvar inferior-octave-receive-in-progress nil) |
| @@ -607,9 +604,6 @@ the regular expression `comint-prompt-regexp', a buffer local variable." | |||
| 607 | (define-obsolete-variable-alias 'inferior-octave-startup-hook | 604 | (define-obsolete-variable-alias 'inferior-octave-startup-hook |
| 608 | 'inferior-octave-mode-hook "24.4") | 605 | 'inferior-octave-mode-hook "24.4") |
| 609 | 606 | ||
| 610 | (defvar inferior-octave-has-built-in-variables nil | ||
| 611 | "Non-nil means that Octave has built-in variables.") | ||
| 612 | |||
| 613 | (defvar inferior-octave-dynamic-complete-functions | 607 | (defvar inferior-octave-dynamic-complete-functions |
| 614 | '(inferior-octave-completion-at-point comint-filename-completion) | 608 | '(inferior-octave-completion-at-point comint-filename-completion) |
| 615 | "List of functions called to perform completion for inferior Octave. | 609 | "List of functions called to perform completion for inferior Octave. |
| @@ -701,20 +695,11 @@ startup file, `~/.emacs-octave'." | |||
| 701 | 'identity inferior-octave-output-list "\n") | 695 | 'identity inferior-octave-output-list "\n") |
| 702 | "\n")))) | 696 | "\n")))) |
| 703 | 697 | ||
| 704 | ;; Find out whether Octave has built-in variables. | ||
| 705 | (inferior-octave-send-list-and-digest | ||
| 706 | (list "exist \"LOADPATH\"\n")) | ||
| 707 | (setq inferior-octave-has-built-in-variables | ||
| 708 | (string-match "101$" (car inferior-octave-output-list))) | ||
| 709 | |||
| 710 | ;; An empty secondary prompt, as e.g. obtained by '--braindead', | 698 | ;; An empty secondary prompt, as e.g. obtained by '--braindead', |
| 711 | ;; means trouble. | 699 | ;; means trouble. |
| 712 | (inferior-octave-send-list-and-digest (list "PS2\n")) | 700 | (inferior-octave-send-list-and-digest (list "PS2\n")) |
| 713 | (if (string-match "\\(PS2\\|ans\\) = *$" (car inferior-octave-output-list)) | 701 | (if (string-match "\\(PS2\\|ans\\) = *$" (car inferior-octave-output-list)) |
| 714 | (inferior-octave-send-list-and-digest | 702 | (inferior-octave-send-list-and-digest (list "PS2 (\"> \");\n"))) |
| 715 | (list (if inferior-octave-has-built-in-variables | ||
| 716 | "PS2 = \"> \"\n" | ||
| 717 | "PS2 (\"> \");\n")))) | ||
| 718 | 703 | ||
| 719 | ;; O.k., now we are ready for the Inferior Octave startup commands. | 704 | ;; O.k., now we are ready for the Inferior Octave startup commands. |
| 720 | (let* (commands | 705 | (let* (commands |
| @@ -725,9 +710,7 @@ startup file, `~/.emacs-octave'." | |||
| 725 | (list "more off;\n" | 710 | (list "more off;\n" |
| 726 | (if (not (string-equal | 711 | (if (not (string-equal |
| 727 | inferior-octave-output-string ">> ")) | 712 | inferior-octave-output-string ">> ")) |
| 728 | (if inferior-octave-has-built-in-variables | 713 | "PS1 (\"\\\\s> \");\n") |
| 729 | "PS1=\"\\\\s> \";\n" | ||
| 730 | "PS1 (\"\\\\s> \");\n")) | ||
| 731 | (if (file-exists-p file) | 714 | (if (file-exists-p file) |
| 732 | (format "source (\"%s\");\n" file)))) | 715 | (format "source (\"%s\");\n" file)))) |
| 733 | (inferior-octave-send-list-and-digest commands)) | 716 | (inferior-octave-send-list-and-digest commands)) |