summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Pita <carlosjosepita@gmail.com>2016-02-23 22:15:00 +1100
committerNoam Postavsky <npostavs@gmail.com>2016-10-02 09:55:26 -0400
commit5266c1180e3263aebcc2c1020457fe03ce74e61a (patch)
treeb2ea2f3d69487fbd30b2fcb88c9702312e64e0f2
parent95d55203ee7d1c3e3d131abee6c890bc0c062d58 (diff)
downloademacs-5266c1180e3263aebcc2c1020457fe03ce74e61a.tar.gz
Allow more shell script defun forms
* lisp/progmodes/sh-script.el (sh-mode): Allow more shell script defun forms, like function name () {...} (bug#19754). (cherry picked from commit c817549b520ce3b10a949f00fcabf8a3a62697ae)
-rw-r--r--lisp/progmodes/sh-script.el7
1 files changed, 6 insertions, 1 deletions
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index f089c81fe56..789bc86ca90 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -1662,7 +1662,12 @@ with your script for an edit-interpret-debug cycle."
(setq-local skeleton-filter-function 'sh-feature)
(setq-local skeleton-newline-indent-rigidly t)
(setq-local defun-prompt-regexp
- (concat "^\\(function[ \t]\\|[[:alnum:]]+[ \t]+()[ \t]+\\)"))
+ (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)