proper .emacs for gcc code?

Tom Tromey tromey@redhat.com
Mon Feb 25 07:55:00 GMT 2002


>>>>> "Andrew" == Andrew Haley <aph@redhat.com> writes:

Andrew> 	       (c-set-style "gnu")

Yeah, I set this elsewhere I think.

Also here's a function I use when hacking libgcj or Classpath.  It
lets you jump from a standard class' buffer to its online
documentation.  It also works if you're editing a (actually most but
not all) nat*.cc file in libgcj.

I think I posted an older version of this a few years ago.

With the Emacs I use there isn't an easy way to dig out the current
method's name (so ChangeLogs don't work quite right, bleah), so this
code only does the class and doesn't take you right to the method
docs.

(defun tjt-java-class-help ()
  "Get help on the current Java class."
  (interactive)
  (let ((found nil))
    ;; Use initial `.*' to suck up as much leading text as possible.
    (cond
     ((string-match "^.*\\(libjava\\|classpath\\)/\\(.*\\)\\.java$"
		    buffer-file-name)
      (setq found
	    (substring buffer-file-name (match-beginning 2) (match-end 2))))
     ((string-match "^.*libjava/\\(.*\\)/nat\\(.*\\)\\.cc$"
		    buffer-file-name)
      (setq found
	    (concat (substring buffer-file-name (match-beginning 1)
			       (match-end 1))
		    "/"
		    (substring buffer-file-name (match-beginning 2)
			       (match-end 2))))))
    (if found
	(funcall browse-url-browser-function
		 (concat
		  "http://java.sun.com/products/jdk/1.3/docs/api/"
		  found
		  ".html"))
      (message "Doesn't look like Java buffer"))))

Tom



More information about the Java mailing list