diff options
| author | Stefan Monnier | 2003-06-01 17:36:41 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2003-06-01 17:36:41 +0000 |
| commit | 485219e0a2c1ce8be3f3179a6129bd540275ce60 (patch) | |
| tree | 12f6b87c2d9435609863123572f8163da54afdf2 | |
| parent | 27e4fd45a6bc0273f632d3121ef94edc2e8d3efb (diff) | |
| download | emacs-485219e0a2c1ce8be3f3179a6129bd540275ce60.tar.gz emacs-485219e0a2c1ce8be3f3179a6129bd540275ce60.zip | |
(sh-is-quoted-p): New fun.
(sh-font-lock-paren): Use it to allow \C in case patterns.
(sh-get-indent-info): Check the \n before the line for string-status.
(sh-feature): Remove unused var `function'.
(sh-get-indent-info): Remove unused variables.
(sh-prev-thing): Remove unused vars `going', `n', and `found'.
(sh-set-indent): Remove unused var `new-val' and `val0'.
(sh-learn-buffer-indent): Remove unused vars `last-pos' and `lines'.
(sh-guess-basic-offset): Remove unused var `return' and `j'.
| -rw-r--r-- | lisp/progmodes/sh-script.el | 53 |
1 files changed, 18 insertions, 35 deletions
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index d5193e17e2c..49ca73a435c 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el | |||
| @@ -890,6 +890,10 @@ be indented (i.e. a <<- was used rather than just <<)." | |||
| 890 | ;; This looks silly, but it's because `sh-here-doc-re' keeps changing. | 890 | ;; This looks silly, but it's because `sh-here-doc-re' keeps changing. |
| 891 | (re-search-forward sh-here-doc-re limit t)) | 891 | (re-search-forward sh-here-doc-re limit t)) |
| 892 | 892 | ||
| 893 | (defun sh-is-quoted-p (pos) | ||
| 894 | (and (eq (char-before pos) ?\\) | ||
| 895 | (not (sh-is-quoted-p (1- pos))))) | ||
| 896 | |||
| 893 | (defun sh-font-lock-paren (start) | 897 | (defun sh-font-lock-paren (start) |
| 894 | (save-excursion | 898 | (save-excursion |
| 895 | (goto-char start) | 899 | (goto-char start) |
| @@ -900,7 +904,9 @@ be indented (i.e. a <<- was used rather than just <<)." | |||
| 900 | ;; Skip through one pattern | 904 | ;; Skip through one pattern |
| 901 | (while | 905 | (while |
| 902 | (or (/= 0 (skip-syntax-backward "w_")) | 906 | (or (/= 0 (skip-syntax-backward "w_")) |
| 903 | (/= 0 (skip-chars-backward "?*/")) | 907 | (/= 0 (skip-chars-backward "?*/\\")) |
| 908 | (and (sh-is-quoted-p (1- (point))) | ||
| 909 | (goto-char (- (point) 2))) | ||
| 904 | (when (memq (char-before) '(?\" ?\')) | 910 | (when (memq (char-before) '(?\" ?\')) |
| 905 | (condition-case nil (progn (backward-sexp 1) t) | 911 | (condition-case nil (progn (backward-sexp 1) t) |
| 906 | (error nil))))) | 912 | (error nil))))) |
| @@ -1536,8 +1542,7 @@ in ALIST." | |||
| 1536 | (setcdr elt | 1542 | (setcdr elt |
| 1537 | (setq val | 1543 | (setq val |
| 1538 | (eval (if (consp (setq val (cdr val))) | 1544 | (eval (if (consp (setq val (cdr val))) |
| 1539 | (let ((sh-shell (car (cdr val))) | 1545 | (let ((sh-shell (car (cdr val)))) |
| 1540 | function) | ||
| 1541 | (if (assq sh-shell list) | 1546 | (if (assq sh-shell list) |
| 1542 | (setcar (cdr val) | 1547 | (setcar (cdr val) |
| 1543 | (list 'quote | 1548 | (list 'quote |
| @@ -1947,28 +1952,20 @@ STRING This is ignored for the purposes of calculating | |||
| 1947 | what the indentation is based on." | 1952 | what the indentation is based on." |
| 1948 | ;; See comments before `sh-kw'. | 1953 | ;; See comments before `sh-kw'. |
| 1949 | (save-excursion | 1954 | (save-excursion |
| 1950 | (let ((prev-kw nil) | 1955 | (let ((have-result nil) |
| 1951 | (prev-stmt nil) | ||
| 1952 | (have-result nil) | ||
| 1953 | depth-bol depth-eol | ||
| 1954 | this-kw | 1956 | this-kw |
| 1955 | (state nil) | ||
| 1956 | state-bol | ||
| 1957 | (depth-prev-bol nil) | ||
| 1958 | start | 1957 | start |
| 1959 | func val | 1958 | val |
| 1960 | (result nil) | 1959 | (result nil) |
| 1961 | prev-lines-indent | ||
| 1962 | (prev-list nil) | ||
| 1963 | (this-list nil) | ||
| 1964 | (align-point nil) | 1960 | (align-point nil) |
| 1965 | prev-line-end x) | 1961 | prev-line-end x) |
| 1966 | (beginning-of-line) | 1962 | (beginning-of-line) |
| 1967 | ;; Note: setting result to t means we are done and will return nil. | 1963 | ;; Note: setting result to t means we are done and will return nil. |
| 1968 | ;;(This function never returns just t.) | 1964 | ;;(This function never returns just t.) |
| 1969 | (cond | 1965 | (cond |
| 1970 | ((or (and (boundp 'font-lock-string-face) | 1966 | ((or (and (boundp 'font-lock-string-face) (not (bobp)) |
| 1971 | (eq (get-text-property (point) 'face) font-lock-string-face)) | 1967 | (eq (get-text-property (1- (point)) 'face) |
| 1968 | font-lock-string-face)) | ||
| 1972 | (eq (get-text-property (point) 'face) sh-heredoc-face)) | 1969 | (eq (get-text-property (point) 'face) sh-heredoc-face)) |
| 1973 | (setq result t) | 1970 | (setq result t) |
| 1974 | (setq have-result t)) | 1971 | (setq have-result t)) |
| @@ -2265,11 +2262,8 @@ we go to the end of the previous line and do not check for continuations." | |||
| 2265 | ;; | 2262 | ;; |
| 2266 | (if (bolp) | 2263 | (if (bolp) |
| 2267 | nil | 2264 | nil |
| 2268 | (let ((going t) | 2265 | (let (c min-point |
| 2269 | c n | 2266 | (start (point))) |
| 2270 | min-point | ||
| 2271 | (start (point)) | ||
| 2272 | (found nil)) | ||
| 2273 | (save-restriction | 2267 | (save-restriction |
| 2274 | (narrow-to-region | 2268 | (narrow-to-region |
| 2275 | (if (sh-this-is-a-continuation) | 2269 | (if (sh-this-is-a-continuation) |
| @@ -2558,7 +2552,7 @@ for a new value for it." | |||
| 2558 | (sh-must-support-indent) | 2552 | (sh-must-support-indent) |
| 2559 | (let* ((info (sh-get-indent-info)) | 2553 | (let* ((info (sh-get-indent-info)) |
| 2560 | (var (sh-get-indent-var-for-line info)) | 2554 | (var (sh-get-indent-var-for-line info)) |
| 2561 | val val0 new-val old-val indent-val) | 2555 | val old-val indent-val) |
| 2562 | (if (stringp var) | 2556 | (if (stringp var) |
| 2563 | (message (format "Cannot set indent - %s" var)) | 2557 | (message (format "Cannot set indent - %s" var)) |
| 2564 | (setq old-val (symbol-value var)) | 2558 | (setq old-val (symbol-value var)) |
| @@ -2753,7 +2747,6 @@ This command can often take a long time to run." | |||
| 2753 | (let ((learned-var-list nil) | 2747 | (let ((learned-var-list nil) |
| 2754 | (out-buffer "*indent*") | 2748 | (out-buffer "*indent*") |
| 2755 | (num-diffs 0) | 2749 | (num-diffs 0) |
| 2756 | last-pos | ||
| 2757 | previous-set-info | 2750 | previous-set-info |
| 2758 | (max 17) | 2751 | (max 17) |
| 2759 | vec | 2752 | vec |
| @@ -2914,14 +2907,7 @@ This command can often take a long time to run." | |||
| 2914 | (append (list (list 'sh-indent-comment comment-col (point-max))) | 2907 | (append (list (list 'sh-indent-comment comment-col (point-max))) |
| 2915 | learned-var-list)) | 2908 | learned-var-list)) |
| 2916 | (setq sh-indent-comment comment-col) | 2909 | (setq sh-indent-comment comment-col) |
| 2917 | (let ((name (buffer-name)) | 2910 | (let ((name (buffer-name))) |
| 2918 | (lines (if (and (eq (point-min) 1) | ||
| 2919 | (eq (point-max) (1+ (buffer-size)))) | ||
| 2920 | "" | ||
| 2921 | (format "lines %d to %d of " | ||
| 2922 | (1+ (count-lines 1 (point-min))) | ||
| 2923 | (1+ (count-lines 1 (point-max)))))) | ||
| 2924 | ) | ||
| 2925 | (sh-mark-line "\nLearned variable settings:" nil out-buffer) | 2911 | (sh-mark-line "\nLearned variable settings:" nil out-buffer) |
| 2926 | (if arg | 2912 | (if arg |
| 2927 | ;; Set learned variables to symbolic rather than numeric | 2913 | ;; Set learned variables to symbolic rather than numeric |
| @@ -2966,12 +2952,9 @@ Return values: | |||
| 2966 | nil - we couldn't find a reasonable one." | 2952 | nil - we couldn't find a reasonable one." |
| 2967 | (let* ((max (1- (length vec))) | 2953 | (let* ((max (1- (length vec))) |
| 2968 | (i 1) | 2954 | (i 1) |
| 2969 | (totals (make-vector max 0)) | 2955 | (totals (make-vector max 0))) |
| 2970 | (return nil) | ||
| 2971 | j) | ||
| 2972 | (while (< i max) | 2956 | (while (< i max) |
| 2973 | (aset totals i (+ (aref totals i) (* 4 (aref vec i)))) | 2957 | (aset totals i (+ (aref totals i) (* 4 (aref vec i)))) |
| 2974 | (setq j (/ i 2)) | ||
| 2975 | (if (zerop (% i 2)) | 2958 | (if (zerop (% i 2)) |
| 2976 | (aset totals i (+ (aref totals i) (aref vec (/ i 2))))) | 2959 | (aset totals i (+ (aref totals i) (aref vec (/ i 2))))) |
| 2977 | (if (< (* i 2) max) | 2960 | (if (< (* i 2) max) |