[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#34765: 26.1; with-temp-buffer should not run buffer-list-update-hook
From: |
Basil L. Contovounesios |
Subject: |
bug#34765: 26.1; with-temp-buffer should not run buffer-list-update-hook |
Date: |
Fri, 18 Dec 2020 14:57:26 +0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
"Basil L. Contovounesios" <contovob@tcd.ie> writes:
> (defmacro with-temp-file (file &rest body)
> "Create a new buffer, evaluate BODY there, and write the buffer to FILE.
> The value returned is the value of the last form in BODY.
> -See also `with-temp-buffer'."
> +The buffer is created using `with-temp-buffer', which see."
> (declare (indent 1) (debug t))
> - (let ((temp-file (make-symbol "temp-file"))
> - (temp-buffer (make-symbol "temp-buffer")))
> - `(let ((,temp-file ,file)
> - (,temp-buffer (generate-new-buffer " *temp file*")))
> - (unwind-protect
> - (prog1
> - (with-current-buffer ,temp-buffer
> - ,@body)
> - (with-current-buffer ,temp-buffer
> - (write-region nil nil ,temp-file nil 0)))
> - (and (buffer-name ,temp-buffer)
> - (kill-buffer ,temp-buffer))))))
> + `(with-temp-buffer
> + (prog1 (progn ,@body)
> + (write-region nil nil ,file nil 0))))
Reading another thread made me realise that this changes the argument
evaluation order, so I'll fix that too.
--
Basil
bug#34765: 26.1; with-temp-buffer should not run buffer-list-update-hook,
Basil L. Contovounesios <=
bug#34765: 26.1; with-temp-buffer should not run buffer-list-update-hook, Stefan Monnier, 2020/12/18
- bug#34765: 26.1; with-temp-buffer should not run buffer-list-update-hook, Basil L. Contovounesios, 2020/12/18
- bug#34765: 26.1; with-temp-buffer should not run buffer-list-update-hook, Eli Zaretskii, 2020/12/19
- bug#34765: 26.1; with-temp-buffer should not run buffer-list-update-hook, Basil L. Contovounesios, 2020/12/19
- bug#34765: 26.1; with-temp-buffer should not run buffer-list-update-hook, Eli Zaretskii, 2020/12/19
- bug#34765: 26.1; with-temp-buffer should not run buffer-list-update-hook, Basil L. Contovounesios, 2020/12/19
- bug#34765: 26.1; with-temp-buffer should not run buffer-list-update-hook, Eli Zaretskii, 2020/12/20
- Message not available
- bug#34765: 26.1; with-temp-buffer should not run buffer-list-update-hook, Basil L. Contovounesios, 2020/12/20