diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2014-09-02 20:38:49 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2014-09-02 20:38:49 -0400 |
commit | e6769f18909edfd1bbf6473a1f754ab29e2fb114 (patch) | |
tree | 4d706d90221fe672b6d0f4374cd4a71ca43c7b43 /lisp | |
parent | da25527e976176228c44f3c44499e0b402baad65 (diff) | |
download | emacs-e6769f18909edfd1bbf6473a1f754ab29e2fb114.tar.gz emacs-e6769f18909edfd1bbf6473a1f754ab29e2fb114.tar.bz2 emacs-e6769f18909edfd1bbf6473a1f754ab29e2fb114.zip |
* lisp/progmodes/sh-script.el (sh-font-lock-quoted-subshell): Try to better
handle multiline elements.
Fixes: debbugs:18380
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/ChangeLog | 12 | ||||
-rw-r--r-- | lisp/progmodes/sh-script.el | 11 |
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 @@ +2014-09-03 Stefan Monnier <monnier@iro.umontreal.ca> + + * progmodes/sh-script.el (sh-font-lock-quoted-subshell): Try to better + handle multiline elements (bug#18380). + 2014-09-01 Eli Zaretskii <eliz@gnu.org> * 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 <cschol2112@gmail.com> @@ -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. 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." "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 @@ subshells can nest." (`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) |