0

I want to write a function, similar hexl-find-file, that will open a gzipped file and show the contents in the hexl-mode. How would I do that?

Trey Jackson
  • 73,529
  • 11
  • 197
  • 229
Igor
  • 2,673
  • 5
  • 33
  • 39

2 Answers2

2

Does this work for you?

(require 'jka-compr)
(defun hexl-find-file ()
  "call find file and then jump into hexl mode"
  (interactive)
  (call-interactively 'find-file)
  (hexl-mode 1))

The 'jka-compr provides the seamless compressed file handling, and the 'hexl-find-file just opens the file and turns on hexl-mode.

Trey Jackson
  • 73,529
  • 11
  • 197
  • 229
0

Turn on auto-compression-mode before you run hexl-find-file?

,----[ C-h f auto-compression-mode RET ]
| `auto-compression-mode' is an interactive compiled Lisp function
|   -- loaded from "/usr/share/xemacs21/xemacs-packages/lisp/os-utils/auto-autoloads"
| (auto-compression-mode &optional ARG)
| 
| Documentation:
| Toggle automatic file compression and uncompression.
| With prefix argument ARG, turn auto compression on if positive, else off.
| Returns the new status of auto compression (non-nil means on).
| 
| Invoked with:
| 
| M-x auto-compression-mode
`----
asjo
  • 3,084
  • 2
  • 26
  • 20
  • So, that doesn't actually work. `auto-compression-mode` is great, but hexl-find-file pointed at a GZipped file will open the compressed file for hex editing, rather than the original, uncompressed file. I tested this with GNU Emacs 23.2.1 on OS X. – R. P. Dillon Aug 29 '10 at 05:42
  • I wouldn't have posted the answer without testing it first. It works as expected (the gzip'ed file is unzipped before displayed in hexl-mode) in XEmacs 21.5 (Debian GNU/Linux). – asjo Aug 29 '10 at 15:37