GNU bug report logs -
#12766
read-from-minibuffer does not preserve current-buffer
Previous Next
Reported by: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Date: Mon, 29 Oct 2012 20:33:02 UTC
Severity: normal
Found in version 24.2.50
Done: martin rudalics <rudalics <at> gmx.at>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
>> % src/emacs -Q --eval "(setq initial-frame-alist '((minibuffer . nil)))"
>> M-: (with-temp-buffer (list (read-string "toto: ") (current-buffer))) RET
> Two changes I made could be involved:
> (1) `select-window' now always makes the window's buffer current.
> (2) read_minibuf now calls set_window_buffer instead of
> Fset_window_buffer.
I think (1) is more likely to be the problem. Could you check
read_minibuf to see which unwind is supposed to reset the
current buffer?
Maybe that code worked by accident (.e.g relying on the fact that
select-window didn't set current-buffer in that corner case) and the
right fix is simply to explicitly save&restore current buffer.
> Also, is this related to the comment
> ;; FIXME: kill-buffer can change current-buffer in some odd cases.
> in `with-temp-buffer'?
No, (current-buffer) is evaluated before the buffer gets killed, and the
bug shows up with with-temp-buffer (the recipe is just shorter with
with-temp-buffer, but you can try it with (with-current-buffer
(get-buffer-create " *sm-test*") ...) to convince yourself).
Stefan
This bug report was last modified 12 years and 254 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.