emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r116099: Fix here-doc highlighting


From: Daniel Colascione
Subject: [Emacs-diffs] trunk r116099: Fix here-doc highlighting
Date: Tue, 21 Jan 2014 23:43:22 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 116099
revision-id: address@hidden
parent: address@hidden
committer: Daniel Colascione <address@hidden>
branch nick: trunk
timestamp: Tue 2014-01-21 15:42:59 -0800
message:
  Fix here-doc highlighting
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/progmodes/sh-script.el    shscript.el-20091113204419-o5vbwnq5f7feedwu-727
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-01-21 17:21:19 +0000
+++ b/lisp/ChangeLog    2014-01-21 23:42:59 +0000
@@ -1,3 +1,12 @@
+2014-01-21  Daniel Colascione  <address@hidden>
+
+       * 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  <address@hidden>
 
        * emacs-lisp/eldoc.el: Properly remove message in minibuffer case.

=== modified file 'lisp/progmodes/sh-script.el'
--- a/lisp/progmodes/sh-script.el       2014-01-12 05:29:11 +0000
+++ b/lisp/progmodes/sh-script.el       2014-01-21 23:42:59 +0000
@@ -975,11 +975,14 @@
     (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 <<EOF.
@@ -4265,7 +4268,8 @@
   (or (not (looking-back "[^<]<<"))
       (save-excursion
        (backward-char 2)
-       (sh-quoted-p))
+        (or (sh-quoted-p)
+            (sh--inside-noncommand-expression (point))))
       (nth 8 (syntax-ppss))
       (let ((tabs (if (string-match "\\`-" sh-here-document-word)
                       (make-string (/ (current-indentation) tab-width) ?\t)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]