* lisp/progmodes/octave.el (octave-smie-forward-token): Be more careful
authorStefan Monnier <monnier@iro.umontreal.ca>
Tue, 7 May 2013 04:05:43 +0000 (00:05 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Tue, 7 May 2013 04:05:43 +0000 (00:05 -0400)
about implicit semi-colons.

Fixes: debbugs:14218

lisp/ChangeLog
lisp/progmodes/octave.el

index 676e428..a6eed51 100644 (file)
@@ -1,3 +1,8 @@
+2013-05-07  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * progmodes/octave.el (octave-smie-forward-token): Be more careful
+       about implicit semi-colons (bug#14218).
+
 2013-05-07  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
 
        * frame.el (display-monitor-attributes-list)
index ebefcef..7e14e59 100644 (file)
@@ -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))