aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2014-06-19 21:05:40 -0400
committerStefan Monnier2014-06-19 21:05:40 -0400
commit500dce5f4d2a08570177d9b1019fa922f07e8508 (patch)
tree4e36479096a23e12e7855610aebd8dd8f5f89f5a
parent2c25d5e6216d556a85f9c01bba5671f41637e11f (diff)
downloademacs-500dce5f4d2a08570177d9b1019fa922f07e8508.tar.gz
emacs-500dce5f4d2a08570177d9b1019fa922f07e8508.zip
* 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
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/emacs-lisp/smie.el14
-rw-r--r--lisp/progmodes/sh-script.el5
-rw-r--r--lisp/term/xterm.el4
-rwxr-xr-xtest/indent/shell.sh6
5 files changed, 28 insertions, 7 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 51c7332a9a9..7fdc6478979 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12014-06-20 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * emacs-lisp/smie.el (smie--hanging-eolp-function): New var.
4 (smie-indent--hanging-p): Use it.
5 * progmodes/sh-script.el (sh-set-shell): Set it (bug#17621).
6
12014-06-20 Leo Liu <sdl.web@gmail.com> 72014-06-20 Leo Liu <sdl.web@gmail.com>
2 8
3 * simple.el (read-quoted-char): Don't let help chars pop up help 9 * simple.el (read-quoted-char): Don't let help chars pop up help
diff --git a/lisp/emacs-lisp/smie.el b/lisp/emacs-lisp/smie.el
index 3e40d37aacf..1a6011e712a 100644
--- a/lisp/emacs-lisp/smie.el
+++ b/lisp/emacs-lisp/smie.el
@@ -1155,6 +1155,15 @@ NUMBER offset by NUMBER, relative to a base token
1155The functions whose name starts with \"smie-rule-\" are helper functions 1155The functions whose name starts with \"smie-rule-\" are helper functions
1156designed specifically for use in this function.") 1156designed specifically for use in this function.")
1157 1157
1158(defvar smie--hanging-eolp-function
1159 ;; FIXME: This is a quick hack for 24.4. Don't document it and replace with
1160 ;; a well-defined function with a cleaner interface instead!
1161 (lambda ()
1162 (skip-chars-forward " \t")
1163 (or (eolp)
1164 (and ;; (looking-at comment-start-skip) ;(bug#16041).
1165 (forward-comment (point-max))))))
1166
1158(defalias 'smie-rule-hanging-p 'smie-indent--hanging-p) 1167(defalias 'smie-rule-hanging-p 'smie-indent--hanging-p)
1159(defun smie-indent--hanging-p () 1168(defun smie-indent--hanging-p ()
1160 "Return non-nil if the current token is \"hanging\". 1169 "Return non-nil if the current token is \"hanging\".
@@ -1168,10 +1177,7 @@ the beginning of a line."
1168 (not (eobp)) 1177 (not (eobp))
1169 ;; Could be an open-paren. 1178 ;; Could be an open-paren.
1170 (forward-char 1)) 1179 (forward-char 1))
1171 (skip-chars-forward " \t") 1180 (funcall smie--hanging-eolp-function)
1172 (or (eolp)
1173 (and ;; (looking-at comment-start-skip) ;(bug#16041).
1174 (forward-comment (point-max))))
1175 (point)))))) 1181 (point))))))
1176 1182
1177(defalias 'smie-rule-bolp 'smie-indent--bolp) 1183(defalias 'smie-rule-bolp 'smie-indent--bolp)
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index c407ba24e20..f248494eed1 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -2279,6 +2279,11 @@ Calls the value of `sh-set-shell-hook' if set."
2279 (let ((mksym (lambda (name) 2279 (let ((mksym (lambda (name)
2280 (intern (format "sh-smie-%s-%s" 2280 (intern (format "sh-smie-%s-%s"
2281 sh-indent-supported-here name))))) 2281 sh-indent-supported-here name)))))
2282 (add-function :around (local 'smie--hanging-eolp-function)
2283 (lambda (orig)
2284 (if (looking-at "[ \t]*\\\\\n")
2285 (goto-char (match-end 0))
2286 (funcall orig))))
2282 (smie-setup (symbol-value (funcall mksym "grammar")) 2287 (smie-setup (symbol-value (funcall mksym "grammar"))
2283 (funcall mksym "rules") 2288 (funcall mksym "rules")
2284 :forward-token (funcall mksym "forward-token") 2289 :forward-token (funcall mksym "forward-token")
diff --git a/lisp/term/xterm.el b/lisp/term/xterm.el
index 5d4112b24fd..ba017e9938f 100644
--- a/lisp/term/xterm.el
+++ b/lisp/term/xterm.el
@@ -510,8 +510,8 @@ The relevant features are:
510 ;; Gnome terminal 2.32.1 reports 1;2802;0 510 ;; Gnome terminal 2.32.1 reports 1;2802;0
511 (setq version 200)) 511 (setq version 200))
512 (when (equal (match-string 1 str) "83") 512 (when (equal (match-string 1 str) "83")
513 ;; OSX's Terminal.app (version 2.3 (309), which returns 83;40003;0) 513 ;; `screen' (which returns 83;40003;0) seems to also lack support for
514 ;; seems to also lack support for some of these (bug#17607). 514 ;; some of these (bug#17607).
515 (setq version 240)) 515 (setq version 240))
516 ;; If version is 242 or higher, assume the xterm supports 516 ;; If version is 242 or higher, assume the xterm supports
517 ;; reporting the background color (TODO: maybe earlier 517 ;; reporting the background color (TODO: maybe earlier
diff --git a/test/indent/shell.sh b/test/indent/shell.sh
index 74985a401d4..ed6bcf8da3a 100755
--- a/test/indent/shell.sh
+++ b/test/indent/shell.sh
@@ -25,7 +25,11 @@ esac
25 25
26{ # bug#17621 26{ # bug#17621
27 foo1 && 27 foo1 &&
28 foo2 && 28 foo2 &&
29 bar
30
31 foo1 && \
32 foo2 && \
29 bar 33 bar
30} 34}
31 35