Function: speedbar-make-tag-line

speedbar-make-tag-line is a byte-compiled function defined in speedbar.el.gz.

Signature

(speedbar-make-tag-line EXP-BUTTON-TYPE EXP-BUTTON-CHAR EXP-BUTTON-FUNCTION EXP-BUTTON-DATA TAG-BUTTON TAG-BUTTON-FUNCTION TAG-BUTTON-DATA TAG-BUTTON-FACE DEPTH)

Documentation

Create a tag line with EXP-BUTTON-TYPE for the small expansion button.

This is the button that expands or contracts a node (if applicable), and EXP-BUTTON-CHAR the character in it (+, -, ?, etc). EXP-BUTTON-FUNCTION is the function to call if it's clicked on. Button types are bracket, angle, curly, expandtag, statictag, t, or nil. EXP-BUTTON-DATA is extra data attached to the text forming the expansion button.

Next, TAG-BUTTON is the text of the tag. TAG-BUTTON-FUNCTION is the function to call if clicked on, and TAG-BUTTON-DATA is the data to attach to the text field (such a tag positioning, etc). TAG-BUTTON-FACE is a face used for this type of tag.

Lastly, DEPTH shows the depth of expansion.

This function assumes that the cursor is in the speedbar window at the position to insert a new item, and that the new item will end with a CR.

Source Code

;; Defined in /usr/src/emacs/lisp/speedbar.el.gz
(defun speedbar-make-tag-line (exp-button-type
			       exp-button-char exp-button-function
			       exp-button-data
			       tag-button tag-button-function tag-button-data
			       tag-button-face depth)
  "Create a tag line with EXP-BUTTON-TYPE for the small expansion button.
This is the button that expands or contracts a node (if applicable),
and EXP-BUTTON-CHAR the character in it (+, -, ?, etc).  EXP-BUTTON-FUNCTION
is the function to call if it's clicked on.  Button types are
`bracket', `angle', `curly', `expandtag', `statictag', t, or nil.
EXP-BUTTON-DATA is extra data attached to the text forming the expansion
button.

Next, TAG-BUTTON is the text of the tag.  TAG-BUTTON-FUNCTION is the
function to call if clicked on, and TAG-BUTTON-DATA is the data to
attach to the text field (such a tag positioning, etc).
TAG-BUTTON-FACE is a face used for this type of tag.

Lastly, DEPTH shows the depth of expansion.

This function assumes that the cursor is in the speedbar window at the
position to insert a new item, and that the new item will end with a CR."
  (let ((start (point))
	(end (progn
	       (insert (int-to-string depth) ":")
	       (point)))
	(depthspacesize (* depth speedbar-indentation-width)))
    (put-text-property start end 'invisible t)
    (insert-char ?  depthspacesize nil)
    (put-text-property (- (point) depthspacesize) (point) 'invisible nil)
    (let* ((exp-button (cond ((eq exp-button-type 'bracket) "[%c]")
			     ((eq exp-button-type 'angle) "<%c>")
			     ((eq exp-button-type 'curly) "{%c}")
			     ((eq exp-button-type 'expandtag) " %c>")
			     ((eq exp-button-type 'statictag) " =>")
			     (t ">")))
	   (buttxt (format exp-button exp-button-char))
	   (start (point))
	   (end (progn (insert buttxt) (point)))
	   (bf (if (and exp-button-type (not (eq exp-button-type 'statictag)))
		   'speedbar-button-face nil))
	   (mf (if exp-button-function 'speedbar-highlight-face nil))
	   )
      (speedbar-make-button start end bf mf exp-button-function exp-button-data)
      (if speedbar-hide-button-brackets-flag
	  (progn
	    (put-text-property start (1+ start) 'invisible t)
	    (put-text-property end (1- end) 'invisible t)))
      )
    (insert-char ?  1 nil)
    (put-text-property (1- (point)) (point) 'invisible nil)
    (let ((start (point))
	  (end (progn (insert tag-button) (point))))
      (insert-char ?\n 1 nil)
      (put-text-property (1- (point)) (point) 'invisible nil)
      (speedbar-make-button start end tag-button-face
			    (if tag-button-function 'speedbar-highlight-face nil)
			    tag-button-function tag-button-data))
    ))