Function: semantic-ctxt-current-function-emacs-lisp-mode

semantic-ctxt-current-function-emacs-lisp-mode is a byte-compiled function defined in el.el.gz.

Signature

(semantic-ctxt-current-function-emacs-lisp-mode &optional POINT SAME-AS-SYMBOL-RETURN)

Documentation

Return a string which is the current function being called.

Override semantic-ctxt-current-function in emacs-lisp-mode buffers.

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/semantic/bovine/el.el.gz
(define-mode-local-override semantic-ctxt-current-function emacs-lisp-mode
  (&optional point same-as-symbol-return)
  "Return a string which is the current function being called."
  (save-excursion
    (if point (goto-char point) (setq point (point)))
    ;; (semantic-beginning-of-command)
    (if (condition-case nil
	    (and (save-excursion
		   (up-list -2)
		   (looking-at "(("))
		 (save-excursion
		   (up-list -3)
		   (looking-at "(let")))
	  (error nil))
	;; This is really a let statement, not a function.
	nil
      (let ((fun (condition-case nil
		     (save-excursion
		       (up-list -1)
		       (forward-char 1)
		       (buffer-substring-no-properties
			(point) (progn (forward-sexp 1)
				       (point))))
		   (error nil))
		 ))
	(when fun
	  ;; Do not return FUN IFF the cursor is on FUN.
	  ;; Huh?  That's because if cursor is on fun, it is
	  ;; the current symbol, and not the current function.
	  (if (save-excursion
		(condition-case nil
		    (progn (forward-sexp -1)
			   (and
			    (looking-at (regexp-quote fun))
			    (<= point (+ (point) (length fun))))
			   )
		  (error t)))
	      ;; Go up and try again.
	      same-as-symbol-return
	    ;; We are ok, so get it.
	    (list fun))
	  ))
      )))