+2013-11-08 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * progmodes/sh-script.el (sh-smie--sh-keyword-in-p): Don't inf-loop
+ at bobp (bug#15826).
+ (sh-smie--sh-keyword-in-p): Recognize keywords at bobp.
+
2013-11-08 Darren Hoo <darren.hoo@gmail.com>
* man.el (Man-start-calling): New macro, extracted from
like a keyword, then it is a keyword."
(let ((prev (funcall smie-backward-token-function)))
(if (zerop (length prev))
- (looking-back "\\s(" (1- (point)))
+ (looking-back "\\`\\|\\s(" (1- (point)))
(assoc prev smie-grammar))))
(defun sh-smie--newline-semi-p (&optional tok)
(setq prev (funcall smie-backward-token-function))
(cond
((zerop (length prev))
- (if newline
- (progn (cl-assert words) (setq res 'word))
+ (cond
+ (newline (cl-assert words) (setq res 'word))
+ ((bobp) (setq res 'word))
+ (t
(setq words t)
(condition-case nil
(forward-sexp -1)
- (scan-error (setq res 'unknown)))))
+ (scan-error (setq res 'unknown))))))
((equal prev ";")
(if words (setq newline t)
(setq res 'keyword)))