I thought that was what it did, but just adding the magic number leaves it 
broken for non-compressed spkg's (I checked).  The magic number is only used 
(as near as I can tell from looking at the emacs source) to decide if the file 
is already compressed or if it needs to be compressed when it's saving the file.

Honestly, the whole thing seems like an emacs bug, but I'm not sure the 
maintainers will agree.  It wasn't completely trivial to fix it last night, so 
I didn't. :-)  If you want I can file a bug report (I would like to be CC'ed if 
you send one).

-Ivan

On Nov 15, 2011, at 1:47 AM, Bill Janssen wrote:

> I see that in John's formulation, there's also a space for a "magic
> number" for the file.  Maybe that could be used to switch between
> bunzip2 and tar, versus just tar.
> 
> On Nov 12, 6:20 pm, Michael Orlitzky <[email protected]> wrote:
>> On 11/12/2011 08:47 PM, Bill Janssen wrote:
>> 
>>> You can visit a .tar.bz2 file with GNU Emacs 23, and it works.  If I
>>> rename the .spkg file to .tar.bz2, it works.  But I don't see how to
>>> tell Emacs that .spkg == .tar.bz2...
>> 
>> John beat me to it, but this works in your .emacs file.
>> 
>> ;; We have to disable auto-compression-mode first,
>> ;; don't ask me why.
>> (auto-compression-mode 0)
>> 
>> ;; Add the "spkg" extension to the list of stuff we want to
>> ;; decompress automatically (with bzip2).
>> (add-to-list 'jka-compr-compression-info-list
>>              ["\\.spkg$"
>>               "zipping"        "bzip2"         ()
>>               "unzipping"      "bzip2"         ("-d")
>>               nil t])
>> 
>> ;; Re-enable auto-compression mode.
>> (auto-compression-mode 1)
>> 
>> ;; Auto-compression will bunzip2 the spkg file, but then Emacs
>> ;; needs to know that it should use tar-mode on what bunzip2 spits
>> ;; out.
>> (setq auto-mode-alist
>>       (append
>>        (list
>>         '("\\.spkg$" . tar-mode)
>>         )
>> 
>>        auto-mode-alist))

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to