From: Richard M. Stallman Date: Wed, 10 Nov 1993 20:44:14 +0000 (+0000) Subject: (hexl-mode): Use `add-hook' to modify buffer local `write-contents-hooks'. X-Git-Tag: emacs-19.34~10885 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=c6fcafde81fc0cd31cd36ad8a8cc9b6204f076ab;p=emacs.git (hexl-mode): Use `add-hook' to modify buffer local `write-contents-hooks'. (hexl-mode-exit): Remove our hook when turning off Hexl mode. --- diff --git a/lisp/hexl.el b/lisp/hexl.el index 9712ff6442c..4875647dc55 100644 --- a/lisp/hexl.el +++ b/lisp/hexl.el @@ -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)))