Mercurial > hg > octave-nkf
changeset 2788:d21505cbcc58
[project @ 1997-03-04 18:20:51 by jwe]
author | jwe |
---|---|
date | Tue, 04 Mar 1997 18:20:52 +0000 |
parents | 650ab15f8954 |
children | e68dcf8ffd33 |
files | ChangeLog emacs/octave-mod.el |
diffstat | 2 files changed, 24 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Tue Mar 4 12:19:24 1997 John W. Eaton <jwe@bevo.che.wisc.edu> + + * emacs/octave-mod.el: Update from Kurt Hornik to handle switch + statement. + Mon Mar 3 15:44:42 1997 John W. Eaton <jwe@bevo.che.wisc.edu> * dlfcn/Makefile.in (DISTFILES): Add ftp-site.
--- a/emacs/octave-mod.el +++ b/emacs/octave-mod.el @@ -100,7 +100,9 @@ "end_unwind_protect" "endwhile")) (defvar octave-reserved-words - (append octave-begin-keywords octave-else-keywords octave-end-keywords + (append octave-begin-keywords + octave-else-keywords + octave-end-keywords '("all_va_args" "break" "continue" "global" "gplot" "gsplot" "replot" "return")) "Reserved words in Octave.") @@ -323,7 +325,7 @@ '(("for" . ("end" "endfor")) ("function" . ("end" "endfunction")) ("if" . ("else" "elseif" "end" "endif")) - ("switch" . ("end" "endswitch")) + ("switch" . ("case" "end" "endswitch" "otherwise")) ("try" . ("catch" "end" "end_try_catch")) ("unwind_protect" . ("unwind_protect_cleanup" "end" "end_unwind_protect")) @@ -623,6 +625,8 @@ (while (< (point) eol) (if (octave-not-in-string-or-comment-p) (cond + ((looking-at "\\<switch\\>") + (setq icol (+ icol (* 2 octave-block-offset)))) ((looking-at octave-block-begin-regexp) (setq icol (+ icol octave-block-offset))) ((looking-at octave-block-else-regexp) @@ -630,30 +634,39 @@ (setq icol (+ icol octave-block-offset)))) ((looking-at octave-block-end-regexp) (if (not (= bot (point))) - (setq icol (- icol octave-block-offset)))))) + (setq icol (- icol + (octave-block-end-offset))))))) (forward-char))) (if is-continuation-line (setq icol (+ icol octave-continuation-offset))))))) (save-excursion (back-to-indentation) (cond - ((and (or (looking-at octave-block-else-regexp) - (looking-at octave-block-end-regexp)) + ((and (looking-at octave-block-else-regexp) (octave-not-in-string-or-comment-p)) (setq icol (- icol octave-block-offset))) + ((and (looking-at octave-block-end-regexp) + (octave-not-in-string-or-comment-p)) + (setq icol (- icol (octave-block-end-offset)))) ((looking-at "\\s<\\s<\\s<\\S<") (setq icol (list 0 icol))) ((looking-at "\\s<\\S<") (setq icol (list comment-column icol))))) icol)) +(defun octave-block-end-offset () + (save-excursion + (octave-backward-up-block 1) + (* octave-block-offset + (if (string-match (match-string 0) "switch") 2 1)))) + (defun octave-comment-indent () (if (looking-at "\\s<\\s<\\s<") 0 (if (looking-at "\\s<\\s<") (calculate-octave-indent) (skip-syntax-backward " ") - (max (if (bolp) 0 (+ (current-column))) + (max (if (bolp) 0 (+ 1 (current-column))) comment-column)))) (defun octave-indent-for-comment ()