unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: martin rudalics <rudalics@gmx.at>
Cc: "Ryan C. Thompson" <rct@thompsonclan.org>, 37396@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	[thread overview]
Message-ID: <87lfcayj0q.fsf@gnus.org> (raw)
In-Reply-To: <01061656-2610-ffdf-7915-2408127dcb02@gmx.at> (martin rudalics's message of "Fri, 13 Sep 2019 09:36:49 +0200")

martin rudalics <rudalics@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





  reply	other threads:[~2021-01-30  7:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-13  1:18 bug#37396: 26.3; execute-kbd-macro changes current buffer inside with-temp-buffer and similar forms Ryan C. Thompson
2019-09-13  7:36 ` martin rudalics
2021-01-30  7:35   ` Lars Ingebrigtsen [this message]
2021-01-31  6:09     ` Ryan C. Thompson
2021-01-31  7:46       ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lfcayj0q.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=37396@debbugs.gnu.org \
    --cc=rct@thompsonclan.org \
    --cc=rudalics@gmx.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).