TKBIFF(1) TKBIFF(1) NAME tkbiff - Tk/Tcl biff implementation for the X Window Sys- tem SYNOPSIS tkbiff -options DESCRIPTION Tkbiff is a Tk/Tcl implementation of biff for the X Window System. It keeps track of multiple mailboxes, each mail- box having a separate button in the tkbiff window. The individual mailboxes are monitored, and when mail arrives, the tkbiff button for that mailbox changes color. The button may be pressed to invoke the MUA to handle the mail in that mailbox's file. Tkbiff is ideally suited for use with procmail, where procmail is used to file incoming mail into folders or files. (Procmail was written by Stephen R. van den Berg, berg@pool.informatik.rwth-aachen.de.) As a typical config- uration, using GNU emacs as the MUA, the unix mailbox directory might be ${HOME}/.Mail-this is where procmail delivers mail into separate files. (This permits procmail and emacs to safely interlock using metaphore lock files, a standard way of solving concurrency issues in the mail system.) The emacs rmail directory might be ${HOME}/.Rmail. The ${HOME}/.Rmail directory contains one rmail "Babyl" file for each corresponding "mail folder" in the ${HOME}/.Mail directory, ie., editing any of these files with emacs will automatically post a lock on the corresponding file in ${HOME}/.Mail, (or wait until proc- mail "releases" the file,) get the mail and transfer it into the ${HOME}/.Rmail directory for processing. As an example configuration: The ${HOME}/.forward file might look like: "|IFS=' ';exec /usr/local/bin/procmail" which will invoke procmail to place mail in the appropri- ate folders, as defined in the ${HOME}/.procmailrc file. The ${HOME}/.procmailrc file might contain: MAILDIR = $HOME/.Mail DEFAULT = username :0: * ^TOfavorite-list favorite-list :0: June 17, 1995 1 TKBIFF(1) TKBIFF(1) * ^FROMmyfriend@somewhere.com myfriend :0: * ^FROMmother /dev/null where username is the login ID of the user, favorite-list is the file where all things mailed from the mailing list, favorite-list, will be placed. Another file named myfriend will be created to hold all mail from myfriend@somewhere.com, and mother is someone you never want to hear from. The ${HOME}/.emacs might contain: ; ; If procmail is running, change the mail and rmail directories ; (if (file-exists-p (expand-file-name "~/.procmailrc")) (setq rmail-spool-directory (expand-file-name "~/.Mail/")) (setq rmail-default-directory (expand-file-name "~/.Rmail/")) ) which will assign emacs the directory structure outlined above. Resolution of concurrency issues can be verified by using the program "lockfile" that is distributed with procmail-have it post a lock file on one of the files in ${HOME}/.Mail, and edit the corresponding file in ${HOME}/.Rmail. Emacs should complain that the file has a lock on it, and wait for lockfile to relinquish the lock. The ${HOME}/.profile might contain if [ -f ${HOME}/.procmailrc ]; then MAIL=${HOME}/.Mail/${LOGNAME} else MAIL=/var/spool/mail/${LOGNAME:?} fi These are a safty catch that notify any other programs that may be using the mail system where to manipulate mail files-for example elm can safely be used on the normal mail file, ${HOME}/.Mail/username, (but no others.) When Tkbiff is invoked, it scans the ${HOME}/.Rmail direc- tory for the emacs rmail "babyl" files, making a list of the file basenames. (It is presumed that the ${HOME}/.procmailrc file is consistent with the filenames that are in ${HOME}/.Rmail-no checking is done.) A button is made for each file name, and the corresponding files in ${HOME}/.Mail are continually scanned for new mail. When procmail places mail into one of these files, the file's button on the Tkbiff window changes color from blue to June 17, 1995 2 TKBIFF(1) TKBIFF(1) red. "Pushing" this button will invoke emacs to edit the corresponding ${HOME}/.Rmail file, which in turn will get the new mail from the corresponding ${HOME}/.Mail file. In a similar fashion, for vm, the ${HOME}/.emacs might contain (autoload 'vm "vm" "Start VM on your primary inbox." t) (autoload 'vm-other-frame "vm" "Like `vm' but starts in another frame." t) (autoload 'vm-visit-folder "vm" "Start VM on an arbitrary folder." t) (autoload 'vm-visit-virtual-folder "vm" "Visit a VM virtual folder." t) (autoload 'vm-mode "vm" "Run VM major mode on a buffer" t) (autoload 'vm-mail "vm" "Send a mail message using VM." t) (autoload 'vm-submit-bug-report "vm" "Send a bug report about VM." t) (setq auto-mode-alist (append (list (cons (expand-file-name "~/\.Vm/") 'vm-mode)) auto-mode-alist)) ; set vm-mode when any file in the ~/.Vm directory is accessed (setq vm-folder-directory (expand-file-name "~/.Vm/")) ; vm folder directory and ${HOME}/.vm might contain (setq vm-mode-hook ' (lambda () (progn . . . (vm-get-new-mail) ; last order of business when entering vm mode is to get any new mail ) ) ) (setq vm-spool-files ' ( ("~/.Vm/favorite-list" "~/.Mail/favorite-list" "~/.Vm/.favorite-list") ("~/.Vm/friend" "~/.Mail/friend" "~/.Vm/.friend") . . . ) ) and tkbiff might be changed to . . . set vm ".Vm" . . . button .$x -text "$x" -highlightthickness 0 -padx 0 -pady 0 -fg blue -command "edit $home/$vm/$x" -font $font The rmail babyl files, (named favorite-list and friend, in this example case,) will still have to be in ${HOME}/.Rmail since tkbiff scans this directory to find what folders are available, ie., where procmail puts new June 17, 1995 3 TKBIFF(1) TKBIFF(1) mail. Both the rmail and vm version can coexist, and be used interchangeably. OPTIONS All standard Tk/Tcl options are honored. WARNINGS To conserve cpu resources, the mailbox files should not be continually scanned, but the only "wait" function avail- able in tk is the "after" function. While "after" is exe- cuting, no events (like responding to mouse movement, or button events,) will be processed, which makes the display unresponsive. The solution is to do very short "after"s while in the file search loop, with a corresponding "update" call-the responsiveness of the display is accept- able, and both the "time" and "top" commands run over many minutes of operation indicate that the cpu resources required are very minimal. It would be advisable to invoke the program with nice(1). SEE ALSO biff(1), xbuffy(1), xbiff(1) DIAGNOSTICS Standard Tk/Tcl error messages and diagnositcs. AUTHORS ---------------------------------------------------------------------- A license is hereby granted to reproduce this software source code and to create executable versions from this source code for personal, non-commercial use. The copyright notice included with the software must be maintained in all copies produced. THIS PROGRAM IS PROVIDED "AS IS". THE AUTHOR PROVIDES NO WARRANTIES WHATSOEVER, EXPRESSED OR IMPLIED, INCLUDING WARRANTIES OF MERCHANTABILITY, TITLE, OR FITNESS FOR ANY PARTICULAR PURPOSE. THE AUTHOR DOES NOT WARRANT THAT USE OF THIS PROGRAM DOES NOT INFRINGE THE INTELLECTUAL PROPERTY RIGHTS OF ANY THIRD PARTY IN ANY COUNTRY. Copyright (c) 1995, John Conover, All Rights Reserved. Comments and/or bug reports should be addressed to: john@email.johncon.com (John Conover) ---------------------------------------------------------------------- June 17, 1995 4