From: Stefan Monnier Date: Tue, 7 May 2013 04:05:43 +0000 (-0400) Subject: * lisp/progmodes/octave.el (octave-smie-forward-token): Be more careful X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~2026^2~273 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=ceb57e59976a540dd38b1122507b75af31a103c3;p=emacs.git * lisp/progmodes/octave.el (octave-smie-forward-token): Be more careful about implicit semi-colons. Fixes: debbugs:14218 --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 676e4286395..a6eed51b9b5 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2013-05-07 Stefan Monnier + + * progmodes/octave.el (octave-smie-forward-token): Be more careful + about implicit semi-colons (bug#14218). + 2013-05-07 YAMAMOTO Mitsuharu * frame.el (display-monitor-attributes-list) diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el index ebefcef0c71..7e14e59af5f 100644 --- a/lisp/progmodes/octave.el +++ b/lisp/progmodes/octave.el @@ -370,16 +370,18 @@ Non-nil means always go to the next Octave code line after sending." (goto-char (match-end 1)) (forward-comment 1)) (cond - ((and (looking-at "$\\|[%#]") - ;; Ignore it if it's within parentheses or if the newline does not end - ;; some preceding text. - (prog1 (and (not (smie-rule-bolp)) - (let ((ppss (syntax-ppss))) - (not (and (nth 1 ppss) - (eq ?\( (char-after (nth 1 ppss))))))) - (forward-comment (point-max)))) + ((and (looking-at "[%#\n]") + (not (or (save-excursion (skip-chars-backward " \t") + ;; Only add implicit ; when needed. + (or (bolp) (eq (char-before ?\;)))) + ;; Ignore it if it's within parentheses. + (let ((ppss (syntax-ppss))) + (and (nth 1 ppss) + (eq ?\( (char-after (nth 1 ppss)))))))) + (if (eolp) (forward-char 1) (forward-comment 1)) ;; Why bother distinguishing \n and ;? ";") ;;"\n" + ((progn (forward-comment (point-max)) nil)) ((looking-at ";[ \t]*\\($\\|[%#]\\)") ;; Combine the ; with the subsequent \n. (goto-char (match-beginning 1))