diff options
| author | Sam Steingold | 2001-10-26 13:48:53 +0000 |
|---|---|---|
| committer | Sam Steingold | 2001-10-26 13:48:53 +0000 |
| commit | 035107fa9cbb1b0b2f53b5a4623b9f4cbfc61544 (patch) | |
| tree | 24a58c8942f9dc8471e8827b016a4f4857e5e9f6 | |
| parent | 552b1b018fad14cfe02a4de75482f3cb95e6217a (diff) | |
| download | emacs-035107fa9cbb1b0b2f53b5a4623b9f4cbfc61544.tar.gz emacs-035107fa9cbb1b0b2f53b5a4623b9f4cbfc61544.zip | |
no functional changes - a preparation for the next patch
| -rw-r--r-- | lisp/progmodes/sh-script.el | 95 |
1 files changed, 48 insertions, 47 deletions
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 9392c3da2d8..8c05826d7f4 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el | |||
| @@ -43,35 +43,35 @@ | |||
| 43 | ;; =========== | 43 | ;; =========== |
| 44 | ;; Indentation for rc and es modes is very limited, but for Bourne shells | 44 | ;; Indentation for rc and es modes is very limited, but for Bourne shells |
| 45 | ;; and its derivatives it is quite customizable. | 45 | ;; and its derivatives it is quite customizable. |
| 46 | ;; | 46 | ;; |
| 47 | ;; The following description applies to sh and derived shells (bash, | 47 | ;; The following description applies to sh and derived shells (bash, |
| 48 | ;; zsh, ...). | 48 | ;; zsh, ...). |
| 49 | ;; | 49 | ;; |
| 50 | ;; There are various customization variables which allow tailoring to | 50 | ;; There are various customization variables which allow tailoring to |
| 51 | ;; a wide variety of styles. Most of these variables are named | 51 | ;; a wide variety of styles. Most of these variables are named |
| 52 | ;; sh-indent-for-XXX and sh-indent-after-XXX. For example. | 52 | ;; sh-indent-for-XXX and sh-indent-after-XXX. For example. |
| 53 | ;; sh-indent-after-if controls the indenting of a line following | 53 | ;; sh-indent-after-if controls the indenting of a line following |
| 54 | ;; an if statement, and sh-indent-for-fi controls the indentation | 54 | ;; an if statement, and sh-indent-for-fi controls the indentation |
| 55 | ;; of the line containing the fi. | 55 | ;; of the line containing the fi. |
| 56 | ;; | 56 | ;; |
| 57 | ;; You can set each to a numeric value, but it is often more convenient | 57 | ;; You can set each to a numeric value, but it is often more convenient |
| 58 | ;; to a symbol such as `+' which uses the value of variable `sh-basic-offset'. | 58 | ;; to a symbol such as `+' which uses the value of variable `sh-basic-offset'. |
| 59 | ;; By changing this one variable you can increase or decrease how much | 59 | ;; By changing this one variable you can increase or decrease how much |
| 60 | ;; indentation there is. Valid symbols: | 60 | ;; indentation there is. Valid symbols: |
| 61 | ;; | 61 | ;; |
| 62 | ;; + Indent right by sh-basic-offset | 62 | ;; + Indent right by sh-basic-offset |
| 63 | ;; - Indent left by sh-basic-offset | 63 | ;; - Indent left by sh-basic-offset |
| 64 | ;; ++ Indent right twice sh-basic-offset | 64 | ;; ++ Indent right twice sh-basic-offset |
| 65 | ;; -- Indent left twice sh-basic-offset | 65 | ;; -- Indent left twice sh-basic-offset |
| 66 | ;; * Indent right half sh-basic-offset | 66 | ;; * Indent right half sh-basic-offset |
| 67 | ;; / Indent left half sh-basic-offset. | 67 | ;; / Indent left half sh-basic-offset. |
| 68 | ;; | 68 | ;; |
| 69 | ;; There are 4 commands to help set the indentation variables: | 69 | ;; There are 4 commands to help set the indentation variables: |
| 70 | ;; | 70 | ;; |
| 71 | ;; `sh-show-indent' | 71 | ;; `sh-show-indent' |
| 72 | ;; This shows what variable controls the indentation of the current | 72 | ;; This shows what variable controls the indentation of the current |
| 73 | ;; line and its value. | 73 | ;; line and its value. |
| 74 | ;; | 74 | ;; |
| 75 | ;; `sh-set-indent' | 75 | ;; `sh-set-indent' |
| 76 | ;; This allows you to set the value of the variable controlling the | 76 | ;; This allows you to set the value of the variable controlling the |
| 77 | ;; current line's indentation. You can enter a number or one of a | 77 | ;; current line's indentation. You can enter a number or one of a |
| @@ -79,13 +79,13 @@ | |||
| 79 | ;; or its negative, or half it, or twice it, etc. If you've used | 79 | ;; or its negative, or half it, or twice it, etc. If you've used |
| 80 | ;; cc-mode this should be familiar. If you forget which symbols are | 80 | ;; cc-mode this should be familiar. If you forget which symbols are |
| 81 | ;; valid simply press C-h at the prompt. | 81 | ;; valid simply press C-h at the prompt. |
| 82 | ;; | 82 | ;; |
| 83 | ;; `sh-learn-line-indent' | 83 | ;; `sh-learn-line-indent' |
| 84 | ;; Simply make the line look the way you want it, then invoke this | 84 | ;; Simply make the line look the way you want it, then invoke this |
| 85 | ;; command. It will set the variable to the value that makes the line | 85 | ;; command. It will set the variable to the value that makes the line |
| 86 | ;; indent like that. If called with a prefix argument then it will set | 86 | ;; indent like that. If called with a prefix argument then it will set |
| 87 | ;; the value to one of the symbols if applicable. | 87 | ;; the value to one of the symbols if applicable. |
| 88 | ;; | 88 | ;; |
| 89 | ;; `sh-learn-buffer-indent' | 89 | ;; `sh-learn-buffer-indent' |
| 90 | ;; This is the deluxe function! It "learns" the whole buffer (use | 90 | ;; This is the deluxe function! It "learns" the whole buffer (use |
| 91 | ;; narrowing if you want it to process only part). It outputs to a | 91 | ;; narrowing if you want it to process only part). It outputs to a |
| @@ -98,7 +98,7 @@ | |||
| 98 | ;; pattern; if they don't it will be set to nil. | 98 | ;; pattern; if they don't it will be set to nil. |
| 99 | ;; Whether `sh-basic-offset' is set is determined by variable | 99 | ;; Whether `sh-basic-offset' is set is determined by variable |
| 100 | ;; `sh-learn-basic-offset'. | 100 | ;; `sh-learn-basic-offset'. |
| 101 | ;; | 101 | ;; |
| 102 | ;; Unfortunately, `sh-learn-buffer-indent' can take a long time to run | 102 | ;; Unfortunately, `sh-learn-buffer-indent' can take a long time to run |
| 103 | ;; (e.g. if there are large case statements). Perhaps it does not make | 103 | ;; (e.g. if there are large case statements). Perhaps it does not make |
| 104 | ;; sense to run it on large buffers: if lots of lines have different | 104 | ;; sense to run it on large buffers: if lots of lines have different |
| @@ -106,7 +106,7 @@ | |||
| 106 | ;; *indent* buffer; if there is a consistent style then running | 106 | ;; *indent* buffer; if there is a consistent style then running |
| 107 | ;; `sh-learn-buffer-indent' on a small region of the buffer should | 107 | ;; `sh-learn-buffer-indent' on a small region of the buffer should |
| 108 | ;; suffice. | 108 | ;; suffice. |
| 109 | ;; | 109 | ;; |
| 110 | ;; Saving indentation values | 110 | ;; Saving indentation values |
| 111 | ;; ------------------------- | 111 | ;; ------------------------- |
| 112 | ;; After you've learned the values in a buffer, how to you remember | 112 | ;; After you've learned the values in a buffer, how to you remember |
| @@ -115,14 +115,14 @@ | |||
| 115 | ;; the buffer. | 115 | ;; the buffer. |
| 116 | ;; You can do this automatically like this: | 116 | ;; You can do this automatically like this: |
| 117 | ;; (add-hook 'sh-set-shell-hook 'sh-learn-buffer-indent) | 117 | ;; (add-hook 'sh-set-shell-hook 'sh-learn-buffer-indent) |
| 118 | ;; | 118 | ;; |
| 119 | ;; However... `sh-learn-buffer-indent' is extremely slow, | 119 | ;; However... `sh-learn-buffer-indent' is extremely slow, |
| 120 | ;; especially on large-ish buffer. Also, if there are conflicts the | 120 | ;; especially on large-ish buffer. Also, if there are conflicts the |
| 121 | ;; "last one wins" which may not produce the desired setting. | 121 | ;; "last one wins" which may not produce the desired setting. |
| 122 | ;; | 122 | ;; |
| 123 | ;; So...There is a minimal way of being able to save indentation values and | 123 | ;; So...There is a minimal way of being able to save indentation values and |
| 124 | ;; to reload them in another buffer or at another point in time. | 124 | ;; to reload them in another buffer or at another point in time. |
| 125 | ;; | 125 | ;; |
| 126 | ;; Use `sh-name-style' to give a name to the indentation settings of | 126 | ;; Use `sh-name-style' to give a name to the indentation settings of |
| 127 | ;; the current buffer. | 127 | ;; the current buffer. |
| 128 | ;; Use `sh-load-style' to load indentation settings for the current | 128 | ;; Use `sh-load-style' to load indentation settings for the current |
| @@ -130,30 +130,30 @@ | |||
| 130 | ;; Use `sh-save-styles-to-buffer' to write all the styles to a buffer | 130 | ;; Use `sh-save-styles-to-buffer' to write all the styles to a buffer |
| 131 | ;; in lisp code. You can then store it in a file and later use | 131 | ;; in lisp code. You can then store it in a file and later use |
| 132 | ;; `load-file' to load it. | 132 | ;; `load-file' to load it. |
| 133 | ;; | 133 | ;; |
| 134 | ;; Indentation variables - buffer local or global? | 134 | ;; Indentation variables - buffer local or global? |
| 135 | ;; ---------------------------------------------- | 135 | ;; ---------------------------------------------- |
| 136 | ;; I think that often having them buffer-local makes sense, | 136 | ;; I think that often having them buffer-local makes sense, |
| 137 | ;; especially if one is using `sh-learn-buffer-indent'. However, if | 137 | ;; especially if one is using `sh-learn-buffer-indent'. However, if |
| 138 | ;; a user sets values using customization, these changes won't appear | 138 | ;; a user sets values using customization, these changes won't appear |
| 139 | ;; to work if the variables are already local! | 139 | ;; to work if the variables are already local! |
| 140 | ;; | 140 | ;; |
| 141 | ;; To get round this, there is a variable `sh-make-vars-local' and 2 | 141 | ;; To get round this, there is a variable `sh-make-vars-local' and 2 |
| 142 | ;; functions: `sh-make-vars-local' and `sh-reset-indent-vars-to-global-values'. | 142 | ;; functions: `sh-make-vars-local' and `sh-reset-indent-vars-to-global-values'. |
| 143 | ;; | 143 | ;; |
| 144 | ;; If `sh-make-vars-local' is non-nil, then these variables become | 144 | ;; If `sh-make-vars-local' is non-nil, then these variables become |
| 145 | ;; buffer local when the mode is established. | 145 | ;; buffer local when the mode is established. |
| 146 | ;; If this is nil, then the variables are global. At any time you | 146 | ;; If this is nil, then the variables are global. At any time you |
| 147 | ;; can make them local with the command `sh-make-vars-local'. | 147 | ;; can make them local with the command `sh-make-vars-local'. |
| 148 | ;; Conversely, to update with the global values you can use the | 148 | ;; Conversely, to update with the global values you can use the |
| 149 | ;; command `sh-reset-indent-vars-to-global-values'. | 149 | ;; command `sh-reset-indent-vars-to-global-values'. |
| 150 | ;; | 150 | ;; |
| 151 | ;; This may be awkward, but the intent is to cover all cases. | 151 | ;; This may be awkward, but the intent is to cover all cases. |
| 152 | ;; | 152 | ;; |
| 153 | ;; Awkward things, pitfalls | 153 | ;; Awkward things, pitfalls |
| 154 | ;; ------------------------ | 154 | ;; ------------------------ |
| 155 | ;; Indentation for a sh script is complicated for a number of reasons: | 155 | ;; Indentation for a sh script is complicated for a number of reasons: |
| 156 | ;; | 156 | ;; |
| 157 | ;; 1. You can't format by simply looking at symbols, you need to look | 157 | ;; 1. You can't format by simply looking at symbols, you need to look |
| 158 | ;; at keywords. [This is not the case for rc and es shells.] | 158 | ;; at keywords. [This is not the case for rc and es shells.] |
| 159 | ;; 2. The character ")" is used both as a matched pair "(" ... ")" and | 159 | ;; 2. The character ")" is used both as a matched pair "(" ... ")" and |
| @@ -165,7 +165,7 @@ | |||
| 165 | ;; 4. A line may be continued using the "\". | 165 | ;; 4. A line may be continued using the "\". |
| 166 | ;; 5. The character "#" (outside a string) normally starts a comment, | 166 | ;; 5. The character "#" (outside a string) normally starts a comment, |
| 167 | ;; but it doesn't in the sequence "$#"! | 167 | ;; but it doesn't in the sequence "$#"! |
| 168 | ;; | 168 | ;; |
| 169 | ;; To try and address points 2 3 and 5 I used a feature that cperl mode | 169 | ;; To try and address points 2 3 and 5 I used a feature that cperl mode |
| 170 | ;; uses, that of a text's syntax property. This, however, has 2 | 170 | ;; uses, that of a text's syntax property. This, however, has 2 |
| 171 | ;; disadvantages: | 171 | ;; disadvantages: |
| @@ -175,14 +175,14 @@ | |||
| 175 | ;; buffer is read-only buffer we have to cheat and bypass the read-only | 175 | ;; buffer is read-only buffer we have to cheat and bypass the read-only |
| 176 | ;; status. This is for cases where the buffer started read-only buffer | 176 | ;; status. This is for cases where the buffer started read-only buffer |
| 177 | ;; but the user issued `toggle-read-only'. | 177 | ;; but the user issued `toggle-read-only'. |
| 178 | ;; | 178 | ;; |
| 179 | ;; Bugs | 179 | ;; Bugs |
| 180 | ;; ---- | 180 | ;; ---- |
| 181 | ;; - Indenting many lines is slow. It currently does each line | 181 | ;; - Indenting many lines is slow. It currently does each line |
| 182 | ;; independently, rather than saving state information. | 182 | ;; independently, rather than saving state information. |
| 183 | ;; | 183 | ;; |
| 184 | ;; - `sh-learn-buffer-indent' is extremely slow. | 184 | ;; - `sh-learn-buffer-indent' is extremely slow. |
| 185 | ;; | 185 | ;; |
| 186 | ;; Richard Sharman <rsharman@pobox.com> June 1999. | 186 | ;; Richard Sharman <rsharman@pobox.com> June 1999. |
| 187 | 187 | ||
| 188 | ;;; Code: | 188 | ;;; Code: |
| @@ -828,12 +828,13 @@ See `sh-feature'.") | |||
| 828 | (defun sh-font-lock-close-heredoc (bol eof indented) | 828 | (defun sh-font-lock-close-heredoc (bol eof indented) |
| 829 | "Determine the syntax of the \\n after an EOF. | 829 | "Determine the syntax of the \\n after an EOF. |
| 830 | If non-nil INDENTED indicates that the EOF was indented." | 830 | If non-nil INDENTED indicates that the EOF was indented." |
| 831 | (let* (;; A rough regexp that should find the opening <<EOF back. | 831 | (let* ((eof-re (regexp-quote eof)) |
| 832 | ;; A rough regexp that should find the opening <<EOF back. | ||
| 832 | (sre (concat "<<\\(-?\\)\\s-*['\"\\]?" | 833 | (sre (concat "<<\\(-?\\)\\s-*['\"\\]?" |
| 833 | ;; Use \s| to cheaply check it's an open-heredoc. | 834 | ;; Use \s| to cheaply check it's an open-heredoc. |
| 834 | (regexp-quote eof) "['\"]?\\([ \t|;&)<>].*\\)?\\s|")) | 835 | eof-re "['\"]?\\([ \t|;&)<>].*\\)?\\s|")) |
| 835 | ;; A regexp that will find other EOFs. | 836 | ;; A regexp that will find other EOFs. |
| 836 | (ere (concat "^" (if indented "[ \t]*") (regexp-quote eof) "\n")) | 837 | (ere (concat "^" (if indented "[ \t]*") eof-re "\n")) |
| 837 | (start (save-excursion | 838 | (start (save-excursion |
| 838 | (goto-char bol) | 839 | (goto-char bol) |
| 839 | (re-search-backward (concat sre "\\|" ere) nil t)))) | 840 | (re-search-backward (concat sre "\\|" ere) nil t)))) |
| @@ -920,7 +921,7 @@ be indented (i.e. a <<- was used rather than just <<)." | |||
| 920 | (match-beginning 0) (match-string 1)) nil t) | 921 | (match-beginning 0) (match-string 1)) nil t) |
| 921 | (5 (sh-font-lock-close-heredoc | 922 | (5 (sh-font-lock-close-heredoc |
| 922 | (match-beginning 0) (match-string 4) | 923 | (match-beginning 0) (match-string 4) |
| 923 | (/= (match-beginning 3) (match-end 3))) nil t)) | 924 | (/= (match-beginning 3) (match-end 3))) nil t)) |
| 924 | ;; Distinguish the special close-paren in `case'. | 925 | ;; Distinguish the special close-paren in `case'. |
| 925 | (")" 0 (sh-font-lock-paren (match-beginning 0))))) | 926 | (")" 0 (sh-font-lock-paren (match-beginning 0))))) |
| 926 | 927 | ||
| @@ -1967,7 +1968,7 @@ STRING This is ignored for the purposes of calculating | |||
| 1967 | (setq have-result nil) | 1968 | (setq have-result nil) |
| 1968 | )) | 1969 | )) |
| 1969 | ) ;; cond | 1970 | ) ;; cond |
| 1970 | 1971 | ||
| 1971 | (unless have-result | 1972 | (unless have-result |
| 1972 | ;; Continuation lines are handled specially | 1973 | ;; Continuation lines are handled specially |
| 1973 | (if (sh-this-is-a-continuation) | 1974 | (if (sh-this-is-a-continuation) |
| @@ -2060,19 +2061,19 @@ STRING This is ignored for the purposes of calculating | |||
| 2060 | (sh-debug "No prev line!") | 2061 | (sh-debug "No prev line!") |
| 2061 | (sh-debug "result: %s align-point: %s" result align-point) | 2062 | (sh-debug "result: %s align-point: %s" result align-point) |
| 2062 | ) | 2063 | ) |
| 2063 | 2064 | ||
| 2064 | (if align-point | 2065 | (if align-point |
| 2065 | ;; was: (setq result (append result (list (list t align-point)))) | 2066 | ;; was: (setq result (append result (list (list t align-point)))) |
| 2066 | (setq result (append (list (list t align-point)) result)) | 2067 | (setq result (append (list (list t align-point)) result)) |
| 2067 | ) | 2068 | ) |
| 2068 | (sh-debug "result is now: %s" result) | 2069 | (sh-debug "result is now: %s" result) |
| 2069 | 2070 | ||
| 2070 | (or result | 2071 | (or result |
| 2071 | (if prev-line-end | 2072 | (if prev-line-end |
| 2072 | (setq result (list (list t prev-line-end))) | 2073 | (setq result (list (list t prev-line-end))) |
| 2073 | (setq result (list (list '= 'sh-first-lines-indent))) | 2074 | (setq result (list (list '= 'sh-first-lines-indent))) |
| 2074 | )) | 2075 | )) |
| 2075 | 2076 | ||
| 2076 | (if (eq result t) | 2077 | (if (eq result t) |
| 2077 | (setq result nil)) | 2078 | (setq result nil)) |
| 2078 | (sh-debug "result is: %s" result) | 2079 | (sh-debug "result is: %s" result) |
| @@ -2248,7 +2249,7 @@ we go to the end of the previous line and do not check for continuations." | |||
| 2248 | ;; Possible return values: | 2249 | ;; Possible return values: |
| 2249 | ;; nil - nothing | 2250 | ;; nil - nothing |
| 2250 | ;; a string - possibly a keyword | 2251 | ;; a string - possibly a keyword |
| 2251 | ;; | 2252 | ;; |
| 2252 | (if (bolp) | 2253 | (if (bolp) |
| 2253 | nil | 2254 | nil |
| 2254 | (let ((going t) | 2255 | (let ((going t) |
| @@ -2622,7 +2623,7 @@ unless optional argument ARG (the prefix when interactive) is non-nil." | |||
| 2622 | ((numberp (setq sval (sh-var-value var))) | 2623 | ((numberp (setq sval (sh-var-value var))) |
| 2623 | (setq ival (sh-calculate-indent info)) | 2624 | (setq ival (sh-calculate-indent info)) |
| 2624 | (setq diff (- curr-indent ival)) | 2625 | (setq diff (- curr-indent ival)) |
| 2625 | 2626 | ||
| 2626 | (sh-debug "curr-indent: %d ival: %d diff: %d var:%s sval %s" | 2627 | (sh-debug "curr-indent: %d ival: %d diff: %d var:%s sval %s" |
| 2627 | curr-indent ival diff var sval) | 2628 | curr-indent ival diff var sval) |
| 2628 | (setq new-val (+ sval diff)) | 2629 | (setq new-val (+ sval diff)) |
| @@ -2699,7 +2700,7 @@ so that `occur-next' and `occur-prev' will work." | |||
| 2699 | (defvar sh-learned-buffer-hook nil | 2700 | (defvar sh-learned-buffer-hook nil |
| 2700 | "*An abnormal hook, called with an alist of learned variables.") | 2701 | "*An abnormal hook, called with an alist of learned variables.") |
| 2701 | ;; Example of how to use sh-learned-buffer-hook | 2702 | ;; Example of how to use sh-learned-buffer-hook |
| 2702 | ;; | 2703 | ;; |
| 2703 | ;; (defun what-i-learned (list) | 2704 | ;; (defun what-i-learned (list) |
| 2704 | ;; (let ((p list)) | 2705 | ;; (let ((p list)) |
| 2705 | ;; (save-excursion | 2706 | ;; (save-excursion |
| @@ -2712,7 +2713,7 @@ so that `occur-next' and `occur-prev' will work." | |||
| 2712 | ;; (setq p (cdr p))) | 2713 | ;; (setq p (cdr p))) |
| 2713 | ;; (insert ")\n") | 2714 | ;; (insert ")\n") |
| 2714 | ;; ))) | 2715 | ;; ))) |
| 2715 | ;; | 2716 | ;; |
| 2716 | ;; (add-hook 'sh-learned-buffer-hook 'what-i-learned) | 2717 | ;; (add-hook 'sh-learned-buffer-hook 'what-i-learned) |
| 2717 | 2718 | ||
| 2718 | 2719 | ||
| @@ -2904,7 +2905,7 @@ This command can often take a long time to run." | |||
| 2904 | (format "Suggested sh-basic-offset: %d" suggested)) | 2905 | (format "Suggested sh-basic-offset: %d" suggested)) |
| 2905 | nil out-buffer)))) | 2906 | nil out-buffer)))) |
| 2906 | 2907 | ||
| 2907 | 2908 | ||
| 2908 | (setq learned-var-list | 2909 | (setq learned-var-list |
| 2909 | (append (list (list 'sh-indent-comment comment-col (point-max))) | 2910 | (append (list (list 'sh-indent-comment comment-col (point-max))) |
| 2910 | learned-var-list)) | 2911 | learned-var-list)) |
| @@ -3101,7 +3102,7 @@ This is always added to the end of the buffer." | |||
| 3101 | "case *" > \n | 3102 | "case *" > \n |
| 3102 | > _ \n | 3103 | > _ \n |
| 3103 | resume: | 3104 | resume: |
| 3104 | ?} > \n) | 3105 | ?\} > \n) |
| 3105 | (sh "expression: " | 3106 | (sh "expression: " |
| 3106 | > "case " str " in" \n | 3107 | > "case " str " in" \n |
| 3107 | > (read-string "pattern: ") | 3108 | > (read-string "pattern: ") |
| @@ -3132,7 +3133,7 @@ This is always added to the end of the buffer." | |||
| 3132 | (rc eval sh-modify sh | 3133 | (rc eval sh-modify sh |
| 3133 | 2 "for( " | 3134 | 2 "for( " |
| 3134 | 6 " ) {" | 3135 | 6 " ) {" |
| 3135 | 15 ?} ) | 3136 | 15 ?\} ) |
| 3136 | (sh "Index variable: " | 3137 | (sh "Index variable: " |
| 3137 | > "for " str " in " _ "; do" \n | 3138 | > "for " str " in " _ "; do" \n |
| 3138 | > _ | ?$ & (sh-remember-variable str) \n | 3139 | > _ | ?$ & (sh-remember-variable str) \n |
| @@ -3171,7 +3172,7 @@ This is always added to the end of the buffer." | |||
| 3171 | (read-string "upper limit: ") | 3172 | (read-string "upper limit: ") |
| 3172 | "; i++ ) print i }'`}) {" \n | 3173 | "; i++ ) print i }'`}) {" \n |
| 3173 | > _ ?$ (sh-remember-variable str) \n | 3174 | > _ ?$ (sh-remember-variable str) \n |
| 3174 | ?} > \n) | 3175 | ?\} > \n) |
| 3175 | (sh "Index variable: " | 3176 | (sh "Index variable: " |
| 3176 | > "for " str " in `awk 'BEGIN { for( i=1; i<=" | 3177 | > "for " str " in `awk 'BEGIN { for( i=1; i<=" |
| 3177 | (read-string "upper limit: ") | 3178 | (read-string "upper limit: ") |
| @@ -3285,7 +3286,7 @@ t means to return a list of all possible completions of STRING. | |||
| 3285 | "} {" > \n | 3286 | "} {" > \n |
| 3286 | > _ \n | 3287 | > _ \n |
| 3287 | resume: | 3288 | resume: |
| 3288 | ?} > \n) | 3289 | ?\} > \n) |
| 3289 | (rc "condition: " | 3290 | (rc "condition: " |
| 3290 | > "if( " str " ) {" \n | 3291 | > "if( " str " ) {" \n |
| 3291 | > _ \n | 3292 | > _ \n |
| @@ -3295,7 +3296,7 @@ t means to return a list of all possible completions of STRING. | |||
| 3295 | "} else {" > \n | 3296 | "} else {" > \n |
| 3296 | > _ \n | 3297 | > _ \n |
| 3297 | resume: | 3298 | resume: |
| 3298 | ?} > \n) | 3299 | ?\} > \n) |
| 3299 | (sh "condition: " | 3300 | (sh "condition: " |
| 3300 | '(setq input (sh-feature sh-test)) | 3301 | '(setq input (sh-feature sh-test)) |
| 3301 | > "if " str "; then" \n | 3302 | > "if " str "; then" \n |
| @@ -3315,7 +3316,7 @@ t means to return a list of all possible completions of STRING. | |||
| 3315 | (es nil | 3316 | (es nil |
| 3316 | > "forever {" \n | 3317 | > "forever {" \n |
| 3317 | > _ \n | 3318 | > _ \n |
| 3318 | ?} > \n) | 3319 | ?\} > \n) |
| 3319 | (zsh "factor: " | 3320 | (zsh "factor: " |
| 3320 | > "repeat " str "; do" > \n | 3321 | > "repeat " str "; do" > \n |
| 3321 | > \n | 3322 | > \n |
| @@ -3355,8 +3356,8 @@ t means to return a list of all possible completions of STRING. | |||
| 3355 | "throw $e" \n | 3356 | "throw $e" \n |
| 3356 | "} {" > \n | 3357 | "} {" > \n |
| 3357 | _ \n | 3358 | _ \n |
| 3358 | ?} > \n | 3359 | ?\} > \n |
| 3359 | ?} > \n) | 3360 | ?\} > \n) |
| 3360 | (ksh88 eval sh-modify sh | 3361 | (ksh88 eval sh-modify sh |
| 3361 | 7 "EXIT") | 3362 | 7 "EXIT") |
| 3362 | (rc (file-name-nondirectory (buffer-file-name)) | 3363 | (rc (file-name-nondirectory (buffer-file-name)) |
| @@ -3390,11 +3391,11 @@ t means to return a list of all possible completions of STRING. | |||
| 3390 | (es eval sh-modify sh | 3391 | (es eval sh-modify sh |
| 3391 | 3 "while { " | 3392 | 3 "while { " |
| 3392 | 5 " } {" | 3393 | 5 " } {" |
| 3393 | 10 ?} ) | 3394 | 10 ?\} ) |
| 3394 | (rc eval sh-modify sh | 3395 | (rc eval sh-modify sh |
| 3395 | 3 "while( " | 3396 | 3 "while( " |
| 3396 | 5 " ) {" | 3397 | 5 " ) {" |
| 3397 | 10 ?} ) | 3398 | 10 ?\} ) |
| 3398 | (sh "condition: " | 3399 | (sh "condition: " |
| 3399 | '(setq input (sh-feature sh-test)) | 3400 | '(setq input (sh-feature sh-test)) |
| 3400 | > "while " str "; do" \n | 3401 | > "while " str "; do" \n |