aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2014-09-02 20:38:49 -0400
committerStefan Monnier2014-09-02 20:38:49 -0400
commite6769f18909edfd1bbf6473a1f754ab29e2fb114 (patch)
tree4d706d90221fe672b6d0f4374cd4a71ca43c7b43
parentda25527e976176228c44f3c44499e0b402baad65 (diff)
downloademacs-e6769f18909edfd1bbf6473a1f754ab29e2fb114.tar.gz
emacs-e6769f18909edfd1bbf6473a1f754ab29e2fb114.zip
* lisp/progmodes/sh-script.el (sh-font-lock-quoted-subshell): Try to better
handle multiline elements. Fixes: debbugs:18380
-rw-r--r--lisp/ChangeLog12
-rw-r--r--lisp/progmodes/sh-script.el11
2 files changed, 15 insertions, 8 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 5f89308e597..3edfdad0cf0 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12014-09-03 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * progmodes/sh-script.el (sh-font-lock-quoted-subshell): Try to better
4 handle multiline elements (bug#18380).
5
12014-09-01 Eli Zaretskii <eliz@gnu.org> 62014-09-01 Eli Zaretskii <eliz@gnu.org>
2 7
3 * ls-lisp.el (ls-lisp-use-string-collate) 8 * ls-lisp.el (ls-lisp-use-string-collate)
@@ -7,8 +12,7 @@
7 (ls-lisp-version-lessp): New function. 12 (ls-lisp-version-lessp): New function.
8 (ls-lisp-handle-switches): Use it to implement the -v switch of 13 (ls-lisp-handle-switches): Use it to implement the -v switch of
9 GNU ls. 14 GNU ls.
10 (ls-lisp--insert-directory): Mention the -v switch in the doc 15 (ls-lisp--insert-directory): Mention the -v switch in the doc string.
11 string.
12 16
132014-08-31 Christoph Scholtes <cschol2112@gmail.com> 172014-08-31 Christoph Scholtes <cschol2112@gmail.com>
14 18
@@ -16,8 +20,8 @@
16 `quit-window' via `special-mode'. 20 `quit-window' via `special-mode'.
17 (ibuffer-mode-map): Use keybindings from special-mode-map instead 21 (ibuffer-mode-map): Use keybindings from special-mode-map instead
18 of local overrides. 22 of local overrides.
19 (ibuffer): Don't store previous windows configuration. Let 23 (ibuffer): Don't store previous windows configuration.
20 `quit-window' handle restoring. 24 Let `quit-window' handle restoring.
21 (ibuffer-quit): Remove function. Use `quit-window' instead. 25 (ibuffer-quit): Remove function. Use `quit-window' instead.
22 (ibuffer-restore-window-config-on-quit): Remove variable. 26 (ibuffer-restore-window-config-on-quit): Remove variable.
23 (ibuffer-prev-window-config): Remove variable. 27 (ibuffer-prev-window-config): Remove variable.
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index 3b0550dccca..5631358b472 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -1051,13 +1051,11 @@ Point is at the beginning of the next line."
1051 "Search for a subshell embedded in a string. 1051 "Search for a subshell embedded in a string.
1052Find all the unescaped \" characters within said subshell, remembering that 1052Find all the unescaped \" characters within said subshell, remembering that
1053subshells can nest." 1053subshells can nest."
1054 ;; FIXME: This can (and often does) match multiple lines, yet it makes no
1055 ;; effort to handle multiline cases correctly, so it ends up being
1056 ;; rather flaky.
1057 (when (eq ?\" (nth 3 (syntax-ppss))) ; Check we matched an opening quote. 1054 (when (eq ?\" (nth 3 (syntax-ppss))) ; Check we matched an opening quote.
1058 ;; bingo we have a $( or a ` inside a "" 1055 ;; bingo we have a $( or a ` inside a ""
1059 (let (;; `state' can be: double-quote, backquote, code. 1056 (let (;; `state' can be: double-quote, backquote, code.
1060 (state (if (eq (char-before) ?`) 'backquote 'code)) 1057 (state (if (eq (char-before) ?`) 'backquote 'code))
1058 (startpos (point))
1061 ;; Stacked states in the context. 1059 ;; Stacked states in the context.
1062 (states '(double-quote))) 1060 (states '(double-quote)))
1063 (while (and state (progn (skip-chars-forward "^'\\\\\"`$()" limit) 1061 (while (and state (progn (skip-chars-forward "^'\\\\\"`$()" limit)
@@ -1088,7 +1086,12 @@ subshells can nest."
1088 (`double-quote nil) 1086 (`double-quote nil)
1089 (_ (setq state (pop states))))) 1087 (_ (setq state (pop states)))))
1090 (_ (error "Internal error in sh-font-lock-quoted-subshell"))) 1088 (_ (error "Internal error in sh-font-lock-quoted-subshell")))
1091 (forward-char 1))))) 1089 (forward-char 1))
1090 (when (< startpos (line-beginning-position))
1091 (put-text-property startpos (point) 'syntax-multiline t)
1092 (add-hook 'syntax-propertize-extend-region-functions
1093 'syntax-propertize-multiline nil t))
1094 )))
1092 1095
1093 1096
1094(defun sh-is-quoted-p (pos) 1097(defun sh-is-quoted-p (pos)