Function: idlwave-what-function

idlwave-what-function is a byte-compiled function defined in idlwave.el.gz.

Signature

(idlwave-what-function &optional BOUND)

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/idlwave.el.gz
(defun idlwave-what-function (&optional bound)
  ;; Find out if point is within the argument list of a function.
  ;; The return value is ("function-name" class arrow-start (point) level).
  ;; Level is 1 on the top level parentheses, higher further down.

  ;; If the optional BOUND is an integer, bound backwards directed
  ;;    searches to this point.

  (catch 'exit
    (let (pos
	  func-point
	  (cnt 0)
	  func arrow-start class)
      (with-syntax-table idlwave-find-symbol-syntax-table
       (save-restriction
	 (save-excursion
	   (narrow-to-region (max 1 (or bound 0)) (point-max))
	   ;; move back out of the current parenthesis
	   (while (condition-case nil
		      (progn (up-list -1) t)
		    (error nil))
	     (setq pos (point))
	     (cl-incf cnt)
	     (when (and (= (following-char) ?\()
			(re-search-backward
			 "\\(::\\|\\<\\)\\([a-zA-Z][a-zA-Z0-9$_]*\\)[ \t]*\\="
			 bound t))
	       (setq func (match-string 2)
		     func-point (goto-char (match-beginning 2))
		     pos func-point)
	       (if (re-search-backward
		    "->[ \t]*\\(\\([a-zA-Z][a-zA-Z0-9$_]*\\)::\\)?\\=" bound t)
		   (setq arrow-start (copy-marker (match-beginning 0))
			 class (or (match-string 2) t)))
	       (throw
		'exit
		(list
		 (idlwave-sintern-routine-or-method func class)
		 (idlwave-sintern-class class)
		 arrow-start func-point cnt)))
	     (goto-char pos))
	   (throw 'exit nil)))))))