Function: srecode-up-context-get-name

srecode-up-context-get-name is a byte-compiled function defined in srt-mode.el.gz.

Signature

(srecode-up-context-get-name &optional POINT FIND-UNMATCHED)

Documentation

Move up one context as for semantic-up-context, and return the name.

Moves point to the opening characters of the section macro text. If there is no upper context, return nil. Starts at POINT if provided. If FIND-UNMATCHED is specified as non-nil, then we are looking for an unmatched section.

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/srecode/srt-mode.el.gz
(defun srecode-up-context-get-name (&optional point find-unmatched)
  "Move up one context as for `semantic-up-context', and return the name.
Moves point to the opening characters of the section macro text.
If there is no upper context, return nil.
Starts at POINT if provided.
If FIND-UNMATCHED is specified as non-nil, then we are looking for an unmatched
section."
  (when point (goto-char (point)))
  (let* ((tag (semantic-current-tag))
	 (es (regexp-quote (srecode-template-get-escape-start)))
	 (start (concat es "[#<]\\(\\w+\\)"))
	 (orig (point))
	 (name nil)
	 (res nil))
    (when (semantic-tag-of-class-p tag 'function)
      (while (and (not res)
		  (re-search-backward start (semantic-tag-start tag) t))
	(when (save-excursion
		(setq name (match-string 1))
		(let ((endr (concat es "/" name)))
		  (if (re-search-forward endr (semantic-tag-end tag) t)
		      (< orig (point))
		    (if (not find-unmatched)
			(error "Unmatched Section Template")
		      ;; We found what we want.
		      t))))
	  (setq res (point)))
	)
      ;; Restore in no result found.
      (goto-char (or res orig))
      name)))