]> git.eshelyaron.com Git - emacs.git/commitdiff
(hexl-mode): Use `add-hook' to modify buffer local `write-contents-hooks'.
authorRichard M. Stallman <rms@gnu.org>
Wed, 10 Nov 1993 20:44:14 +0000 (20:44 +0000)
committerRichard M. Stallman <rms@gnu.org>
Wed, 10 Nov 1993 20:44:14 +0000 (20:44 +0000)
(hexl-mode-exit): Remove our hook when turning off Hexl mode.

lisp/hexl.el

index 9712ff6442cefad0428ba35203c02c2f91a59402..4875647dc5501626ffaa514af6aca34c00cd0dc7 100644 (file)
@@ -167,8 +167,7 @@ You can use \\[hexl-find-file] to visit a file in hexl-mode.
     (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 @@ With arg, don't unhexlify buffer."
            (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)))