[comp.emacs] GNU Emacs - loadst - Modeline garbaged until next update.

ron@vsedev.UUCP (02/18/87)

I have a rather strange problem with GNU Emacs' modeline while running
loadst to display time & load information.  The problem is this, 
the time & load is displayed normally, then I spawn a subshell (isn't
System V wonderful...), when I return... the time portion of the time
& load string has several extra numbers preceding the real time & load
string.  Of course this all goes away as soon as Emacs updates the
modeline, but for a minute or so it is grossly incorrect.

Anyone else seen this one.  Oh... BTW this is version 18.36 emacs..
(obviously under System V..)

--
ron@vsedev.VSE.COM	(Ron Flax)
UUCP:	..!seismo!vsedev!ron
INET:	vsedev.VSE.COM!ron@seismo.CSS.GOV

blm@cxsea.UUCP (02/20/87)

In article <415@vsedev.VSE.COM> ron@vsedev.VSE.COM (Ron Flax) writes:
|I have a rather strange problem with GNU Emacs' modeline while running
|loadst to display time & load information.  The problem is this, 
|the time & load is displayed normally, then I spawn a subshell (isn't
|System V wonderful...), when I return... the time portion of the time
|& load string has several extra numbers preceding the real time & load
|string.  Of course this all goes away as soon as Emacs updates the
|modeline, but for a minute or so it is grossly incorrect.

Sigh. I remember this problem on an old Gosling Emacs running on BSD4.1 four
years ago. What happens is that while you're in the subshell, loadst is
still spitting out the time and statistics. When you return to Emacs, the
first time that sub-process is read from, you get all of the time and load
information loadst has been spitting out, which is subsequently displayed in
the mode line. Hence, lots of strange numbers before the correct time and
load.

The fix is relatively easy. I've fixed it in Unipress 2.10, but the same
thing should be possible for GNU. Basically, find the [em]lisp file that
starts loadst (clock.ml for Unipress users), and remove the code that adds a
-n to the end of the loadst command. This will make loadst add a new-line to
the end of each time/statistics line. Then, in the function that reads from
the sub-process, have it do two things to the string it reads. First, strip
the trailing new-line, and second, remove everything up to the (now) last
new-line. Display this new string. Only the last output of loadst is
displayed, which is what you want.

-- 

Brian L. Matthews                               "Facts are impotent against
...{mnetor,uw-beaver!ssc-vax}!cxsea!blm          loud and frequent assertion."
+1 206 251 6811
Computer X Inc. - a division of Motorola New Enterprises

drw@cullvax.UUCP (02/26/87)

blm@cxsea.UUCP (Brian Matthews) writes:
> Sigh. I remember this problem on an old Gosling Emacs running on BSD4.1 four
> years ago. What happens is that while you're in the subshell, loadst is
> still spitting out the time and statistics. When you return to Emacs, the
> first time that sub-process is read from, you get all of the time and load
> information loadst has been spitting out, which is subsequently displayed in
> the mode line. Hence, lots of strange numbers before the correct time and
> load.

Well, there's code in GNU to do this (I don't know if it works, but I
haven't caught it out yet...) -- see display-time-filter in time.el.

Dale
-- 
Dale Worley		Cullinet Software
UUCP: ...!seismo!harvard!mit-eddie!cullvax!drw
ARPA: cullvax!drw@eddie.mit.edu