GNU bug report logs - #37396
26.3; execute-kbd-macro changes current buffer inside with-temp-buffer and similar forms

Previous Next

Package: emacs;

Reported by: "Ryan C. Thompson" <rct <at> thompsonclan.org>

Date: Fri, 13 Sep 2019 01:20:02 UTC

Severity: normal

Found in version 26.3

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: "Ryan C. Thompson" <rct <at> thompsonclan.org>, 37396 <at> debbugs.gnu.org
Subject: bug#37396: 26.3; execute-kbd-macro changes current buffer inside with-temp-buffer and similar forms
Date: Sat, 30 Jan 2021 08:35:17 +0100
martin rudalics <rudalics <at> gmx.at> writes:

> 'execute-kbd-macro' calls command_loop_1 which sets the current buffer
> to the buffer shown in the selected window.
>
>> For example:
>>
>> (with-temp-buffer
>>    (list
>>     ;; Returns the temp buffer
>>     (current-buffer)
>>     (execute-kbd-macro "hello")
>>     ;; Returns the buffer that was current when evaluation began
>>     (current-buffer)))
>
> Try with
>
> (with-temp-buffer
>   (let ((restore (window-buffer))
> 	temp)
>     (setq temp (current-buffer))
>     (set-window-buffer (selected-window) temp)
>     (execute-kbd-macro "hello")
>     (set-window-buffer (selected-window) restore)
>     (list temp (current-buffer))))

So this seems to work as designed, so I'm closing this bug report.  If
there's something to be done here, please respond to the debbugs address
and we'll reopen.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




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

Previous Next


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