aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Colascione2014-01-21 15:42:59 -0800
committerDaniel Colascione2014-01-21 15:42:59 -0800
commit00d2a6bb2663106a6584ea229958d5bba32703d2 (patch)
treefa274994b05763327efef2c713f0dc61dff7e3f9
parent79b61bccf841e33df9f457df1d0dc5c45667efbc (diff)
downloademacs-00d2a6bb2663106a6584ea229958d5bba32703d2.tar.gz
emacs-00d2a6bb2663106a6584ea229958d5bba32703d2.zip
Fix here-doc highlighting
-rw-r--r--lisp/ChangeLog9
-rw-r--r--lisp/progmodes/sh-script.el16
2 files changed, 19 insertions, 6 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 94966f657c1..6bdf4463a6f 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,12 @@
12014-01-21 Daniel Colascione <dancol@dancol.org>
2
3 * progmodes/sh-script.el (sh--inside-noncommand-expression):
4 Correctly detect when we're inside an arithmetic expansion form
5 containing nested parenthesis.
6 (sh--maybe-here-document): Use `sh--inside-noncommand-expression`
7 to detect cases where we shouldn't expand "<<" to a heredoc
8 skeleton.
9
12014-01-21 Stefan Monnier <monnier@iro.umontreal.ca> 102014-01-21 Stefan Monnier <monnier@iro.umontreal.ca>
2 11
3 * emacs-lisp/eldoc.el: Properly remove message in minibuffer case. 12 * emacs-lisp/eldoc.el: Properly remove message in minibuffer case.
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index daf8d299663..f41378f2f53 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -975,11 +975,14 @@ See `sh-feature'.")
975 (let ((ppss (syntax-ppss pos))) 975 (let ((ppss (syntax-ppss pos)))
976 (when (nth 1 ppss) 976 (when (nth 1 ppss)
977 (goto-char (nth 1 ppss)) 977 (goto-char (nth 1 ppss))
978 (pcase (char-after) 978 (or
979 ;; $((...)) or $[...] or ${...}. 979 (pcase (char-after)
980 (`?\( (and (eq ?\( (char-before)) 980 ;; ((...)) or $((...)) or $[...] or ${...}. Nested
981 (eq ?\$ (char-before (1- (point)))))) 981 ;; parenthesis can occur inside the first of these forms, so
982 ((or `?\{ `?\[) (eq ?\$ (char-before)))))))) 982 ;; parse backward recursively.
983 (`?\( (eq ?\( (char-before)))
984 ((or `?\{ `?\[) (eq ?\$ (char-before))))
985 (sh--inside-noncommand-expression (1- (point))))))))
983 986
984(defun sh-font-lock-open-heredoc (start string eol) 987(defun sh-font-lock-open-heredoc (start string eol)
985 "Determine the syntax of the \\n after a <<EOF. 988 "Determine the syntax of the \\n after a <<EOF.
@@ -4265,7 +4268,8 @@ The document is bounded by `sh-here-document-word'."
4265 (or (not (looking-back "[^<]<<")) 4268 (or (not (looking-back "[^<]<<"))
4266 (save-excursion 4269 (save-excursion
4267 (backward-char 2) 4270 (backward-char 2)
4268 (sh-quoted-p)) 4271 (or (sh-quoted-p)
4272 (sh--inside-noncommand-expression (point))))
4269 (nth 8 (syntax-ppss)) 4273 (nth 8 (syntax-ppss))
4270 (let ((tabs (if (string-match "\\`-" sh-here-document-word) 4274 (let ((tabs (if (string-match "\\`-" sh-here-document-word)
4271 (make-string (/ (current-indentation) tab-width) ?\t) 4275 (make-string (/ (current-indentation) tab-width) ?\t)