Doxygen is a system for extracting documentation from source code. It supports a variety of programming languages, human languages and output formats. You can find it at http://www.doxygen.org.
With the doxymacs minor-mode, you can insert doxygen tempo templates, start a browser to see a symbol’s documentation etc. It also provides syntax highlight.
To generate the doxygen ‘tags file’ needed by doxymacs, put something like:
GENERATE_TAGFILE = ~/.tmp/doxy.tag
in your doxygen config file.
From August 2004, CVS version of GnuEmacs require patching DoxyMacs in order to avoid conflicts in font-lock management: the
‘doxymacs-font-lock’ function should be implemented as follows (or at leat I think so :-)):
(defun doxymacs-font-lock () (interactive) (font-lock-add-keywords nil doxymacs-doxygen-keywords))
I made a small function that is inspired by Eclipse editing of the Java files. When the point is inside a multiline comment it automatically adds an asterisk when you enter a newline. There may be some minor glitches if you have “/*”’ or “*/” inside your strings but it works fine in general. There is a piece of code at the end that binds the function to return key, use it if you want.
(defun my-javadoc-return () "Advanced `newline' command for Javadoc multiline comments. Insert a `*' at the beggining of the new line if inside of a comment." (interactive "*") (let* ((last (point)) (is-inside (if (search-backward "*/" nil t) ;; there are some comment endings - search forward (search-forward "/*" last t) ;; it's the only comment - search backward (goto-char last) (search-backward "/*" nil t)))) ;; go to last char position (goto-char last) ;; the point is inside some comment, insert `*' (if is-inside (progn (newline-and-indent) (insert "*")) ;; else insert only new-line (newline)))) (add-hook 'c++-mode-hook (lambda () (local-set-key (kbd "<RET>") 'my-javadoc-return)))
You can use M-j (c-indent-new-comment-line) within comments to get the same effect.
DoxyMacsYard can be used to create YARD comments in Ruby buffers and highlight them to the extent the YARD tags match with the Doxygen ones.