Function: semantic-symref-rb-toggle-expand-tag

semantic-symref-rb-toggle-expand-tag is an interactive and byte-compiled function defined in list.el.gz.

Signature

(semantic-symref-rb-toggle-expand-tag &optional BUTTON)

Documentation

Go to the file specified in the symref results buffer.

BUTTON is the button that was clicked.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/semantic/symref/list.el.gz
(defun semantic-symref-rb-toggle-expand-tag (&optional button)
  "Go to the file specified in the symref results buffer.
BUTTON is the button that was clicked."
  (interactive)
  (let* ((tag (button-get button 'tag))
	 (buff (semantic-tag-buffer tag))
	 (hits (semantic--tag-get-property tag :hit))
	 (state (button-get button 'state))
	 (text nil))
    (cond
     ((eq state 'closed)
      (with-current-buffer buff
	(dolist (H hits)
	  (goto-char (point-min))
	  (forward-line (1- H))
	  (beginning-of-line)
	  (back-to-indentation)
	  (setq text (cons (buffer-substring (point) (point-at-eol)) text)))
	(setq text (nreverse text)))
      (goto-char (button-start button))
      (forward-char 1)
      (let ((inhibit-read-only t))
	(delete-char 1)
	(insert "-")
	(button-put button 'state 'open)
	(save-excursion
	  (end-of-line)
	  (while text
	    (insert "\n")
	    (insert "    ")
	    (insert-button (car text)
			   'mouse-face 'highlight
			   'face nil
			   'action 'semantic-symref-rb-goto-match
			   'tag tag
			   'line (car hits))
	    (setq text (cdr text)
		  hits (cdr hits))))))
     ((eq state 'open)
      (let ((inhibit-read-only t))
	(button-put button 'state 'closed)
	;; Delete the various bits.
	(goto-char (button-start button))
	(forward-char 1)
	(delete-char 1)
	(insert "+")
	(save-excursion
	  (end-of-line)
	  (forward-char 1)
	  (delete-region (point)
			 (save-excursion
			   (forward-char 1)
			   (forward-line (length hits))
			   (point)))))))))