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?
views:
63answers:
2
+2
A:
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
2010-08-28 19:07:19
A:
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
2010-08-28 21:08:39
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
2010-08-29 05:42:03
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
2010-08-29 15:37:33