GNU bug report logs - #34765
26.1; with-temp-buffer should not run buffer-list-update-hook

Previous Next

Package: emacs;

Reported by: Alexander Miller <alexanderm <at> web.de>

Date: Tue, 5 Mar 2019 22:58:02 UTC

Severity: normal

Tags: fixed

Found in version 26.1

Fixed in version 28.1

Done: "Basil L. Contovounesios" <contovob <at> tcd.ie>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 34765 <at> debbugs.gnu.org, rudalics <at> gmx.at, larsi <at> gnus.org, monnier <at> IRO.UMontreal.CA, alexanderm <at> web.de
Subject: bug#34765: 26.1; with-temp-buffer should not run buffer-list-update-hook
Date: Fri, 18 Dec 2020 14:57:26 +0000
"Basil L. Contovounesios" <contovob <at> 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




This bug report was last modified 4 years and 152 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.