Function: sh-current-defun-name

sh-current-defun-name is a byte-compiled function defined in sh-script.el.gz.

Signature

(sh-current-defun-name)

Documentation

Find the name of function or variable at point.

For use in add-log-current-defun-function.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/sh-script.el.gz
(defun sh-current-defun-name ()
  "Find the name of function or variable at point.
For use in `add-log-current-defun-function'."
  (save-excursion
    (end-of-line)
    (when (re-search-backward
	   (concat "\\(?:"
		   ;; function FOO
		   ;; function FOO()
		   "^\\s-*function\\s-+\\([[:alpha:]_][[:alnum:]_]*\\)\\s-*\\(?:()\\)?"
		   "\\)\\|\\(?:"
		   ;; FOO()
		   "^\\s-*\\([[:alpha:]_][[:alnum:]_]*\\)\\s-*()"
		   "\\)\\|\\(?:"
		   ;; FOO=
		   "^\\([[:alpha:]_][[:alnum:]_]*\\)="
		   "\\)")
	   nil t)
      (or (match-string-no-properties 1)
	  (match-string-no-properties 2)
	  (match-string-no-properties 3)))))