Commit 500dce5f authored by Stefan Monnier's avatar Stefan Monnier

* lisp/emacs-lisp/smie.el (smie--hanging-eolp-function): New var.

(smie-indent--hanging-p): Use it.
* lisp/progmodes/sh-script.el (sh-set-shell): Set it.

Fixes: debbugs:17621
parent 2c25d5e6
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
......
......@@ -1155,6 +1155,15 @@ NUMBER offset by NUMBER, relative to a base token
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\".
......@@ -1168,10 +1177,7 @@ the beginning of a line."
(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)
......
......@@ -2279,6 +2279,11 @@ Calls the value of `sh-set-shell-hook' if set."
(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")
......
......@@ -510,8 +510,8 @@ The relevant features are:
;; 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
......
......@@ -25,7 +25,11 @@ esac
{ # bug#17621
foo1 &&
foo2 &&
foo2 &&
bar
foo1 && \
foo2 && \
bar
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment