unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Al Haji-Ali <abdo.haji.ali@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 73446@debbugs.gnu.org
Subject: bug#73446: 29.1; Curious behaviour with with-current-buffer and read-string
Date: Tue, 24 Sep 2024 14:12:43 +0100	[thread overview]
Message-ID: <m0setpurec.fsf@gmail.com> (raw)
In-Reply-To: <86msjxdzd3.fsf@gnu.org>


> I can't reproduce this, but see switch-to-buffer-preserve-window-point.

Oh, is it maybe emacsen specific?

I have `switch-to-buffer-preserve-window-point` set to t, but setting it to `nil` gives the same result. Here's how I can reproduce the problem:

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.

Best regards,
-- Al





  reply	other threads:[~2024-09-24 13:12 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 [this message]
2024-09-24 13:43     ` Eli Zaretskii
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=m0setpurec.fsf@gmail.com \
    --to=abdo.haji.ali@gmail.com \
    --cc=73446@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /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).