🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.help
Article #188952

Re: pop-mail for 18.57?

#188952
From: Wolfgang S. Rupprecht
Date: Fri, 07 Jun 1991 19:14
143 lines
5887 bytes
neitzel@infbs.uucp (Martin Neitzel) writes:
>Has anybody already updated popmail.el for emacs version 18.57?

Yup-

	Here it is.  It works on: 
"GNU Emacs 18.57.3 of Thu Apr 11 1991 on wsrcc.com (berkeley-unix)"

	Popmail does seem to have problems with the Kyle's VM mail
reader though.  Popping only happens when the INBOX isn't read into
emacs already.  Pop-mail with rmail seems to work fine.

-wolfgang


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;									     ;;
;;	File:     popmail.el						     ;;
;;	Author:   Wolfgang S. Rupprecht <wolfgang@wsrcc.com>                 ;;
;;	Created:  Thu Sep 17 14:55:45 EDT 1987				     ;;
;;	Contents: pop up a mail buffer whenever new mail arrives  	     ;;
;;									     ;;
;;	Copyright (c) 1991, 1987 Wolfgang Rupprecht.			     ;;
;; 	Copyright (C) 1985, 1986, 1987 Free Software Foundation, Inc.        ;;
;;									     ;;
;;	$Log$								     ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; GNU Emacs and this file popmail.el, are distributed in the hope
;; that they will be useful, but WITHOUT ANY WARRANTY.  No author or
;; distributor accepts responsibility to anyone for the consequences of
;; using them or for whether they serve any particular purpose or work at
;; all, unless he says so in writing.  Refer to the GNU Emacs General
;; Public License for full details.

;; Everyone is granted permission to copy, modify and redistribute GNU
;; Emacs and popmail.el, but only under the conditions described in the
;; GNU Emacs General Public License.  A copy of this license is supposed
;; to have been given to you along with GNU Emacs so you can know your
;; rights and responsibilities.  It should be in a file named COPYING.
;; Among other things, the copyright notice and this notice must be
;; preserved on all copies.

;; Instructions:
;; Insert the following (minus the leading ';; ') into your .emacs file:
;;
;; (let ((process-connection-type nil))	; try not to hog a pty for this.
;;    (display-time))
;; 
;; ;; don't let two pop-mails be active at once.
;; (if (file-locked-p (expand-file-name "~/RMAIL"))
;;      nil
;;    (load-library "popmail")		; patches time filter
;;    (setq pop-mail t))

(provide 'pop-mail)

(defvar pop-mail nil "*If t display new mail in a pop up mail buffer.
	files listed in rmail-primary-inbox-list are watched")
(defvar pop-mail-ding t "*If non-nil ding bell, when new mail pops up.")
(defvar pop-mail-hook nil "*Optional hook to run when new mail arrives.")

(defvar pop-mail-file "~/RMAIL"
  "*The file into which mail will be popped.
Use ~/INBOX for the vm mail-reader.")

(defvar pop-mail-command 'rmail
  "*The command to invoke when mail appears.
Either 'rmail 'vm will work nicely.")

(defun display-time-filter (proc string)
  "A filter that replaces the 'display-time-filter' filter.
This filter pops up a mail window whenever new mail arrives "
  (let ((time (current-time-string))
	(load (condition-case ()
		  (if (zerop (car (load-average))) ""
		    (format "%03d" (car (load-average))))
		(error "")))
	(mail-spool-file (or display-time-mail-file
			     (getenv "MAIL")
			     (concat rmail-spool-directory
				     (or (getenv "LOGNAME")
					 (getenv "USER")
					 (user-login-name)))))
	hour pm)
    (setq hour (read (substring time 11 13)))
    (setq pm (>= hour 12))
    (if (> hour 12)
	(setq hour (- hour 12))
      (if (= hour 0)
	  (setq hour 12)))
    (setq display-time-string
	  (concat (format "%d" hour) (substring time 13 16)
		  (if pm "pm " "am ")
		  (if (string= load "")
		      ""
		    (concat (substring load 0 -2) "." (substring load -2)))
		  (if (and (file-exists-p mail-spool-file)
			   ;; file not empty?
			   (> (nth 7 (file-attributes mail-spool-file)) 0))
		      (or (and pop-mail (do-pop-mail))
			  " Mail")
		    "")))
    ;; Append the date if desired.
    (if display-time-day-and-date
	(setq display-time-string
	      (concat (substring time 0 11) display-time-string))))
  ;; Force redisplay of all buffers' mode lines to be considered.
  (save-excursion (set-buffer (other-buffer)))
  (set-buffer-modified-p (buffer-modified-p))
  ;; Do redisplay right now, if no input pending.
  (sit-for 0))

(defun do-pop-mail ()
  (if (eq (get-file-buffer pop-mail-file)
	  (current-buffer))
      " MoreMail"
    (save-excursion (funcall pop-mail-command))
    (display-buffer (get-file-buffer pop-mail-file))
    (if pop-mail-ding
	(ding))
    (run-hooks 'pop-mail-hook)
    " Gotit"))

;; This is now MUCH TOO MUCH consing ... -wsr
;;      (let ((list
;;	     (or rmail-primary-inbox-list
;;		 (list "~/mbox"
;;		       (concat rmail-spool-directory
;;			       (if (getenv "LOGNAME")
;;				   "$LOGNAME" "$USER")))))
;;	    file)
;;	(while list
;;	  (if (and (file-exists-p
;;		    (setq file (expand-file-name
;;				(substitute-in-file-name (car list)))))
;;		   (/= 0 (nth 7 (file-attributes file)))) ;size != 0
;; ...
;; 	    (setq list (cdr list)))))))  

-- 
Wolfgang Rupprecht    wolfgang@wsrcc.com (or) uunet!wsrcc!wolfgang
Snail Mail Address:   Box 6524, Alexandria, VA 22306-0524
Technical Details
Message-ID: <1991Jun7.191426.13194@wsrcc.com>
Path: arc1-ca.pugleaf.net!gmdzi!unido!math.fu-berlin.de!fauern!ira.uka.de!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!wuarchive!uunet!visenix!wsrcc.com!wolfgang
References: <3602@infbs.UUCP>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 103b8b,e28b20dbb4a38057
X-Google-Attributes: gid103b8b,public
X-Google-ArrivalTime: 1991-06-07 21:25:44 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!math.fu-berlin.de!fauern!ira.uka.de!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!wuarchive!uunet!visenix!wsrcc.com!wolfgang
From: wolfgang@wsrcc.com (Wolfgang S. Rupprecht)
Newsgroups: gnu.emacs.help
Subject: Re: pop-mail for 18.57?
Message-ID: <1991Jun7.191426.13194@wsrcc.com>
Date: 7 Jun 91 19:14:26 GMT
References: <3602@infbs.UUCP>
Organization: Wolfgang S Rupprecht Computer Consulting, Washington DC.
Lines: 143