From: Eli Zaretskii <eliz@gnu.org>
To: Al Haji-Ali <abdo.haji.ali@gmail.com>
Cc: 73446@debbugs.gnu.org
Subject: bug#73446: 29.1; Curious behaviour with with-current-buffer and read-string
Date: Tue, 24 Sep 2024 16:43:22 +0300 [thread overview]
Message-ID: <864j65dv5x.fsf@gnu.org> (raw)
In-Reply-To: <m0setpurec.fsf@gmail.com> (message from Al Haji-Ali on Tue, 24 Sep 2024 14:12:43 +0100)
> From: Al Haji-Ali <abdo.haji.ali@gmail.com>
> Cc: 73446@debbugs.gnu.org
> Date: Tue, 24 Sep 2024 14:12:43 +0100
>
>
> 1. Open 'emacs -Q'.
> 2. Paste the following into the scratch buffer
>
> (progn
> (defun test-bug-73446 nil
> (let ((buf1 "test1")
> (buf2 "test2"))
> (switch-to-buffer (get-buffer-create buf1))
> (insert (make-string 20 ?H))
> (goto-char 1)
> (switch-to-buffer (get-buffer-create buf2))
>
> (let ((switch-to-buffer-preserve-window-point t)
> start before after)
> (display-buffer buf1 'display-buffer-use-some-window)
>
> (with-current-buffer (get-buffer buf1)
> (setq start (point))
> (goto-char 10)
> (setq before (point))
> (with-current-buffer (get-buffer buf2) ;; some random buffer
> (read-string "Test: "))
> (setq after (point)))
> (list start before after))))
> (message "%S" (test-bug-73446)))
>
> 3. Press `C-x c-e` (or call `eval-last-sexp`)
> 3. Press return when the prompt "Test: " appears.
> 4. I see the output (1 10 1), instead of (1 10 10) as I would expect.
If this is what you do, then it's the expected behavior: test1 is
displayed in another window, and so its window-point overrides what
you do. See the node "Window Point" in the ELisp manual.
This is not a bug.
next prev parent reply other threads:[~2024-09-24 13:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2024-09-24 15:07 ` Al Haji-Ali
2024-09-24 15:50 ` Eli Zaretskii
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=864j65dv5x.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=73446@debbugs.gnu.org \
--cc=abdo.haji.ali@gmail.com \
/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).