* minibuffer-selected-buffer
@ 2003-06-12 16:49 Roland Winkler
2003-06-13 22:03 ` minibuffer-selected-buffer Richard Stallman
0 siblings, 1 reply; 5+ messages in thread
From: Roland Winkler @ 2003-06-12 16:49 UTC (permalink / raw)
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?
More specifically my problem is the following: The argument TABLE of
completing-read can be a function that is doing the completion.
When TABLE is called by completing-read the current buffer is the
minibuffer. But I would like to run this function in the buffer foo
which was the current buffer when entering the minibuffer. (This
function should parse the buffer foo in order to generate the
completion table.) This can be achieved using
minibuffer-selected-window provided that the buffer foo has a window
attached to it. But this is essentially irrelevant for my problem.
Parsing the buffer foo makes sense even if currently no window is
attached to it.
Suggestions welcome!
Roland
PS: I have not subscribed to emacs-devel@gnu.org
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: minibuffer-selected-buffer
2003-06-12 16:49 minibuffer-selected-buffer Roland Winkler
@ 2003-06-13 22:03 ` Richard Stallman
2003-06-14 10:26 ` minibuffer-selected-buffer Roland Winkler
0 siblings, 1 reply; 5+ messages in thread
From: Richard Stallman @ 2003-06-13 22:03 UTC (permalink / raw)
Cc: emacs-devel
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?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: minibuffer-selected-buffer
2003-06-13 22:03 ` minibuffer-selected-buffer Richard Stallman
@ 2003-06-14 10:26 ` Roland Winkler
2003-06-14 23:42 ` minibuffer-selected-buffer Kim F. Storm
2003-06-15 15:59 ` minibuffer-selected-buffer Richard Stallman
0 siblings, 2 replies; 5+ messages in thread
From: Roland Winkler @ 2003-06-14 10:26 UTC (permalink / raw)
Cc: emacs-devel
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: minibuffer-selected-buffer
2003-06-14 10:26 ` minibuffer-selected-buffer Roland Winkler
@ 2003-06-14 23:42 ` Kim F. Storm
2003-06-15 15:59 ` minibuffer-selected-buffer Richard Stallman
1 sibling, 0 replies; 5+ messages in thread
From: Kim F. Storm @ 2003-06-14 23:42 UTC (permalink / raw)
Cc: emacs-devel
Roland Winkler <roland.winkler@physik.uni-erlangen.de> writes:
> 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.
If the need arises, the code can just record the selected buffer in a
variable for later, either directly or by using a
minibuffer-setup-hook.
--
Kim F. Storm <storm@cua.dk> http://www.cua.dk
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: minibuffer-selected-buffer
2003-06-14 10:26 ` minibuffer-selected-buffer Roland Winkler
2003-06-14 23:42 ` minibuffer-selected-buffer Kim F. Storm
@ 2003-06-15 15:59 ` Richard Stallman
1 sibling, 0 replies; 5+ messages in thread
From: Richard Stallman @ 2003-06-15 15:59 UTC (permalink / raw)
Cc: emacs-devel
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.
I guess it would have to do something else to decide which buffer
to use, not based on minibuffer-selected-window or anything like that.
It could arbitrarily pick some other window in the right frame
and use its buffer.
I wouldn't bother handling this case, though.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2003-06-15 15:59 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-06-12 16:49 minibuffer-selected-buffer Roland Winkler
2003-06-13 22:03 ` minibuffer-selected-buffer Richard Stallman
2003-06-14 10:26 ` minibuffer-selected-buffer Roland Winkler
2003-06-14 23:42 ` minibuffer-selected-buffer Kim F. Storm
2003-06-15 15:59 ` minibuffer-selected-buffer Richard Stallman
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).