2010-04-19T16:19:46
Dave Pawson.
link
Home
emacs
When I first struggled with emacs, it hurt. I wanted something that could edit SGML sensibly. I got it, but only after I sweated for a while, then bought the book Learning emacs (except mine was the first edn) which made it that much easier.
From the start, quite by accident, I found that I could open a jar file and see the list of classes! Amazed me, but being emacs I just accepted it. As with many things it isn't quite magic. Someone sat down and wrote some elisp to open, list and present the files in that jar file (and other archived formats). Being boring they called it arc-mode. Someone must have asked for archive-mode, since that's also available. See for the details of using it. Generally I just want to see what classes are or are not in the jar. It's just a little different from some other modes, insofar as it seems not to slip into the appropriate mode once the file is open in the fundemental mode. It hence needs a little help.
(setq auto-mode-alist
(append
'(("\\.war\\'" . archive-mode))
'(("\\.ear\\'" . archive-mode))
'(("\\.jar\\'" . archive-mode))
auto-mode-alist))
With the above added to my emacs 'startup' file, each time I open a file named anything, with the .jar extension, I see just what I want.
For instance I see
M Filemode Length Date Time File - ---------- -------- ----------- -------- -------------------------------------------------------------- drwxr-xr-x 0 20-Nov-2006 15:22:10 META-INF/ -rw-r--r-- 400 20-Nov-2006 15:22:08 META-INF/MANIFEST.MF drwxr-xr-x 0 20-Nov-2006 15:22:06 org/ drwxr-xr-x 0 20-Nov-2006 15:22:10 org/apache/ drwxr-xr-x 0 20-Nov-2006 15:22:10 org/apache/env/ drwxr-xr-x 0 20-Nov-2006 15:22:06 org/apache/xml/ drwxr-xr-x 0 20-Nov-2006 15:22:10 org/apache/xml/resolver/ drwxr-xr-x 0 20-Nov-2006 15:22:10 org/apache/xml/resolver/apps/ drwxr-xr-x 0 20-Nov-2006 15:22:10 org/apache/xml/resolver/etc/ drwxr-xr-x 0 20-Nov-2006 15:22:10 org/apache/xml/resolver/helpers/ drwxr-xr-x 0 20-Nov-2006 15:22:10 org/apache/xml/resolver/readers/
As the first few lines of my resolver.jar file Much sweeter than
$jar tf resolver.jar
Well, I think so anyway.
No idea what latitude Vancouver is at, but Tim Bray always seems to pip me to the post with his first daffodils or tulips. Rightly or wrongly I always have it in my mind that I'm further South than Vancouver. Anyway, same again this year, but within days mine were out and I went out with my camera to admire them. This set of photographs is the result. Even if I am later than Tim :-)
Keywords: emacs
Comments (View)Return to main index