Commit 38c979d3 authored by Simon Marshall's avatar Simon Marshall
Browse files

Update for syntax-table text properties.

sh-script.el now directs font-lock.el to add them to instances of # which are not comments.
parent 3bef4cbd
...@@ -224,7 +224,6 @@ the car and cdr are the same symbol.") ...@@ -224,7 +224,6 @@ the car and cdr are the same symbol.")
?\" "\"\"" ?\" "\"\""
?\' "\"'" ?\' "\"'"
?\` "\"`" ?\` "\"`"
?$ "\\" ; `escape' so $# doesn't start a comment
?! "_" ?! "_"
?% "_" ?% "_"
?: "_" ?: "_"
...@@ -605,15 +604,18 @@ See `sh-feature'.") ...@@ -605,15 +604,18 @@ See `sh-feature'.")
'("\\\\[^A-Za-z0-9]" 0 font-lock-string-face) '("\\\\[^A-Za-z0-9]" 0 font-lock-string-face)
'("\\${?\\([A-Za-z_][A-Za-z0-9_]*\\|[0-9]+\\|[$*_]\\)" 1 '("\\${?\\([A-Za-z_][A-Za-z0-9_]*\\|[0-9]+\\|[$*_]\\)" 1
font-lock-variable-name-face))) font-lock-variable-name-face)))
"*Rules for highlighting shell scripts. See `sh-feature'.") "Default expressions to highlight in Shell Script modes. See `sh-feature'.")
(defvar sh-font-lock-keywords-1 (defvar sh-font-lock-keywords-1
'((sh "[ \t]in\\>")) '((sh "[ \t]in\\>"))
"*Additional rules for highlighting shell scripts. See `sh-feature'.") "Subdued level highlighting for Shell Script modes.")
(defvar sh-font-lock-keywords-2 () (defvar sh-font-lock-keywords-2 ()
"*Yet more rules for highlighting shell scripts. See `sh-feature'.") "Gaudy level highlighting for Shell Script modes.")
(defconst sh-font-lock-syntactic-keywords
;; Mark a `#' character as having punctuation syntax in a variable reference.
'(("\\$[({]?\\(#\\)" 1 (1 . nil))))
;; mode-command and utility functions ;; mode-command and utility functions
...@@ -709,12 +711,11 @@ with your script for an edit-interpret-debug cycle." ...@@ -709,12 +711,11 @@ with your script for an edit-interpret-debug cycle."
;; we can't look if previous line ended with `\' ;; we can't look if previous line ended with `\'
comint-prompt-regexp "^[ \t]*" comint-prompt-regexp "^[ \t]*"
font-lock-defaults font-lock-defaults
`((sh-font-lock-keywords '((sh-font-lock-keywords
sh-font-lock-keywords-1 sh-font-lock-keywords-1 sh-font-lock-keywords-2)
sh-font-lock-keywords-2) nil nil
nil nil ((?/ . "w") (?~ . "w") (?. . "w") (?- . "w") (?_ . "w")) nil
((?/ . "w") (?~ . "w") (?. . "w") (?- . "w") (?_ . "w")) nil (font-lock-syntactic-keywords . sh-font-lock-syntactic-keywords))
(font-lock-comment-start-regexp . "#"))
skeleton-pair-alist '((?` _ ?`)) skeleton-pair-alist '((?` _ ?`))
skeleton-pair-filter 'sh-quoted-p skeleton-pair-filter 'sh-quoted-p
skeleton-further-elements '((< '(- (min sh-indentation skeleton-further-elements '((< '(- (min sh-indentation
...@@ -727,8 +728,7 @@ with your script for an edit-interpret-debug cycle." ...@@ -727,8 +728,7 @@ with your script for an edit-interpret-debug cycle."
(save-excursion (save-excursion
(goto-char (point-min)) (goto-char (point-min))
(if (looking-at "#![ \t]?\\([^ \t\n]*/bin/env[ \t]\\)?\\([^ \t\n]+\\)") (if (looking-at "#![ \t]?\\([^ \t\n]*/bin/env[ \t]\\)?\\([^ \t\n]+\\)")
(buffer-substring (match-beginning 2) (match-string 2)))))
(match-end 2))))))
(if interpreter (if interpreter
(sh-set-shell interpreter nil nil) (sh-set-shell interpreter nil nil)
;; If we don't know the shell for this file, ;; If we don't know the shell for this file,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment