Function: speedbar-insert-generic-list

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

Signature

(speedbar-insert-generic-list LEVEL LST EXPAND-FUN FIND-FUN)

Documentation

At LEVEL, insert a generic multi-level alist LST.

Associations with lists get {+} tags (to expand into more nodes) and those with positions just get a > as the indicator. {+} buttons will have the function EXPAND-FUN and the token is the cdr list. The token name will have the function FIND-FUN and not token.

Source Code

;; Defined in /usr/src/emacs/lisp/speedbar.el.gz
(defun speedbar-insert-generic-list (level lst expand-fun find-fun)
  "At LEVEL, insert a generic multi-level alist LST.
Associations with lists get {+} tags (to expand into more nodes) and
those with positions just get a > as the indicator.  {+} buttons will
have the function EXPAND-FUN and the token is the cdr list.  The token
name will have the function FIND-FUN and not token."
  ;; Remove imenu rescan button
  (if (string= (car (car lst)) "*Rescan*")
      (setq lst (cdr lst)))
  ;; Get, and set up variables that define how we treat these tags.
   (let ((f (save-excursion (forward-line -1)
			    (or (speedbar-line-file)
				(speedbar-line-directory))))
	 expand-button tag-button)
     (save-excursion
       (if (get-file-buffer f)
	   (set-buffer (get-file-buffer f)))
       (setq expand-button speedbar-generic-list-group-expand-button-type
	     tag-button speedbar-generic-list-tag-button-type))
     ;; Adjust the list.
     (setq lst (speedbar-create-tag-hierarchy lst))
     ;; insert the parts
     (while lst
       (cond ((null (car-safe lst)) nil)	;this would be a separator
	    ((speedbar-generic-list-tag-p (car lst))
	     (speedbar-make-tag-line tag-button
				     nil nil nil ;no expand button data
				     (car (car lst)) ;button name
				     find-fun ;function
				     (cdr (car lst)) ;token is position
				     'speedbar-tag-face
				     (1+ level)))
	    ((speedbar-generic-list-positioned-group-p (car lst))
	     (speedbar-make-tag-line expand-button
				     ?+ expand-fun (cdr (cdr (car lst)))
				     (car (car lst)) ;button name
				     find-fun ;function
				     (car (cdr (car lst))) ;token is posn
				     'speedbar-tag-face
				     (1+ level)))
	    ((speedbar-generic-list-group-p (car lst))
	     (speedbar-make-tag-line expand-button
				     ?+ expand-fun (cdr (car lst))
				     (car (car lst)) ;button name
				     nil nil 'speedbar-tag-face
				     (1+ level)))
	    (t (dframe-message "speedbar-insert-generic-list: malformed list!")
	       ))
      (setq lst (cdr lst)))))