From: "Chris Moore" <dooglus@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: hexl-mode's offer to "Convert contents back to binary format?" doesn't
Date: Tue, 16 Jan 2007 18:02:26 +0100 [thread overview]
Message-ID: <a9691ee20701160902m69ca91d4w6ae6a8b3fa201477@mail.gmail.com> (raw)
In-Reply-To: <E1H6CG2-0005d7-0w@fencepost.gnu.org>
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)
next prev parent reply other threads:[~2007-01-16 17:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[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 [this message]
2007-01-18 3:22 ` Chong Yidong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a9691ee20701160902m69ca91d4w6ae6a8b3fa201477@mail.gmail.com \
--to=dooglus@gmail.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).