If you’re like me, you’ve often found yourself needing to change a setting, or view some information, buried deep inside a .ear or .war or .sar file. Well, you probably know that emacs can handle looking inside and editing files within a .tar or .jar file. Since .ear and .war files are just .jar files at their core, you can easily extend this feature to those file types.

Just add this to your ~/.emacs file:

(setq auto-mode-alist
'(("\\.war\\'" . archive-mode))
'(("\\.ear\\'" . archive-mode))
'(("\\.sar\\'" . archive-mode))

And you’ll get something that look like this:

emacs hudson.war

emacs editing a war file