]> code.delx.au - gnu-emacs/blobdiff - lisp/progmodes/sh-script.el
Merge from emacs-23 branch
[gnu-emacs] / lisp / progmodes / sh-script.el
index 900072fe356965aa1b24129b7459039f270e5855..31a4fbaef4d171afa17d48414c76c070daef412e 100644 (file)
@@ -969,7 +969,8 @@ Point is at the beginning of the next line."
 (defun sh-syntax-propertize-here-doc (end)
   (let ((ppss (syntax-ppss)))
     (when (eq t (nth 3 ppss))
-      (let ((key (get-text-property (nth 8 ppss) 'sh-here-doc-marker)))
+      (let ((key (get-text-property (nth 8 ppss) 'sh-here-doc-marker))
+            (case-fold-search nil))
         (when (re-search-forward
                (concat "^\\([ \t]*\\)" (regexp-quote key) "\\(\n\\)")
                end 'move)
@@ -986,8 +987,7 @@ subshells can nest."
   ;; rather flakey.
   (when (eq ?\" (nth 3 (syntax-ppss))) ; Check we matched an opening quote.
     ;; bingo we have a $( or a ` inside a ""
-    (let ((char (char-after (point)))
-          ;; `state' can be: double-quote, backquote, code.
+    (let (;; `state' can be: double-quote, backquote, code.
           (state (if (eq (char-before) ?`) 'backquote 'code))
           ;; Stacked states in the context.
           (states '(double-quote)))
@@ -1028,45 +1028,45 @@ subshells can nest."
 
 (defun sh-font-lock-paren (start)
   (unless (nth 8 (syntax-ppss))
-  (save-excursion
-    (goto-char start)
-    ;; Skip through all patterns
-    (while
-       (progn
+    (save-excursion
+      (goto-char start)
+      ;; Skip through all patterns
+      (while
+          (progn
             (while
                 (progn
-         (forward-comment (- (point-max)))
+                  (forward-comment (- (point-max)))
                   (when (and (eolp) (sh-is-quoted-p (point)))
                     (forward-char -1)
                     t)))
-         ;; Skip through one pattern
-         (while
-             (or (/= 0 (skip-syntax-backward "w_"))
+            ;; Skip through one pattern
+            (while
+                (or (/= 0 (skip-syntax-backward "w_"))
                     (/= 0 (skip-chars-backward "-$=?[]*@/\\\\"))
-                 (and (sh-is-quoted-p (1- (point)))
-                      (goto-char (- (point) 2)))
+                    (and (sh-is-quoted-p (1- (point)))
+                         (goto-char (- (point) 2)))
                     (when (memq (char-before) '(?\" ?\' ?\}))
-                   (condition-case nil (progn (backward-sexp 1) t)
-                     (error nil)))))
-         ;; Patterns can be preceded by an open-paren (Bug#1320).
-         (if (eq (char-before (point)) ?\()
-             (backward-char 1))
-          (while (progn
-                   (forward-comment (- (point-max)))
-                   ;; Maybe we've bumped into an escaped newline.
-                   (sh-is-quoted-p (point)))
-            (backward-char 1))
-         (when (eq (char-before) ?|)
-           (backward-char 1) t)))
-    (when (progn (backward-char 2)
-                 (if (> start (line-end-position))
-                     (put-text-property (point) (1+ start)
-                                        'syntax-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'.
-                   (and (looking-at ";[;&]\\|in")
+                      (condition-case nil (progn (backward-sexp 1) t)
+                        (error nil)))))
+            ;; Patterns can be preceded by an open-paren (Bug#1320).
+            (if (eq (char-before (point)) ?\()
+                (backward-char 1))
+            (while (progn
+                     (forward-comment (- (point-max)))
+                     ;; Maybe we've bumped into an escaped newline.
+                     (sh-is-quoted-p (point)))
+              (backward-char 1))
+            (when (eq (char-before) ?|)
+              (backward-char 1) t)))
+      (when (progn (backward-char 2)
+                   (if (> start (line-end-position))
+                       (put-text-property (point) (1+ start)
+                                          'syntax-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'.
+                   (and (looking-at ";[;&]\\|\\_<in")
                         ;; ";; 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,
@@ -1211,7 +1211,7 @@ a number means align to that column, e.g. 0 means first column."
 ;;   "For debugging:  display message ARGS if variable SH-DEBUG is non-nil."
 ;;   (if sh-debug
 ;;       (apply 'message args)))
-(defmacro sh-debug (&rest args))
+(defmacro sh-debug (&rest _args))
 
 (defconst sh-symbol-list
   '((const :tag "+ "  :value +
@@ -2137,7 +2137,6 @@ STRING         This is ignored for the purposes of calculating
   (save-excursion
     (let ((have-result nil)
          this-kw
-         start
          val
          (result nil)
          (align-point nil)
@@ -2208,7 +2207,6 @@ STRING         This is ignored for the purposes of calculating
            ;; We start off at beginning of this line.
            ;; Scan previous statements while this is <=
            ;; start of previous line.
-           (setq start (point)) ;; for debug only
            (goto-char prev-line-end)
            (setq x t)
            (while (and x (setq x  (sh-prev-thing)))
@@ -2613,7 +2611,7 @@ can be represented by a symbol then do so."
 If INFO is supplied it is used, else it is calculated from current line."
   (let ((ofs 0)
        (base-value 0)
-       elt a b var val)
+       elt a b val)
     (or info
        (setq info (sh-get-indent-info)))
     (when info