[ Not yet submitted to xemacs-patches, because I want opinions on this. ]
In XEmacs 21.4.5, I've noticed that `delete-windows-on' is broken
when multiple devices are used. To reproduce:
* Under X-windows, start: xemacs -q -vanilla
* M-x start-gnuserv
* Start up an xterm, and run gnuclient in the xterm (unset $DISPLAY
before running gnuclient).
* In the xterm XEmacs, create a buffer called "ddd".
* Go back to the X-window XEmacs, and make sure that only the *scratch*
buffer is shown (`C-x 1' if necessary).
* In the X-windows *scratch* buffer, eval `(delete-windows-on "ddd")'
Note that the buffer "ddd" in the xterm is unaffected; the window should
have been deleted, but wasn't.
I think I've tracked this problem down to window_loop(), which
seems to have two bugs:
1. When determining the last window on a device, Fprevious_window() is
allowed to search for windows across all devices, and is not
restricted to the current device. This can cause problems in the
subsequent code that loops over all windows on a given device, as
the "last window" may never be found (as the "last window" may be
on
a different device).
2. window_loop() does have code to prevent an infloop, due to bugs like
the above:
/* Given the outstanding quality of the rest of this code,
I feel no shame about putting this piece of shit in. */
if (++lose_lose >= 500)
return Qnil;
However, the "return Qnil" means that subsequent devices are never
searched; I think this should really be a "break;", to allow
subsequent devices to be searched.
I've attached a patch that addresses both of these. Comments? I'll
submit an official patch if people think this is correct.
--
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.