aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/sh-script.el
diff options
context:
space:
mode:
authorStefan Monnier <[email protected]>2007-06-18 20:10:06 +0000
committerStefan Monnier <[email protected]>2007-06-18 20:10:06 +0000
commit74ab576e4239e36191cbe7be28c0baec85916f90 (patch)
treebc68c7feed5b9ef64b860fbaa38f292fca427ed7 /lisp/progmodes/sh-script.el
parent92335d2a4a5c7fefb8a2f1214b1164cd9e9b7acc (diff)
(sh-font-lock-paren): Mark the relevant text with font-lock-multiline.
Diffstat (limited to 'lisp/progmodes/sh-script.el')
-rw-r--r--lisp/progmodes/sh-script.el27
1 files changed, 22 insertions, 5 deletions
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index b29cf7fb14..4eea5e4925 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -171,10 +171,6 @@
;; disadvantages:
;; 1. We need to scan the buffer to find which ")" symbols belong to a
;; case alternative, to find any here documents, and handle "$#".
-;; 2. Setting the text property makes the buffer modified. If the
-;; buffer is read-only buffer we have to cheat and bypass the read-only
-;; status. This is for cases where the buffer started read-only buffer
-;; but the user issued `toggle-read-only'.
;;
;; Bugs
;; ----
@@ -183,6 +179,16 @@
;;
;; - `sh-learn-buffer-indent' is extremely slow.
;;
+;; - "case $x in y) echo ;; esac)" the last ) is mis-identified as being
+;; part of a case-pattern. You need to add a semi-colon after "esac" to
+;; coerce sh-script into doing the right thing.
+;;
+;; - "echo $z in ps | head)" the last ) is mis-identified as being part of
+;; a case-pattern. You need to put the "in" between quotes to coerce
+;; sh-script into doing the right thing.
+;;
+;; - A line starting with "}>foo" is not indented like "} >foo".
+;;
;; Richard Sharman <[email protected]> June 1999.
;;; Code:
@@ -1052,7 +1058,18 @@ subshells can nest."
(backward-char 1))
(when (eq (char-before) ?|)
(backward-char 1) t)))
- (when (save-excursion (backward-char 2) (looking-at ";;\\|in"))
+ ;; FIXME: ";; esac )" is a case that looks like a case-pattern but it's
+ ;; really just a close paren after a case statement. I.e. if we skipped
+ ;; over `esac' just now, we're not looking at a case-pattern.
+ (when (progn (backward-char 2)
+ (if (> start (line-end-position))
+ (put-text-property (point) (1+ start)
+ 'font-lock-multiline t))
+ ;; FIXME: The `in' may just be a random argument to
+ ;; a normal command rather than the real `in' keyword.
+ ;; I.e. we should look back to try and find the
+ ;; corresponding `case'.
+ (looking-at ";;\\|in"))
sh-st-punc)))
(defun sh-font-lock-backslash-quote ()