From: Daniel Colascione Date: Tue, 21 Jan 2014 23:42:59 +0000 (-0800) Subject: Fix here-doc highlighting X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~308 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=00d2a6bb2663106a6584ea229958d5bba32703d2;p=emacs.git Fix here-doc highlighting --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 94966f657c1..6bdf4463a6f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,12 @@ +2014-01-21 Daniel Colascione + + * progmodes/sh-script.el (sh--inside-noncommand-expression): + Correctly detect when we're inside an arithmetic expansion form + containing nested parenthesis. + (sh--maybe-here-document): Use `sh--inside-noncommand-expression` + to detect cases where we shouldn't expand "<<" to a heredoc + skeleton. + 2014-01-21 Stefan Monnier * 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'.") (let ((ppss (syntax-ppss pos))) (when (nth 1 ppss) (goto-char (nth 1 ppss)) - (pcase (char-after) - ;; $((...)) or $[...] or ${...}. - (`?\( (and (eq ?\( (char-before)) - (eq ?\$ (char-before (1- (point)))))) - ((or `?\{ `?\[) (eq ?\$ (char-before)))))))) + (or + (pcase (char-after) + ;; ((...)) or $((...)) or $[...] or ${...}. Nested + ;; parenthesis can occur inside the first of these forms, so + ;; parse backward recursively. + (`?\( (eq ?\( (char-before))) + ((or `?\{ `?\[) (eq ?\$ (char-before)))) + (sh--inside-noncommand-expression (1- (point)))))))) (defun sh-font-lock-open-heredoc (start string eol) "Determine the syntax of the \\n after a <