Function: semantic-sb-one-button

semantic-sb-one-button is a byte-compiled function defined in sb.el.gz.

Signature

(semantic-sb-one-button TAG DEPTH &optional PREFIX)

Documentation

Insert TAG as a speedbar button at DEPTH.

Optional PREFIX is used to specify special marker characters.

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/semantic/sb.el.gz
(defun semantic-sb-one-button (tag depth &optional prefix)
  "Insert TAG as a speedbar button at DEPTH.
Optional PREFIX is used to specify special marker characters."
  (let* ((class (semantic-tag-class tag))
	 (edata (semantic-sb-tag-children-to-expand tag))
	 (type (semantic-tag-type tag))
	 (abbrev (semantic-sb-with-tag-buffer tag
		   (funcall semantic-sb-button-format-tag-function tag)))
	 (start (point))
	 (end (progn
		(insert (int-to-string depth) ":")
		(point))))
    (insert-char ?  (1- depth) nil)
    (put-text-property end (point) 'invisible nil)
    ;; take care of edata = (nil) -- a yucky but hard to clean case
    (if (and edata (listp edata) (and (<= (length edata) 1) (not (car edata))))
	(setq edata nil))
    (if (and (not edata)
	     (member class '(variable function))
	     type)
	(setq edata t))
    ;; types are a bit unique.  Variable types can have special meaning.
    (if edata
	(speedbar-insert-button (if prefix (concat " +" prefix) " +>")
				'speedbar-button-face
				'speedbar-highlight-face
				'semantic-sb-show-extra
				tag t)
      (speedbar-insert-button (if prefix (concat "  " prefix) " =>")
			      nil nil nil nil t))
    (speedbar-insert-button abbrev
			    'speedbar-tag-face
			    'speedbar-highlight-face
			    'semantic-sb-token-jump
			    tag t)
    ;; This is very bizarre.  When this was just after the insertion
    ;; of the depth: text, the : would get erased, but only for the
    ;; auto-expanded short- buckets.  Move back for a later version
    ;; version of Emacs 21 CVS
    (put-text-property start end 'invisible t)
    ))