help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Code to caller graph


From: Andrea Crotti
Subject: Re: Code to caller graph
Date: Wed, 15 Dec 2010 17:51:38 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (darwin)

Andrea Crotti <andrea.crotti.0@gmail.com> writes:

> I have a C++ project with a lot of intricated C++ code, and sometimes
> it's very useful to look in the doxygen generated pages.
>
> It would be really great if in one key combination I could jump from the
> function definition in emacs to the image showing the call/caller graph.
>
> I see though that the full addresses of the image graphsin doxygen is
> something complicated like this:
>
> doc/html/class_pad_node_a6b918365cac3efcf5201c01ffa654c21_cgraph.png
>
> Anyone did it or has any ideas?

Well if someone is interested

--8<---------------cut here---------------start------------->8---
(defun un-camelcase-string (s &optional sep start)
  "Convert CamelCase string S to lower case with word separator SEP.
    Default for SEP is a hyphen \"-\".
    If third argument START is non-nil, convert words after that
    index in STRING."
  (let ((case-fold-search nil))
    (while (string-match "[A-Z]" s (or start 1))
      (setq s (replace-match (concat (or sep "-") 
                                     (downcase (match-string 0 s))) 
                             t nil s)))
    (downcase s)))

(defun doxy-path (basepath classname)
  (concat basepath "doc/html/class_" (un-camelcase-string classname "_") 
".html"))

(defun jump-to-doxygen-doc (basepath)
  "jump to the corresponding doxygen page"
  (interactive "D")
  (let*
      ((nondir (file-name-nondirectory (buffer-file-name)))
       (classname (nth 0 (split-string nondir "\\."))))
    (browse-url (doxy-path basepath classname))))
--8<---------------cut here---------------end--------------->8---

it works fine for me, given that the class name is the same of the file
name.

doxygen also uncamelise names, so PadCoordinate.cpp doc will be in
pad_coordinate.html
for example.

I can't see the graph directly in emacs but to have the right page pop
up is already quite nice...




reply via email to

[Prev in Thread] Current Thread [Next in Thread]