diff options
| author | Richard M. Stallman | 1993-11-10 20:44:14 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-11-10 20:44:14 +0000 |
| commit | c6fcafde81fc0cd31cd36ad8a8cc9b6204f076ab (patch) | |
| tree | 75e90b6083a2471807bc24d87fe32d80a707db2c | |
| parent | 7a5a26a68f0c62843789cd1299ca5dd8c6068fd6 (diff) | |
| download | emacs-c6fcafde81fc0cd31cd36ad8a8cc9b6204f076ab.tar.gz emacs-c6fcafde81fc0cd31cd36ad8a8cc9b6204f076ab.zip | |
(hexl-mode): Use `add-hook' to modify buffer local `write-contents-hooks'.
(hexl-mode-exit): Remove our hook when turning off Hexl mode.
| -rw-r--r-- | lisp/hexl.el | 4 |
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. | |||
| 167 | (setq major-mode 'hexl-mode) | 167 | (setq major-mode 'hexl-mode) |
| 168 | 168 | ||
| 169 | (make-local-variable 'write-contents-hooks) | 169 | (make-local-variable 'write-contents-hooks) |
| 170 | (setq write-contents-hooks | 170 | (add-hook 'write-contents-hooks 'hexl-save-buffer) |
| 171 | (cons 'hexl-save-buffer write-contents-hooks)) | ||
| 172 | 171 | ||
| 173 | (let ((modified (buffer-modified-p)) | 172 | (let ((modified (buffer-modified-p)) |
| 174 | (read-only buffer-read-only) | 173 | (read-only buffer-read-only) |
| @@ -233,6 +232,7 @@ With arg, don't unhexlify buffer." | |||
| 233 | (original-point (1+ (hexl-current-address)))) | 232 | (original-point (1+ (hexl-current-address)))) |
| 234 | (setq buffer-read-only nil) | 233 | (setq buffer-read-only nil) |
| 235 | (dehexlify-buffer) | 234 | (dehexlify-buffer) |
| 235 | (remove-hook 'write-contents-hook 'hexl-save-buffer) | ||
| 236 | (set-buffer-modified-p modified) | 236 | (set-buffer-modified-p modified) |
| 237 | (setq buffer-read-only read-only) | 237 | (setq buffer-read-only read-only) |
| 238 | (goto-char original-point))) | 238 | (goto-char original-point))) |