emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: minibuffer-selected-buffer


From: Roland Winkler
Subject: Re: minibuffer-selected-buffer
Date: Sat, 14 Jun 2003 12:26:47 +0200

On Fri Jun 13 2003 Richard Stallman wrote:
>     The function minibuffer-selected-window returns the window which was
>     selected when entering the minibuffer. For bibtex.el I would like to
>     use a function minibuffer-selected-buffer that returns the buffer
>     which was the current buffer when entering the minibuffer. Would it
>     make sense to add such a function to emacs?
> 
> The best practice is to call completing-read only to read arguments
> to a command.  The current buffer when the command is run
> is the selected window's buffer.
> 
> So it seems that (window-buffer (minibuffer-selected-window)) would do
> the job.  In what case is this not correct?

...Thank you! The more I think about it, it seems to me that
(window-buffer (minibuffer-selected-window)) will do the job I
need for bibtex.el. The point is that in my particular problem the
generation of the completion table can be rather expensive. So
Stefan suggested to me that the generation of the completion table
should be delayed until it is really required because the user
hits the TAB key. But then the function generating the completion
table is called only once and it stores the completion table in a
variable that is used afterwards. I think that for this one call of
the function generating the completion table
(window-buffer (minibuffer-selected-window)) will always be
meaningful because it happens prior to any changes in the window
configuration in order to display the completion buffer.

However, I can imagine the following scenario (I don't know how
frequent this might happen):

Suppose that for a certain problem the completion table is always
generated dynamically by calling an appropriate function. Usually,
windows are split in order to display the completion buffer.
However, I can imagine that a user wants to have only one window
displayed that is showing the completions he can choose from. Of
course, this requires that either the user explicitely deletes
minibuffer-selected-window. Or it can happen that a small frame
height allows only one window to be displayed.

Roland





reply via email to

[Prev in Thread] Current Thread [Next in Thread]