]> git.eshelyaron.com Git - emacs.git/commitdiff
Allow more shell script defun forms
authorCarlos Pita <carlosjosepita@gmail.com>
Tue, 23 Feb 2016 11:15:00 +0000 (22:15 +1100)
committerLars Ingebrigtsen <larsi@gnus.org>
Tue, 23 Feb 2016 11:16:26 +0000 (22:16 +1100)
* lisp/progmodes/sh-script.el (sh-mode): Allow more shell
script defun forms, like function name () {...} (bug#19754).

lisp/progmodes/sh-script.el

index 7f89ab2762c389eb93fc5e6a60ce3c0aeff4eb72..5f29bb64f05d1c69db5d7c9349963c7a1862116c 100644 (file)
@@ -1661,7 +1661,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)