summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1993-11-10 20:44:14 +0000
committerRichard M. Stallman <rms@gnu.org>1993-11-10 20:44:14 +0000
commit291aa13a10b36ac103e3dc6d123d4bf494560ca8 (patch)
tree2bc65b4086ecc504eed7030a20ddf31e1f5bbd30 /lisp
parente9f64893de09ed931816191f7b028907f5f1acf5 (diff)
downloademacs-291aa13a10b36ac103e3dc6d123d4bf494560ca8.tar.gz
(hexl-mode): Use `add-hook' to modify buffer local `write-contents-hooks'.
(hexl-mode-exit): Remove our hook when turning off Hexl mode.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/hexl.el4
1 files changed, 2 insertions, 2 deletions
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)))