diff lisp/hexl.el @ 4966:82353ffa44b7

(hexl-mode): Use `add-hook' to modify buffer local `write-contents-hooks'. (hexl-mode-exit): Remove our hook when turning off Hexl mode.
author Richard M. Stallman <rms@gnu.org>
date Wed, 10 Nov 1993 20:44:14 +0000
parents ffe273aa038e
children 8abe8fb9621c
line wrap: on
line diff
--- a/lisp/hexl.el	Wed Nov 10 20:41:17 1993 +0000
+++ b/lisp/hexl.el	Wed Nov 10 20:44:14 1993 +0000
@@ -167,8 +167,7 @@
     (setq major-mode 'hexl-mode)
 
     (make-local-variable 'write-contents-hooks)
-    (setq write-contents-hooks
-	  (cons 'hexl-save-buffer write-contents-hooks))
+    (add-hook 'write-contents-hooks 'hexl-save-buffer)
 
     (let ((modified (buffer-modified-p))
  	  (read-only buffer-read-only)
@@ -233,6 +232,7 @@
 	    (original-point (1+ (hexl-current-address))))
 	(setq buffer-read-only nil)
 	(dehexlify-buffer)
+	(remove-hook 'write-contents-hook 'hexl-save-buffer)
 	(set-buffer-modified-p modified)
 	(setq buffer-read-only read-only)
 	(goto-char original-point)))