[ I'm sure Vin's already seen this, but other people may be interested
in this. ]
Vin Shelton <acs(a)xemacs.org> wrote:
The problem this person is attempting to solve is having the window
split vertically (a la C-x 3) and generating a completion list. The
list is always generated for the width of the entire frame. It is an
annoying problem. Does anyone have any spare cycles to fix this?
Here's the original poster's (newer) solution.
It doesn't appear to be any worse than the current code. Comments?
--
Darryl Okahata
darrylo(a)soco.agilent.com
DISCLAIMER: this message is the author's personal opinion and does not
constitute the support, opinion, or policy of Agilent Technologies, or
of the little green men that have been following him all day.
From: "Mehul A. Shah" <mashah(a)cs.berkeley.edu>
Subject: XEmacs team -- fix for Completion list too wide problem
Newsgroups: comp.emacs.xemacs
Date: Tue, 01 Aug 2000 11:04:34 -0700
Organization: University of California at Berkeley
Mehul Shah wrote:
Regarding my previous post about the Completion list being too wide, I
could not find a configuration option that allowed me to fix the
problem.
Instead, what I had to do is read through the system lisp files to find
the appropriate functions that were called when displaying the
completion list.
The problem seems to have to with the "with-output-to-temp-buffer"
function which is used throughout. It does not display the temp buffer
in a window until the display-completion-list is completed. The
display-completion-list function does the formatting, and defaults to
the width of the *frame* not the *window*, which is why the completion
list is too wide. The only way to get the width of the window is to
display empty output to a temp-buffer and then call it again with the
output of the display-completion-list buffer. For file completions, in
the file list-mode.el, the function minibuffer-completion-help, I added
a dummy call:
(with-output-to-temp-buffer *Completions* ())
to display the *Completions* window.
Then in minibuf.el, in read-file-name-1 in the call to
display-completion-list
I added
:window-width (window-width (get-buffer-window (get-buffer
"*Completions*")))
This fixed the Completion list window being too wide for reading in
file-names. However this does not fix the Completion lists when
switching buffers or when looking for a command with M-x. I can't seem
to find the code where the display-completion-list function call is for
these completion commands. Can anyone help?
Thanks,
Mehul
Ignore the hack above, here is a better solution.
Okay, I have found a reasonable solution to the *Completion* list being
too wide problem. Here is the quick fix, although I believe the code
should be restructured so that the temporary buffer is displayed before
its contents are formatted. This way, the code does not have to guess at
what the width is of the window in which the temporary buffer is
displayed.
In list-mode.el previously, in the function display-completion-list, the
width of the window was guessed with the following code:
(frame-width (or (last-nonminibuf-frame)
(selected-frame)))
Basically, guessing that the width of the completion window would be the
same as the width of the last selected frame or the width of the last
non-minibuffer frame. Unfortunately, this is no the case when you split
the frame vertically. So here is a better guess:
(window-width (get-lru-window (last-nonminibuf-frame)))
This basically gets the width of the least recently used window, which
happens to be the window in which the temp buffer tends to get displayed
in. I have not verified this fact in the code, but seems to work when I
use it.
So, in list-mode.el I simply replaced the previous guess with the new
one and the formatting came out much better (both in cases where a new
window is created for the temp buffer and one in which there is an
available window for the temp buffer).
Please let me know how I can tell the XEmacs team about this fix.
Thanks,
Mehul