Function: speedbar-dired

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

Signature

(speedbar-dired TEXT TOKEN INDENT)

Documentation

Speedbar click handler for directory expand button.

Clicking this button expands or contracts a directory. TEXT is the button clicked which has either a + or -. TOKEN is the directory to be expanded. INDENT is the current indentation level.

Source Code

;; Defined in /usr/src/emacs/lisp/speedbar.el.gz
(defun speedbar-dired (text token indent)
  "Speedbar click handler for directory expand button.
Clicking this button expands or contracts a directory.  TEXT is the
button clicked which has either a + or -.  TOKEN is the directory to be
expanded.  INDENT is the current indentation level."
  (cond ((string-search "+" text)	;we have to expand this dir
	 (setq speedbar-shown-directories
	       (cons (expand-file-name
		      (concat (speedbar-line-directory indent) token "/"))
		     speedbar-shown-directories))
	 (speedbar-change-expand-button-char ?-)
	 (speedbar-reset-scanners)
	 (save-excursion
	   (end-of-line) (forward-char 1)
	   (speedbar-with-writable
	     (speedbar-default-directory-list
	      (concat (speedbar-line-directory indent) token "/")
	      (1+ indent)))))
	((string-search "-" text)	;we have to contract this node
	 (speedbar-reset-scanners)
	 (let ((oldl speedbar-shown-directories)
	       (newl nil)
	       (td (expand-file-name
		    (concat (speedbar-line-directory indent) token))))
	   (while oldl
	     (if (not (string-match (concat "^" (regexp-quote td)) (car oldl)))
		 (setq newl (cons (car oldl) newl)))
	     (setq oldl (cdr oldl)))
	   (setq speedbar-shown-directories (nreverse newl)))
	 (speedbar-change-expand-button-char ?+)
	 (speedbar-delete-subblock indent)
	 )
	(t (error "Ooops...  not sure what to do")))
  (speedbar-center-buffer-smartly)
  (save-excursion (speedbar-stealthy-updates)))