开发者

Can you Edit .jar/archive contents inline with emacs

I know you can navigate the contents of an archive with emacs. Is there a way you can edit those files in place and write the archive transparently?. Currently, I navigate into the archive, write the file to a temp directory, and the use the java jar command to add the file back into the archive. Its开发者_运维技巧 a little bit of pain.

P.S. I know there are few use cases where you'd want to do this, but I've inherited a platform that I can't readily modify where I have to cope with this limitation in the short term.


Yes, it just works. Did you try it?

I grabbed a jar file that contained a text file and some java code that would print it out. I edited the txt file within the .jar and saved the text file. It did exactly what I would expect.

EDIT- When saving the archive make sure you use C-x C-s


In emacs-23.2 (not 23.1 or 23.3) this doesn't "just work" on Windows due to a bug. Instead it just writes caution: filename not matched: "<internal path>.

One solution is to simply upgrade to 23.3.

To fix the bug in emacs-23.2, open $EMACS_HOME/lisp/arc-mode.el and replace:

(if (equal (car archive-zip-extract) "unzip")
     (shell-quote-argument name)
       name)

with:

name

and recompile:

M-x byte-compile-file $EMACS_HOME/lisp/arc-mode.el

This answer comes from the original emacs bug report.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜