Subject: Re: bug#73446: 29.1; Curious behaviour with with-current-buffer and read-string

From: Al Haji-Ali <[email-masked]>
Date: Tue, 24 Sep 2024 14:12:43 +0100

> 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