unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#73446: 29.1; Curious behaviour with with-current-buffer and read-string
@ 2024-09-24  8:19 Al Haji-Ali
  2024-09-24 12:12 ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Al Haji-Ali @ 2024-09-24  8:19 UTC (permalink / raw)
  To: 73446


Consider this code snippet:

,----
| (with-current-buffer (get-buffer "*scratch*")
|   (message "START point %S %S" (current-buffer) (point))
|   (goto-char 10)
|   (message "BEFORE point %S %S" (current-buffer) (point))
|   (with-current-buffer (get-buffer "*Messages*") ;; some random buffer
|     (read-string "Test: "))
|   (message "AFTER point %S %S" (current-buffer) (point)))
`----

Assuming that *scratch* has a point at something other than 10 and *is visible in a window*, I get this output in Messages

,----
| START point #<buffer *scratch*> 2952
| BEFORE point #<buffer *scratch*> 10
| AFTER point #<buffer *scratch*> 2952
`----

I was expecting (point) AFTER to be 100, as it was BEFORE.

This only happens when `read-string` is called and when `with-current-buffer` is nested, and only when *scratch* is visible in a window.

I can easily solve this issue with `save-excursion`, but I thought this might be an unintended behaviour worth reporting.

Best regards,
-- Al





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-09-24 15:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-24  8:19 bug#73446: 29.1; Curious behaviour with with-current-buffer and read-string Al Haji-Ali
2024-09-24 12:12 ` Eli Zaretskii
2024-09-24 13:12   ` Al Haji-Ali
2024-09-24 13:43     ` Eli Zaretskii
2024-09-24 15:07       ` Al Haji-Ali
2024-09-24 15:50         ` Eli Zaretskii

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).