unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: hexl-mode's offer to "Convert contents back to binary format?" doesn't
       [not found] <m2irfeiq9y.fsf@gmail.com>
@ 2007-01-14 20:47 ` Richard Stallman
  2007-01-16 17:02   ` Chris Moore
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Stallman @ 2007-01-14 20:47 UTC (permalink / raw)
  Cc: emacs-devel

It seems that hexl-mode needs to set up
revert-buffer-insert-file-contents-function
so that it will hexlify the new contents.

Would someone please do that and ack?

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

* Re: hexl-mode's offer to "Convert contents back to binary format?" doesn't
  2007-01-14 20:47 ` hexl-mode's offer to "Convert contents back to binary format?" doesn't Richard Stallman
@ 2007-01-16 17:02   ` Chris Moore
  2007-01-18  3:22     ` Chong Yidong
  0 siblings, 1 reply; 3+ messages in thread
From: Chris Moore @ 2007-01-16 17:02 UTC (permalink / raw)
  Cc: emacs-devel

On 1/14/07, Richard Stallman <rms@gnu.org> wrote:
> It seems that hexl-mode needs to set up
> revert-buffer-insert-file-contents-function
> so that it will hexlify the new contents.
>
> Would someone please do that and ack?

There's a lot of code in revert-buffer which doesn't get used if you
set up revert-buffer-insert-file-contents-function.  Code which checks
for conditions like "File %s no longer exists!" and "File %s no longer
readable!"

The following patch fixes the problem:

--- old/hexl.el	2007-01-11 23:32:03.000000000 +0100
+++ hexl.el	2007-01-16 17:46:16.000000000 +0100
@@ -283,6 +283,7 @@
     (setq font-lock-defaults '(hexl-font-lock-keywords t))

     ;; Add hooks to rehexlify or dehexlify on various events.
+    (add-hook 'before-revert-hook 'hexl-before-revert-hook nil t)
     (add-hook 'after-revert-hook 'hexl-after-revert-hook nil t)

     (add-hook 'change-major-mode-hook 'hexl-maybe-dehexlify-buffer nil t)
@@ -317,10 +318,11 @@
     (let ((isearch-search-fun-function nil))
       (isearch-search-fun))))

+(defun hexl-before-revert-hook ()
+  (remove-hook 'change-major-mode-hook 'hexl-maybe-dehexlify-buffer t))
+
 (defun hexl-after-revert-hook ()
-  (setq hexl-max-address (1- (buffer-size)))
-  (hexlify-buffer)
-  (set-buffer-modified-p nil))
+  (hexl-mode))

 (defvar hexl-in-save-buffer nil)

@@ -386,6 +388,7 @@
 	  (or (bobp) (setq original-point (1+ original-point))))
 	(goto-char original-point)))

+  (remove-hook 'before-revert-hook 'hexl-before-revert-hook t)
   (remove-hook 'after-revert-hook 'hexl-after-revert-hook t)
   (remove-hook 'change-major-mode-hook 'hexl-maybe-dehexlify-buffer t)
   (remove-hook 'post-command-hook 'hexl-follow-ascii-find t)

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

* Re: hexl-mode's offer to "Convert contents back to binary format?" doesn't
  2007-01-16 17:02   ` Chris Moore
@ 2007-01-18  3:22     ` Chong Yidong
  0 siblings, 0 replies; 3+ messages in thread
From: Chong Yidong @ 2007-01-18  3:22 UTC (permalink / raw)
  Cc: rms, emacs-devel

"Chris Moore" <dooglus@gmail.com> writes:

> On 1/14/07, Richard Stallman <rms@gnu.org> wrote:
>> It seems that hexl-mode needs to set up
>> revert-buffer-insert-file-contents-function
>> so that it will hexlify the new contents.
>>
>> Would someone please do that and ack?
>
> There's a lot of code in revert-buffer which doesn't get used if you
> set up revert-buffer-insert-file-contents-function.  Code which checks
> for conditions like "File %s no longer exists!" and "File %s no longer
> readable!"
>
> The following patch fixes the problem:

Thanks.  Your patch is indeed the correct solution, and I've checked
it in.

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

end of thread, other threads:[~2007-01-18  3:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <m2irfeiq9y.fsf@gmail.com>
2007-01-14 20:47 ` hexl-mode's offer to "Convert contents back to binary format?" doesn't Richard Stallman
2007-01-16 17:02   ` Chris Moore
2007-01-18  3:22     ` Chong Yidong

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).