Function: semantic-stickyfunc-fetch-stickyline
semantic-stickyfunc-fetch-stickyline is a byte-compiled function
defined in util-modes.el.gz.
Signature
(semantic-stickyfunc-fetch-stickyline)
Documentation
Make the function at the top of the current window sticky.
Capture its function declaration, and place it in the header line. If there is no function, disable the header line.
Source Code
;; Defined in /usr/src/emacs/lisp/cedet/semantic/util-modes.el.gz
(defun semantic-stickyfunc-fetch-stickyline ()
"Make the function at the top of the current window sticky.
Capture its function declaration, and place it in the header line.
If there is no function, disable the header line."
(save-excursion
(goto-char (window-start (selected-window)))
(let* ((noshow (bobp))
(str
(progn
(forward-line -1)
(end-of-line)
;; Capture this function
(let* ((tag (semantic-stickyfunc-tag-to-stick)))
;; TAG is nil if there was nothing of the appropriate type there.
(if (not tag)
;; Set it to be the text under the header line
(if noshow
""
(if semantic-stickyfunc-show-only-functions-p ""
(buffer-substring (point-at-bol) (point-at-eol))
))
;; Go get the first line of this tag.
(goto-char (semantic-tag-start tag))
;; Klaus Berndl <klaus.berndl@sdm.de>:
;; goto the tag name; this is especially needed for languages
;; like c++ where an often used style is like:
;; void
;; ClassX::methodM(arg1...)
;; {
;; ...
;; }
;; Without going to the tag-name we would get"void" in the
;; header line which is IMHO not really useful
(search-forward (semantic-tag-name tag) nil t)
(buffer-substring (point-at-bol) (point-at-eol))
))))
(start 0))
(while (string-match "%" str start)
(setq str (replace-match "%%" t t str 0)
start (1+ (match-end 0)))
)
;; In 21.4 (or 22.1) the header doesn't expand tabs. Hmmmm.
;; We should replace them here.
;;
;; This hack assumes that tabs are kept smartly at tab boundaries
;; instead of in a tab boundary where it might only represent 4 spaces.
(while (string-match "\t" str start)
(setq str (replace-match " " t t str 0)))
str)))