Function: cperl-tags-hier-init

cperl-tags-hier-init is an interactive and byte-compiled function defined in cperl-mode.el.gz.

Signature

(cperl-tags-hier-init &optional UPDATE)

Documentation

Show hierarchical menu of classes and methods.

Finds info about classes by a scan of loaded TAGS files. Supposes that the TAGS files contain fully qualified function names. One may build such TAGS files from CPerl mode menu.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/cperl-mode.el.gz
(defun cperl-tags-hier-init (&optional update)
  "Show hierarchical menu of classes and methods.
Finds info about classes by a scan of loaded TAGS files.
Supposes that the TAGS files contain fully qualified function names.
One may build such TAGS files from CPerl mode menu."
  (interactive)
  (require 'etags)
  (require 'imenu)
  (if (or update (null (nth 2 cperl-hierarchy)))
      (let ((remover (lambda (elt) ; (name (file1...) (file2..))
                       (or (nthcdr 2 elt)
                           ;; Only in one file
                           (setcdr elt (cdr (nth 1 elt))))))
	    to) ;; l1 l2 l3
	;; (setq cperl-hierarchy '(() () ())) ; Would write into '() later!
	(setq cperl-hierarchy (list () () ())) ;; (list l1 l2 l3)
	(or tags-table-list
	    (call-interactively 'visit-tags-table))
	(mapc
         (lambda (tagsfile)
           (message "Updating list of classes... %s" tagsfile)
           (set-buffer (get-file-buffer tagsfile))
           (cperl-tags-hier-fill))
	 tags-table-list)
	(message "Updating list of classes... postprocessing...")
	(mapc remover (car cperl-hierarchy))
	(mapc remover (nth 1 cperl-hierarchy))
	(setq to (list nil (cons "Packages: " (nth 1 cperl-hierarchy))
		       (cons "Methods: " (car cperl-hierarchy))))
	(cperl-tags-treeify to 1)
	(setcar (nthcdr 2 cperl-hierarchy)
		(cperl-menu-to-keymap (cons '("+++UPDATE+++" . -999) (cdr to))))
	(message "Updating list of classes: done, requesting display...")))
  (or (nth 2 cperl-hierarchy)
      (error "No items found"))
  (setq update
        ;; (imenu-choose-buffer-index "Packages: " (nth 2 cperl-hierarchy))
	(if (if (fboundp 'display-popup-menus-p)
		(display-popup-menus-p)
	      window-system)
	    (x-popup-menu t (nth 2 cperl-hierarchy))
	  (require 'tmm)
	  (tmm-prompt (nth 2 cperl-hierarchy))))
  (if (and update (listp update))
      (progn (while (cdr update) (setq update (cdr update)))
	     (setq update (car update)))) ; Get the last from the list
  (if (vectorp update)
      (progn
	(find-file (elt update 0))
	(etags-goto-tag-location (elt update 1))))
  (if (eq update -999) (cperl-tags-hier-init t)))