[comp.emacs] mail without time

ghh@clarity.princeton.edu (Gilbert Harman) (07/25/88)

In gnu emacs 19.50.3 is there a way to have new mail
indicated in the mode line without having the time and load
showing up?

--
		       Gilbert Harman
                       Princeton University Cognitive Science Laboratory
	               221 Nassau Street, Princeton, NJ 08542
			      
		       ghh@princeton.edu
		       HARMAN@PUCC.BITNET

jr@bbn.com (John Robinson) (07/26/88)

In article <GHH.88Jul25140445@clarity.princeton.edu>, ghh@clarity (Gilbert Harman) writes:
>In gnu emacs 19.50.3 is there a way to have new mail
>indicated in the mode line without having the time and load
>showing up?

[I assume you mean 18.50.3, or else I just missed a time warp]

The stuff that goes into the mode line is simply the output of the
program loadst, which is normally run from the emacs/etc/ directory.
If you put a program named loadst on your search path, emacs will
execute it first.  I did this for a while with a shell script that
looked for new news and added [News] to the modeline when appropriate.

To get only [Mail] have the shellscript check ~/mailbox and act
accordingly; it just does this every 60 seconds and emacs does the
rest.  If you want it in C, pick up and hack the source from
emacs/etc/.
-- 

Ram-Ashwin@cs.yale.edu (Ashwin Ram) (07/26/88)

In article <27412@bbn.COM>, jr@bbn (John Robinson) writes:
> In article <GHH.88Jul25140445@clarity.princeton.edu>, ghh@clarity (Gilbert Harman) writes:
> >In gnu emacs 19.50.3 is there a way to have new mail
> >indicated in the mode line without having the time and load
> >showing up?
> The stuff that goes into the mode line is simply the output of the
> program loadst, which is normally run from the emacs/etc/ directory.
> If you put a program named loadst on your search path, emacs will
> execute it first.  I did this for a while with a shell script that
> looked for new news and added [News] to the modeline when appropriate.

Although this will work, there is another way to do this purely inside
Emacs-Lisp.  The function display-time-filter is used to filter the output of
the loadst process before it is put into the mode-line (see lisp/time.el).
display-time-filter sets the variable display-time-string to a string that will
be displayed in the mode-line.  You can rewrite display-time-filter to display
the string as you want it.  (You can also have other background processes (e.g.,
a new news checker) modify display-time-string to get other kinds of
notification without rewriting loadst.)  Both methods will work -- it's upto you
which one you prefer.

It would be nice if display-time-filter ran a hook at its end so that one could
do stuff like this (customize the date and time display, add on other
notifications such as [News], etc.) without having to rewrite either loadst or
display-time-filter.

-- Ashwin.

ARPA:    Ram-Ashwin@cs.yale.edu
UUCP:    {decvax,ucbvax,harvard,cmcl2,...}!yale!Ram-Ashwin
BITNET:  Ram@yalecs

montnaro@sprite.steinmetz.ge.com (Skip Montanaro) (07/27/88)

Here's a /bin/sh version of loadst I pieced together. It ignores the uflag,
but then, Emacs doesn't use it.
----------
#!/bin/sh

nflag=
uflag=
repetition=

while [ $# -gt 0 ] ; do
    case $1 in
	-n) nflag=$1 ;;
	-u) uflag=$1 ;;
	 *) repetition=$1 ;;
    esac
    shift
done

while [ true ] ; do
    if [ -r /usr/spool/mail/$USER ] ; then
	echo $nflag "Mail"
    else
	echo $nflag "-"
    fi
    sleep $repetition
done
----------
--
Skip Montanaro (montanaro@sprite.steinmetz.ge.com, montanaro@ge-crd.arpa)