Function: sh-base-mode
sh-base-mode is an autoloaded, interactive and byte-compiled function
defined in sh-script.el.gz.
Signature
(sh-base-mode)
Documentation
Generic major mode for editing shell scripts.
This is a generic major mode intended to be inherited by concrete
implementations. Currently there are two: sh-mode and
bash-ts-mode.
In addition to any hooks its parent mode prog-mode might have run,
this mode runs the hook sh-base-mode-hook, as the final or
penultimate step during initialization.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/sh-script.el.gz
;;;###autoload
(define-derived-mode sh-base-mode prog-mode "Shell-script"
"Generic major mode for editing shell scripts.
This is a generic major mode intended to be inherited by concrete
implementations. Currently there are two: `sh-mode' and
`bash-ts-mode'."
(make-local-variable 'sh-shell-file)
(make-local-variable 'sh-shell)
(setq-local skeleton-pair-default-alist
sh-skeleton-pair-default-alist)
(setq-local paragraph-start (concat page-delimiter "\\|$"))
(setq-local paragraph-separate (concat paragraph-start "\\|#!/"))
(setq-local comment-start "# ")
(setq-local comment-start-skip "#+[\t ]*")
(setq-local local-abbrev-table sh-mode-abbrev-table)
(setq-local comint-dynamic-complete-functions
sh-dynamic-complete-functions)
(add-hook 'completion-at-point-functions #'comint-completion-at-point nil t)
;; we can't look if previous line ended with `\'
(setq-local comint-prompt-regexp "^[ \t]*")
(setq-local imenu-case-fold-search nil)
(setq-local syntax-propertize-function #'sh-syntax-propertize-function)
(add-hook 'syntax-propertize-extend-region-functions
#'syntax-propertize-multiline 'append 'local)
(setq-local skeleton-pair-alist '((?` _ ?`)))
(setq-local skeleton-pair-filter-function #'sh-quoted-p)
(setq-local skeleton-further-elements
'((< '(- (min sh-basic-offset (current-column))))))
(setq-local skeleton-filter-function #'sh-feature)
(setq-local skeleton-newline-indent-rigidly t)
(setq-local defun-prompt-regexp
(concat
"^\\("
"\\(function[ \t]\\)?[ \t]*[[:alnum:]_]+[ \t]*([ \t]*)"
"\\|"
"function[ \t]+[[:alnum:]_]+[ \t]*\\(([ \t]*)\\)?"
"\\)[ \t]*"))
(setq-local add-log-current-defun-function #'sh-current-defun-name)
(add-hook 'completion-at-point-functions
#'sh-completion-at-point-function nil t)
(setq-local outline-regexp "###")
(setq-local escaped-string-quote
(lambda (terminator)
(if (eq terminator ?')
"'\\'"
"\\"))))