diff options
| author | Stefan Monnier | 2001-03-07 15:34:43 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2001-03-07 15:34:43 +0000 |
| commit | bffd712e4a5622d6e4dff5a95b7e8ab0cb1cd065 (patch) | |
| tree | 3311c57ad7c4fcf1c8237a3a9630e12742e66aa4 | |
| parent | 5aaaec5d6ff03ec2470fc4941f14b0be3729aa3c (diff) | |
| download | emacs-bffd712e4a5622d6e4dff5a95b7e8ab0cb1cd065.tar.gz emacs-bffd712e4a5622d6e4dff5a95b7e8ab0cb1cd065.zip | |
(sh-st-symbol): New symbol.
(sh-font-lock-syntactic-keywords): Use it and fix bogus comment regexp.
(sh-mode): Remove `make-local-variable' for unused var
`font-lock-unfontify-region-function'.
| -rw-r--r-- | lisp/progmodes/sh-script.el | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index d99e3130870..c5339ac45f2 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el | |||
| @@ -814,6 +814,7 @@ See `sh-feature'.") | |||
| 814 | ;; These are used for the syntax table stuff (derived from cperl-mode). | 814 | ;; These are used for the syntax table stuff (derived from cperl-mode). |
| 815 | ;; Note: parse-sexp-lookup-properties must be set to t for it to work. | 815 | ;; Note: parse-sexp-lookup-properties must be set to t for it to work. |
| 816 | (defconst sh-st-punc (string-to-syntax ".")) | 816 | (defconst sh-st-punc (string-to-syntax ".")) |
| 817 | (defconst sh-st-symbol (string-to-syntax "_")) | ||
| 817 | (defconst sh-here-doc-syntax (string-to-syntax "|")) ;; generic string | 818 | (defconst sh-here-doc-syntax (string-to-syntax "|")) ;; generic string |
| 818 | 819 | ||
| 819 | (defun sh-font-lock-heredoc (start string quoted) | 820 | (defun sh-font-lock-heredoc (start string quoted) |
| @@ -867,15 +868,11 @@ See `sh-feature'.") | |||
| 867 | sh-st-punc))) | 868 | sh-st-punc))) |
| 868 | 869 | ||
| 869 | (defconst sh-font-lock-syntactic-keywords | 870 | (defconst sh-font-lock-syntactic-keywords |
| 870 | ;; Mark a `#' character as having punctuation syntax in a variable reference. | 871 | ;; A `#' begins a comment when it is unquoted and at the beginning of a |
| 871 | ;; Really we should do this properly. From Chet Ramey and Brian Fox: | 872 | ;; word. In the shell, words are separated by metacharacters. |
| 872 | ;; "A `#' begins a comment when it is unquoted and at the beginning of a | 873 | ;; The list of special chars is taken from the single-unix spec |
| 873 | ;; word. In the shell, words are separated by metacharacters." | 874 | ;; of the shell command language (under `quoting') but with `$' removed. |
| 874 | ;; To do this in a regexp would be slow as it would be anchored to the right. | 875 | `(("[^|&;<>()`\\\"' \t\n]\\(#+\\)" 1 ,sh-st-symbol) |
| 875 | ;; But I can't be bothered to write a function to do it properly and | ||
| 876 | ;; efficiently. So we only do it properly for `#' in variable references and | ||
| 877 | ;; do it efficiently by anchoring the regexp to the left. | ||
| 878 | `(("\\${?[^}#\n\t ]*\\(##?\\)" 1 ,sh-st-punc) | ||
| 879 | ;; Find HEREDOC starters and add a corresponding rule for the ender. | 876 | ;; Find HEREDOC starters and add a corresponding rule for the ender. |
| 880 | ("[^<>]<<\\(-\\)?\\s-*\\(\\(['\"][^'\"]+['\"]\\|\\sw\\|\\s_\\)+\\).*\\(\n\\)" | 877 | ("[^<>]<<\\(-\\)?\\s-*\\(\\(['\"][^'\"]+['\"]\\|\\sw\\|\\s_\\)+\\).*\\(\n\\)" |
| 881 | 4 (sh-font-lock-heredoc | 878 | 4 (sh-font-lock-heredoc |
| @@ -1257,7 +1254,6 @@ with your script for an edit-interpret-debug cycle." | |||
| 1257 | (make-local-variable 'sh-shell-variables-initialized) | 1254 | (make-local-variable 'sh-shell-variables-initialized) |
| 1258 | (make-local-variable 'imenu-generic-expression) | 1255 | (make-local-variable 'imenu-generic-expression) |
| 1259 | (make-local-variable 'sh-indent-supported-here) | 1256 | (make-local-variable 'sh-indent-supported-here) |
| 1260 | (make-local-variable 'font-lock-unfontify-region-function) | ||
| 1261 | (setq skeleton-end-hook (lambda () | 1257 | (setq skeleton-end-hook (lambda () |
| 1262 | (or (eolp) (newline) (indent-relative))) | 1258 | (or (eolp) (newline) (indent-relative))) |
| 1263 | paragraph-start (concat page-delimiter "\\|$") | 1259 | paragraph-start (concat page-delimiter "\\|$") |