(smie-indent--hanging-p): Use it.
* lisp/progmodes/sh-script.el (sh-set-shell): Set it.
Fixes: debbugs:17621
+2014-06-20 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * emacs-lisp/smie.el (smie--hanging-eolp-function): New var.
+ (smie-indent--hanging-p): Use it.
+ * progmodes/sh-script.el (sh-set-shell): Set it (bug#17621).
+
2014-06-20 Leo Liu <sdl.web@gmail.com>
* simple.el (read-quoted-char): Don't let help chars pop up help
The functions whose name starts with \"smie-rule-\" are helper functions
designed specifically for use in this function.")
+(defvar smie--hanging-eolp-function
+ ;; FIXME: This is a quick hack for 24.4. Don't document it and replace with
+ ;; a well-defined function with a cleaner interface instead!
+ (lambda ()
+ (skip-chars-forward " \t")
+ (or (eolp)
+ (and ;; (looking-at comment-start-skip) ;(bug#16041).
+ (forward-comment (point-max))))))
+
(defalias 'smie-rule-hanging-p 'smie-indent--hanging-p)
(defun smie-indent--hanging-p ()
"Return non-nil if the current token is \"hanging\".
(not (eobp))
;; Could be an open-paren.
(forward-char 1))
- (skip-chars-forward " \t")
- (or (eolp)
- (and ;; (looking-at comment-start-skip) ;(bug#16041).
- (forward-comment (point-max))))
+ (funcall smie--hanging-eolp-function)
(point))))))
(defalias 'smie-rule-bolp 'smie-indent--bolp)
(let ((mksym (lambda (name)
(intern (format "sh-smie-%s-%s"
sh-indent-supported-here name)))))
+ (add-function :around (local 'smie--hanging-eolp-function)
+ (lambda (orig)
+ (if (looking-at "[ \t]*\\\\\n")
+ (goto-char (match-end 0))
+ (funcall orig))))
(smie-setup (symbol-value (funcall mksym "grammar"))
(funcall mksym "rules")
:forward-token (funcall mksym "forward-token")
;; Gnome terminal 2.32.1 reports 1;2802;0
(setq version 200))
(when (equal (match-string 1 str) "83")
- ;; OSX's Terminal.app (version 2.3 (309), which returns 83;40003;0)
- ;; seems to also lack support for some of these (bug#17607).
+ ;; `screen' (which returns 83;40003;0) seems to also lack support for
+ ;; some of these (bug#17607).
(setq version 240))
;; If version is 242 or higher, assume the xterm supports
;; reporting the background color (TODO: maybe earlier
{ # bug#17621
foo1 &&
- foo2 &&
+ foo2 &&
+ bar
+
+ foo1 && \
+ foo2 && \
bar
}