278 |
(defmacro save-buffer-state (varlist &rest body) |
(defmacro save-buffer-state (varlist &rest body) |
279 |
"Bind variables according to VARLIST and eval BODY restoring buffer state." |
"Bind variables according to VARLIST and eval BODY restoring buffer state." |
280 |
`(let* (,@(append varlist |
`(let* (,@(append varlist |
281 |
'((modified (buffer-modified-p)) (buffer-undo-list t) |
'((modified (buffer-modified-p)) |
282 |
(inhibit-read-only t) (inhibit-point-motion-hooks t) |
(buffer-undo-list t) |
283 |
before-change-functions after-change-functions |
(inhibit-read-only t) |
284 |
deactivate-mark buffer-file-name buffer-file-truename))) |
(inhibit-point-motion-hooks t) |
285 |
|
(inhibit-modification-hooks t) |
286 |
|
deactivate-mark |
287 |
|
buffer-file-name |
288 |
|
buffer-file-truename))) |
289 |
,@body |
,@body |
290 |
(when (and (not modified) (buffer-modified-p)) |
(when (and (not modified) (buffer-modified-p)) |
291 |
(set-buffer-modified-p nil)))) |
(restore-buffer-modified-p nil)))) |
292 |
(put 'save-buffer-state 'lisp-indent-function 1) |
(put 'save-buffer-state 'lisp-indent-function 1) |
293 |
;; |
;; |
294 |
;; We use this for clarity and speed. Naughty but nice. |
;; We use this for clarity and speed. Naughty but nice. |