Subject: Re: bug#20832: 25.0.50; todo-show accidentally deleted my todo file.

From: martin rudalics <[email-masked]>
Date: Fri, 19 Jun 2015 08:43:50 +0200

> This is bad :'( It seems one should not change the buffer in a minibuffer
 > window. Perhaps it would be good if this was documented in
 > the docstring of set-window-buffer.

You should use ‘set-window-buffer’ in application programs only if you
know what you're doing.  From the Elisp manual:

      When writing an application, you should normally use the
      higher-level functions described in *Note Switching Buffers::,
      instead of calling `set-window-buffer' directly.

While the minibuffer window is selected, ‘minibuffer-selected-window’
can be used to get the previously selected window.

martin