[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#7252: hexl-revert-buffer

From: Daiki Ueno
Subject: bug#7252: hexl-revert-buffer
Date: Wed, 20 Oct 2010 14:57:13 +0900
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

If I open a ZIP file with M-x hexl-find-file and then M-x revert-buffer,
I see hexified file list generated by arc-mode, instead of raw ZIP data.

This behavior is surprising for me and it is cumbersome to do M-x
kill-buffer and M-x hexl-find-file each time.

How about adding M-x hexl-revert-buffer?

=== modified file 'lisp/hexl.el'
--- lisp/hexl.el        2010-10-10 23:12:30 +0000
+++ lisp/hexl.el        2010-10-20 05:46:47 +0000
@@ -189,6 +189,7 @@
     (define-key map "\C-x\C-p" 'undefined)
     (define-key map "\C-x\C-s" 'hexl-save-buffer)
     (define-key map "\C-x\C-t" 'undefined)
+    (define-key map "\C-xg" 'hexl-revert-buffer)
 ;; Variable declarations for suppressing warnings from the byte-compiler.
@@ -464,6 +465,16 @@
   (if (not (eq major-mode 'hexl-mode))
+(defun hexl-revert-buffer ()
+  "Revert the buffer previously opened with `hexl-find-file'."
+  (interactive)
+  (if (eq major-mode 'hexl-mode)
+      (let ((coding-system-for-read 'no-conversion))
+       (revert-buffer nil nil t)
+       (setq major-mode 'fundamental-mode)
+       (hexl-mode))
+    (call-interactively #'revert-buffer)))
 (defun hexl-mode-exit (&optional arg)
   "Exit Hexl mode, returning to previous mode.
 With arg, don't unhexlify buffer."

Daiki Ueno

reply via email to

[Prev in Thread] Current Thread [Next in Thread]