Function: speedbar-insert-button

speedbar-insert-button is a byte-compiled function defined in speedbar.el.gz.

Signature

(speedbar-insert-button TEXT FACE MOUSE FUNCTION &optional TOKEN PREVLINE)

Documentation

Insert TEXT as the next logical speedbar button.

FACE is the face to put on the button, MOUSE is the highlight face to use. When the user clicks on TEXT, FUNCTION is called with the TOKEN parameter. This function assumes that the current buffer is the speedbar buffer. If PREVLINE, then put this button on the previous line.

This is a convenience function for special modes that create their own specialized speedbar displays.

Source Code

;; Defined in /usr/src/emacs/lisp/speedbar.el.gz
(defun speedbar-insert-button (text face mouse function
				    &optional token prevline)
  "Insert TEXT as the next logical speedbar button.
FACE is the face to put on the button, MOUSE is the highlight face to use.
When the user clicks on TEXT, FUNCTION is called with the TOKEN parameter.
This function assumes that the current buffer is the speedbar buffer.
If PREVLINE, then put this button on the previous line.

This is a convenience function for special modes that create their own
specialized speedbar displays."
  (goto-char (point-max))
  (let ((start (point)))
    (if (/= (current-column) 0) (insert "\n"))
    (put-text-property start (point) 'invisible nil))
  (if prevline (progn (delete-char -1)
		      (insert " ") ;back up if desired...
		      (put-text-property (1- (point)) (point) 'invisible nil)))
  (let ((start (point)))
    (insert text)
    (speedbar-make-button start (point) face mouse function token))
  (let ((start (point)))
    (insert "\n")
    (add-text-properties
     start (point) '(face nil invisible nil mouse-face nil))))