Commit b8acc4ed authored by Glenn Morris's avatar Glenn Morris
Browse files

(sh-builtins): Add bash `shopt' builtin.

(sh-font-lock-keywords, sh-feature): Fix previous change of sh-feature
to avoid infloop with sh-font-lock-keywords.
parent dd130f1d
...@@ -572,8 +572,8 @@ documents - you must insert literal tabs by hand.") ...@@ -572,8 +572,8 @@ documents - you must insert literal tabs by hand.")
'((bash sh-append posix '((bash sh-append posix
"." "alias" "bg" "bind" "builtin" "compgen" "complete" "." "alias" "bg" "bind" "builtin" "compgen" "complete"
"declare" "dirs" "disown" "enable" "fc" "fg" "help" "history" "declare" "dirs" "disown" "enable" "fc" "fg" "help" "history"
"jobs" "kill" "let" "local" "popd" "printf" "pushd" "source" "jobs" "kill" "let" "local" "popd" "printf" "pushd" "shopt"
"suspend" "typeset" "unalias") "source" "suspend" "typeset" "unalias")
;; The next entry is only used for defining the others ;; The next entry is only used for defining the others
(bourne sh-append shell (bourne sh-append shell
...@@ -796,35 +796,35 @@ See `sh-feature'.") ...@@ -796,35 +796,35 @@ See `sh-feature'.")
(defvar sh-font-lock-keywords (defvar sh-font-lock-keywords
'((csh sh-append shell '((csh sh-append shell
'("\\${?[#?]?\\([A-Za-z_][A-Za-z0-9_]*\\|0\\)" 1 ("\\${?[#?]?\\([A-Za-z_][A-Za-z0-9_]*\\|0\\)" 1
font-lock-variable-name-face)) font-lock-variable-name-face))
(es sh-append executable-font-lock-keywords (es sh-append executable-font-lock-keywords
'("\\$#?\\([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))
(rc sh-append es) (rc sh-append es)
(sh sh-append shell (sh sh-append shell
;; Variable names. ;; Variable names.
'("\\$\\({#?\\)?\\([A-Za-z_][A-Za-z0-9_]*\\|[-#?@!]\\)" 2 ("\\$\\({#?\\)?\\([A-Za-z_][A-Za-z0-9_]*\\|[-#?@!]\\)" 2
font-lock-variable-name-face) font-lock-variable-name-face)
;; Function names. ;; Function names.
'("^\\(\\sw+\\)[ \t]*(" 1 font-lock-function-name-face) ("^\\(\\sw+\\)[ \t]*(" 1 font-lock-function-name-face)
'("\\<\\(function\\)\\>[ \t]*\\(\\sw+\\)?" ("\\<\\(function\\)\\>[ \t]*\\(\\sw+\\)?"
(1 font-lock-keyword-face) (2 font-lock-function-name-face nil t))) (1 font-lock-keyword-face) (2 font-lock-function-name-face nil t)))
;; The next entry is only used for defining the others ;; The next entry is only used for defining the others
(shell sh-append executable-font-lock-keywords (shell sh-append executable-font-lock-keywords
;; Using font-lock-string-face here confuses sh-get-indent-info. ;; Using font-lock-string-face here confuses sh-get-indent-info.
'("\\\\$" 0 font-lock-warning-face) ("\\\\$" 0 font-lock-warning-face)
'("\\\\[^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))
(rpm sh-append rpm2 (rpm sh-append rpm2
'("%{?\\(\\sw+\\)" 1 font-lock-keyword-face)) ("%{?\\(\\sw+\\)" 1 font-lock-keyword-face))
(rpm2 sh-append shell (rpm2 sh-append shell
'("^\\(\\sw+\\):" 1 font-lock-variable-name-face))) ("^\\(\\sw+\\):" 1 font-lock-variable-name-face)))
"Default expressions to highlight in Shell Script modes. 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
...@@ -1568,7 +1568,9 @@ in ALIST." ...@@ -1568,7 +1568,9 @@ in ALIST."
(setq val (setq val
(apply 'sh-append (apply 'sh-append
(let ((sh-shell (car (cdr val)))) (let ((sh-shell (car (cdr val))))
(sh-feature alist)) (if (assq sh-shell alist)
(sh-feature alist)
(eval sh-shell)))
(cddr val))))) (cddr val)))))
(if function (if function
(nconc alist (nconc alist
......
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