all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#7252: hexl-revert-buffer
@ 2010-10-20  5:57 Daiki Ueno
  2010-10-20 16:18 ` Stefan Monnier
  0 siblings, 1 reply; 7+ messages in thread
From: Daiki Ueno @ 2010-10-20  5:57 UTC (permalink / raw)
  To: 7252

[-- Attachment #1: Type: text/plain, Size: 302 bytes --]

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?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: hexl-revert-buffer.diff --]
[-- Type: text/x-patch, Size: 950 bytes --]

=== 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)
     map))
 
 ;; Variable declarations for suppressing warnings from the byte-compiler.
@@ -464,6 +465,16 @@
   (if (not (eq major-mode 'hexl-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."


[-- Attachment #3: Type: text/plain, Size: 25 bytes --]


Regards,
-- 
Daiki Ueno

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-10-22  1:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-20  5:57 bug#7252: hexl-revert-buffer Daiki Ueno
2010-10-20 16:18 ` Stefan Monnier
2010-10-21  2:00   ` Daiki Ueno
2010-10-21  2:20     ` Stefan Monnier
2010-10-21  2:42       ` Daiki Ueno
2010-10-21 17:53         ` Stefan Monnier
2010-10-22  1:15           ` Daiki Ueno

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.