emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r117808: * lisp/progmodes/sh-script.el (sh-font-lock


From: Stefan Monnier
Subject: [Emacs-diffs] trunk r117808: * lisp/progmodes/sh-script.el (sh-font-lock-quoted-subshell): Try to better
Date: Wed, 03 Sep 2014 00:38:57 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117808
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=18380
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Tue 2014-09-02 20:38:49 -0400
message:
  * lisp/progmodes/sh-script.el (sh-font-lock-quoted-subshell): Try to better
  handle multiline elements.
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-09-01 15:03:45 +0000
+++ b/lisp/ChangeLog    2014-09-03 00:38:49 +0000
@@ -1,3 +1,8 @@
+2014-09-03  Stefan Monnier  <address@hidden>
+
+       * progmodes/sh-script.el (sh-font-lock-quoted-subshell): Try to better
+       handle multiline elements (bug#18380).
+
 2014-09-01  Eli Zaretskii  <address@hidden>
 
        * ls-lisp.el (ls-lisp-use-string-collate)
@@ -7,8 +12,7 @@
        (ls-lisp-version-lessp): New function.
        (ls-lisp-handle-switches): Use it to implement the -v switch of
        GNU ls.
-       (ls-lisp--insert-directory): Mention the -v switch in the doc
-       string.
+       (ls-lisp--insert-directory): Mention the -v switch in the doc string.
 
 2014-08-31  Christoph Scholtes  <address@hidden>
 
@@ -16,8 +20,8 @@
        `quit-window' via `special-mode'.
        (ibuffer-mode-map): Use keybindings from special-mode-map instead
        of local overrides.
-       (ibuffer): Don't store previous windows configuration. Let
-       `quit-window' handle restoring.
+       (ibuffer): Don't store previous windows configuration.
+       Let `quit-window' handle restoring.
        (ibuffer-quit): Remove function. Use `quit-window' instead.
        (ibuffer-restore-window-config-on-quit): Remove variable.
        (ibuffer-prev-window-config): Remove variable.

=== modified file 'lisp/progmodes/sh-script.el'
--- a/lisp/progmodes/sh-script.el       2014-07-21 01:41:59 +0000
+++ b/lisp/progmodes/sh-script.el       2014-09-03 00:38:49 +0000
@@ -1051,13 +1051,11 @@
   "Search for a subshell embedded in a string.
 Find all the unescaped \" characters within said subshell, remembering that
 subshells can nest."
-  ;; FIXME: This can (and often does) match multiple lines, yet it makes no
-  ;; effort to handle multiline cases correctly, so it ends up being
-  ;; rather flaky.
   (when (eq ?\" (nth 3 (syntax-ppss))) ; Check we matched an opening quote.
     ;; bingo we have a $( or a ` inside a ""
     (let (;; `state' can be: double-quote, backquote, code.
           (state (if (eq (char-before) ?`) 'backquote 'code))
+          (startpos (point))
           ;; Stacked states in the context.
           (states '(double-quote)))
       (while (and state (progn (skip-chars-forward "^'\\\\\"`$()" limit)
@@ -1088,7 +1086,12 @@
                  (`double-quote nil)
                  (_ (setq state (pop states)))))
           (_ (error "Internal error in sh-font-lock-quoted-subshell")))
-        (forward-char 1)))))
+        (forward-char 1))
+      (when (< startpos (line-beginning-position))
+        (put-text-property startpos (point) 'syntax-multiline t)
+        (add-hook 'syntax-propertize-extend-region-functions
+                  'syntax-propertize-multiline nil t))
+      )))
 
 
 (defun sh-is-quoted-p (pos)


reply via email to

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