GNU bug report logs - #12766
read-from-minibuffer does not preserve current-buffer

Previous Next

Package: emacs;

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


Message #8 received at 12766 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: 12766 <at> debbugs.gnu.org
Subject: Re: bug#12766: read-from-minibuffer does not preserve current-buffer
Date: Tue, 30 Oct 2012 11:27:58 +0100
> % src/emacs -Q --eval "(setq initial-frame-alist '((minibuffer . nil)))"
> M-: (with-temp-buffer (list (read-string "toto: ") (current-buffer))) RET
>
> In Emacs 24.2 this always shows the current-buffer to be the temp buffer
> (which is a killed buffer by the time M-: prints its result).
> But in Emacs trunk, the result depends on whether you issue the M-:
> from the normal frame (where it works right) or from the special
> minibuffer-only frame, where current-buffer after read-string is
> *minibuf-0*!
>
> This is a serious problem, which introduces subtle bugs that can be
> pretty difficult to track down.

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.

And there's also bug#10851 where `read-char-by-name' could change the
current buffer.

Also, is this related to the comment

       ;; FIXME: kill-buffer can change current-buffer in some odd cases.

in `with-temp-buffer'?

martin




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.