all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ryan C. Thompson" <rct@thompsonclan.org>
To: Lars Ingebrigtsen <larsi@gnus.org>, martin rudalics <rudalics@gmx.at>
Cc: 37396@debbugs.gnu.org
Subject: bug#37396: 26.3; execute-kbd-macro changes current buffer inside with-temp-buffer and similar forms
Date: Sun, 31 Jan 2021 01:09:01 -0500	[thread overview]
Message-ID: <ba07a101-bca3-3bb6-4f98-0c6b48a88086@thompsonclan.org> (raw)
In-Reply-To: <87lfcayj0q.fsf@gnus.org>

On 1/30/21 2:35 AM, Lars Ingebrigtsen wrote:
> 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.
>
If nothing else, this behavior seems worth noting in the function's 
docstring, since otherwise there's no way to know about it short of 
reading the source.





  reply	other threads:[~2021-01-31  6:09 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
2021-01-31  6:09     ` Ryan C. Thompson [this message]
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

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

  git send-email \
    --in-reply-to=ba07a101-bca3-3bb6-4f98-0c6b48a88086@thompsonclan.org \
    --to=rct@thompsonclan.org \
    --cc=37396@debbugs.gnu.org \
    --cc=larsi@gnus.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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.