This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

some handy emacs code


For those of you using Emacs, here's some handy code I wrote for
looking inside .jar files.

Put this in .emacs, and then when visiting a .jar or .zip file, you
can use "?" to run jcf-dump on the class.

Tom

(defun tjt-view-class-file ()
  (interactive)
  (if (eq archive-subtype 'zip)
      (let* ((descr (archive-get-descr))
	     (ename (aref descr 0))
	     (iname (aref descr 1))
	     ;; strip ".class"
	     (class (substring iname 0 -6)))
	(if (string-equal (substring iname -6) ".class")
	    (shell-command (concat "jcf-dump -c -I"
				   (buffer-file-name)
				   " "
				   class))))))

(add-hook 'archive-mode-hook
	  (function
	   (lambda ()
	     (define-key archive-mode-map "?" 'tjt-view-class-file))))


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]