]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix infinite loop in sh-script's SMIE code
authorTassilo Horn <tsdh@gnu.org>
Mon, 26 Oct 2015 07:01:18 +0000 (08:01 +0100)
committerTassilo Horn <tsdh@gnu.org>
Mon, 26 Oct 2015 07:01:18 +0000 (08:01 +0100)
* lisp/progmodes/sh-script.el (sh-smie-sh-forward-token): Fix infinite
loop (bug#21747).

lisp/progmodes/sh-script.el

index fbb4a90db4091f36f4a985ce0beaddb19f58c28c..baed27bb1388b2cbac4977d287bcc9d2b572f622 100644 (file)
@@ -1920,10 +1920,11 @@ Does not preserve point."
             ;; Pretend the here-document is a "newline representing a
             ;; semi-colon", since the here-doc otherwise covers the newline(s).
             ";")
-        (let ((semi (sh-smie--newline-semi-p)))
-          (forward-line 1)
-          (if (or semi (eobp)) ";"
-            (sh-smie-sh-forward-token))))
+        (unless (eobp)
+          (let ((semi (sh-smie--newline-semi-p)))
+            (forward-line 1)
+            (if (or semi (eobp)) ";"
+              (sh-smie-sh-forward-token)))))
     (forward-comment (point-max))
     (cond
      ((looking-at "\\\\\n") (forward-line 1) (sh-smie-sh-forward-token))